diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-05-06 11:55:35 +0000 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-05-06 11:55:35 +0000 |
commit | fe68e1e67108f6c0179c9804fd5e7359e76ea42e (patch) | |
tree | 7319232eae05dfefd5542a93e4e2b2ac868d55e9 | |
parent | 1186dcabbfb8e885351c1ef05d4583fd474732e9 (diff) | |
download | gitlab-ce-improve-signup_spec-ce.tar.gz |
Improved signup_spec to run in a state that is actually possible to useimprove-signup_spec-ce
-rw-r--r-- | spec/features/signup_spec.rb | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/spec/features/signup_spec.rb b/spec/features/signup_spec.rb index 9fde8d6e5cf..7b62438a533 100644 --- a/spec/features/signup_spec.rb +++ b/spec/features/signup_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Signup', feature: true do +feature 'Signup', :js, :feature do describe 'signup with no errors' do context "when sending confirmation email" do before { allow_any_instance_of(ApplicationSetting).to receive(:send_user_confirmation_email).and_return(true) } @@ -10,6 +10,8 @@ feature 'Signup', feature: true do visit root_path + click_link 'Register' + fill_in 'new_user_name', with: user.name fill_in 'new_user_username', with: user.username fill_in 'new_user_email', with: user.email @@ -30,6 +32,8 @@ feature 'Signup', feature: true do visit root_path + click_link 'Register' + fill_in 'new_user_name', with: user.name fill_in 'new_user_username', with: user.username fill_in 'new_user_email', with: user.email @@ -44,37 +48,54 @@ feature 'Signup', feature: true do end describe 'signup with errors' do - it "displays the errors" do - existing_user = create(:user) + it "displays a form incomplete error" do user = build(:user) visit root_path + click_link 'Register' + fill_in 'new_user_name', with: user.name fill_in 'new_user_username', with: user.username - fill_in 'new_user_email', with: existing_user.email + fill_in 'new_user_email', with: user.email fill_in 'new_user_password', with: user.password click_button "Register" - expect(current_path).to eq user_registration_path - expect(page).to have_content("errors prohibited this user from being saved") - expect(page).to have_content("Email has already been taken") - expect(page).to have_content("Email confirmation doesn't match") + expect(page).to have_content('Please retype the email address') end - it 'does not redisplay the password' do + it "displays an existing email error" do existing_user = create(:user) user = build(:user) visit root_path + click_link 'Register' + + fill_in 'new_user_name', with: user.name + fill_in 'new_user_username', with: user.username + fill_in 'new_user_email', with: existing_user.email + fill_in 'new_user_email_confirmation', with: existing_user.email + fill_in 'new_user_password', with: user.password + click_button "Register" + + expect(page).to have_content('1 error prohibited this user from being saved') + expect(page).to have_content('Email has already been taken') + end + + it 'does not redisplay the password' do + user = build(:user) + + visit root_path + + click_link 'Register' + fill_in 'new_user_name', with: user.name fill_in 'new_user_username', with: user.username fill_in 'new_user_email', with: existing_user.email fill_in 'new_user_password', with: user.password click_button "Register" - expect(current_path).to eq user_registration_path expect(page.body).not_to match(/#{user.password}/) end end |