<commit_before>require 'spec_helper'

describe UserController do

  describe "GET 'new'" do
    it "returns http success" do
      get 'new'
      response.should be_success
    end
  end

  describe "POST 'create'" do

    context 'with valid attributes' do

      it 'saves the new contact to the database' do
        expect {
          post :create, user: FactoryGirl.attributes_for(:user)
        }.to change{User.count}.by(1)
      end

      it 'redirects to the home page' do
        post :create, user: FactoryGirl.attributes_for(:user)

        response.should redirect_to root_url
      end

    end

    context 'with invalid attributes' do

      it 'does not save the new contact in the database' do
        expect {
          post :create, user: FactoryGirl.attributes_for(:invalid_user)
        }.to_not change{User.count}
      end

      it 're-renders the new template' do
        post :create, user: FactoryGirl.attributes_for(:invalid_user)

        response.should render_template('new')
      end

    end

  end

end<commit_msg>Replace contact with user.<commit_after>require 'spec_helper'

describe UserController do

  describe "GET 'new'" do
    it "returns http success" do
      get 'new'
      response.should be_success
    end
  end

  describe "POST 'create'" do

    context 'with valid attributes' do

      it 'saves the new user to the database' do
        expect {
          post :create, user: FactoryGirl.attributes_for(:user)
        }.to change{User.count}.by(1)
      end

      it 'redirects to the home page' do
        post :create, user: FactoryGirl.attributes_for(:user)

        response.should redirect_to root_url
      end

    end

    context 'with invalid attributes' do

      it 'does not save the new user in the database' do
        expect {
          post :create, user: FactoryGirl.attributes_for(:invalid_user)
        }.to_not change{User.count}
      end

      it 're-renders the new template' do
        post :create, user: FactoryGirl.attributes_for(:invalid_user)

        response.should render_template('new')
      end

    end

  end

end
{'fraction_non_alphanumeric': 0.07633949739212897, 'fraction_numerical': 0.000948316737790422, 'mean_word_length': 2.408723747980614, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2259588', 'n_tokens_mistral': 626, 'n_tokens_neox': 585, 'n_words': 206}