<commit_before>require 'spec_helper'

describe "User pages" do

  subject { page }

  describe "signup page" do
    before { visit new_user_path }

    it { should have_selector('h1', text: 'Sign up') }
  end


  describe "users page" do
    before { visit users_path }

    it { should have_selector('h1', text: 'All users') }
  end

  describe "profile page" do
    let(:user) { FactoryGirl.create(:user) }
    before { visit user_path(user) }

    it { should have_selector('h1', text: user.name) }
  end

  describe "signup" do
    before { visit new_user_path }
    let (:submit) { "Create new account" }

    describe "with invalid user data" do
      it "should not create a user" do
        expect { click_button submit}.not_to change(User, :count)
      end
    end

    describe "with valid user data" do
      before do
        fill_in "Name", with: "<NAME>"
        fill_in "Email", with: "<EMAIL>"
        fill_in "Password", with: "<PASSWORD>"
        fill_in "Confirmation", with: "foobar"
      end

      it "should create a user" do
        expect { click_button submit }.to change(User, :count).by(1)
      end
    end
  end

end<commit_msg>Add tests for after new user submission<commit_after>require 'spec_helper'

describe "User pages" do

  subject { page }

  describe "signup page" do
    before { visit new_user_path }

    it { should have_selector('h1', text: 'Sign up') }
  end


  describe "users page" do
    before { visit users_path }

    it { should have_selector('h1', text: 'All users') }
  end

  describe "profile page" do
    let(:user) { FactoryGirl.create(:user) }
    before { visit user_path(user) }

    it { should have_selector('h1', text: user.name) }
  end

  describe "signup" do
    before { visit new_user_path }
    let (:submit) { "Create new account" }

    describe "with invalid user data" do
      it "should not create a user" do
        expect { click_button submit}.not_to change(User, :count)
      end

      describe "after submition" do
        before { click_button submit }
        it { should have_selector('div#error_explanation') }
      end
    end

    describe "with valid user data" do
      before do
        fill_in "Name", with: "<NAME>"
        fill_in "Email", with: "<EMAIL>"
        fill_in "Password", with: "<PASSWORD>"
        fill_in "Confirmation", with: "foobar"
      end

      it "should create a user" do
        expect { click_button submit }.to change(User, :count).by(1)
      end

      describe "after submition" do
        before { click_button submit }
        let(:user) { User.find_by_email('<EMAIL>') }

        it { should have_selector('h1', text: user.name) }
      end
    end
  end

end
{'fraction_non_alphanumeric': 0.10772659732540862, 'fraction_numerical': 0.0033432392273402673, 'mean_word_length': 2.6099195710455763, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, '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': '1342827', 'n_tokens_mistral': 863, 'n_tokens_neox': 828, 'n_words': 277}