<commit_before>require 'spec_helper'

describe "Admin::Users" do
  before { login_as :admin }

  describe "GET /admin/users" do
    before do
      visit admin_users_path
    end

    it "should be ok" do
      current_path.should == admin_users_path
    end

    it "should have users list" do
      page.should have_content(@user.email)
      page.should have_content(@user.name)
    end
  end

  describe "GET /admin/users/new" do
    before do
      @password = "<PASSWORD>"
      visit new_admin_user_path
      fill_in "user_name", :with => "<NAME>"
      fill_in "user_email", :with => "<EMAIL>"
      fill_in "user_password", :with => <PASSWORD>
      fill_in "user_password_confirmation", :with => <PASSWORD>
    end

    it "should create new user" do
      expect { click_button "Save" }.to change {User.count}.by(1)
    end

    it "should create user with valid data" do
      click_button "Save"
      user = User.last
      user.name.should ==  "<NAME>"
      user.email.should == "<EMAIL>"
    end

    it "should call send mail" do
      Notify.should_receive(:new_user_email).and_return(stub(:deliver => true))
      click_button "Save"
    end

    it "should send valid email to user with email & password" do
      click_button "Save"
      user = User.last
      email = ActionMailer::Base.deliveries.last
      email.subject.should have_content("Account was created")
      email.body.should have_content(user.email)
      email.body.should have_content(@password)
    end
  end

  describe "GET /admin/users/:id" do
    before do
      visit admin_users_path
      click_link "Show"
    end

    it "should have user info" do
      page.should have_content(@user.email)
      page.should have_content(@user.name)
      page.should have_content(@user.is_admin?)
    end
  end

  describe "GET /admin/users/:id/edit" do
    before do
      @simple_user = Factory :user
      visit admin_users_path
      click_link "edit_user_#{@simple_user.id}"
    end

    it "should have user edit page" do
      page.should have_content("Name")
      page.should have_content("Password")
    end
<commit_msg>fixed test<commit_after>require 'spec_helper'

describe "Admin::Users" do
  before { login_as :admin }

  describe "GET /admin/users" do
    before do
      visit admin_users_path
    end

    it "should be ok" do
      current_path.should == admin_users_path
    end

    it "should have users list" do
      page.should have_content(@user.email)
      page.should have_content(@user.name)
    end
  end

  describe "GET /admin/users/new" do
    before do
      @password = "<PASSWORD>"
      visit new_admin_user_path
      fill_in "user_name", :with => "<NAME>"
      fill_in "user_email", :with => "<EMAIL>"
      fill_in "user_password", :with => <PASSWORD>
      fill_in "user_password_confirmation", :with => <PASSWORD>
    end

    it "should create new user" do
      expect { click_button "Save" }.to change {User.count}.by(1)
    end

    it "should create user with valid data" do
      click_button "Save"
      user = User.last
      user.name.should ==  "<NAME>"
      user.email.should == "<EMAIL>"
    end

    it "should call send mail" do
      Notify.should_receive(:new_user_email).and_return(stub(:deliver => true))
      click_button "Save"
    end

    it "should send valid email to user with email & password" do
      click_button "Save"
      user = User.last
      email = ActionMailer::Base.deliveries.last
      email.subject.should have_content("Account was created")
      email.body.should have_content(user.email)
      email.body.should have_content(@password)
    end
  end

  describe "GET /admin/users/:id" do
    before do
      visit admin_users_path
      click_link "Show"
    end

    it "should have user info" do
      page.should have_content(@user.email)
      page.should have_content(@user.name)
      page.should have_content(@user.projects_limit)
    end
  end

  describe "GET /admin/users/:id/edit" do
    before do
      @simple_user = Factory :user
      visit admin_users_path
      click_link "edit_user_#{@simple_user.id}"
    end

    it "should have user edit page" do
      page.should have_content("Name")
      page.should have_content("Password")
    end

{'fraction_non_alphanumeric': 0.10075507314771119, 'fraction_numerical': 0.00047192071731949034, 'mean_word_length': 2.711908931698774, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 27, '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': '5778612', 'n_tokens_mistral': 1340, 'n_tokens_neox': 1319, 'n_words': 367}