<commit_before>require 'spec_helper'

describe "Login" do
  before do
    @user = FactoryGirl.create(:user, :password => "<PASSWORD>")
    @channel = FactoryGirl.create(:channel, :name => "Cool")
  end

  it "shows the login form when visiting the site", js: true do
    visit root_path

    page.should have_content("Sign In")

  end

  it "allows someone to log in and chat", js: true do
    visit root_path
    fill_in "Username", :with => @user.username
    fill_in "Password", :with => "<PASSWORD>"

    click_button "Sign in"

    page.should have_content(@user.first_name)
    page.should have_content(@user.last_name)

    chat_input = find(:css, ".chat-input")
    chat_input.set "Hello there"
    click_button "Post"

    within("#channel-activities-1") do<commit_msg>Make capybara await the presence of the .chat-input before #find-ing it.<commit_after>require 'spec_helper'

describe "Login" do
  before do
    @user = FactoryGirl.create(:user, :password => "<PASSWORD>")
    @channel = FactoryGirl.create(:channel, :name => "Cool")
  end

  it "shows the login form when visiting the site", js: true do
    visit root_path

    page.should have_content("Sign In")

  end

  it "allows someone to log in and chat", js: true do
    visit root_path
    fill_in "Username", :with => @user.username
    fill_in "Password", :with => "<PASSWORD>"

    click_button "Sign in"

    page.should have_content(@user.first_name)
    page.should have_content(@user.last_name)

    expect(page).to have_css('.chat-input')
    chat_input = find(:css, ".chat-input")
    chat_input.set "Hello there"
    click_button "Post"

    within("#channel-activities-1") do
{'fraction_non_alphanumeric': 0.12537673297166968, 'fraction_numerical': 0.0012055455093429777, 'mean_word_length': 3.662921348314607, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '213482', 'n_tokens_mistral': 542, 'n_tokens_neox': 517, 'n_words': 155}