diff options
author | Jose Ivan Vargas <jvargas@gitlab.com> | 2017-10-06 17:15:44 -0500 |
---|---|---|
committer | Jose Ivan Vargas <jvargas@gitlab.com> | 2017-10-06 17:15:44 -0500 |
commit | 02838d5be2f899793ce5e026f0bb20c509697061 (patch) | |
tree | de3e125ca3f997bb94e079e2d2dbdc879d3dd7c6 /spec/features/profiles | |
parent | 035bf5d4d5d3209286aa257cbd56ec6ce9e1afb9 (diff) | |
parent | 3cbab382f678cef273cde319aae55f050d27527d (diff) | |
download | gitlab-ce-02838d5be2f899793ce5e026f0bb20c509697061.tar.gz |
Merge branch 'master' into sh-headless-chrome-support
Diffstat (limited to 'spec/features/profiles')
-rw-r--r-- | spec/features/profiles/emails_spec.rb | 71 | ||||
-rw-r--r-- | spec/features/profiles/gpg_keys_spec.rb | 14 |
2 files changed, 84 insertions, 1 deletions
diff --git a/spec/features/profiles/emails_spec.rb b/spec/features/profiles/emails_spec.rb new file mode 100644 index 00000000000..11cc8aae6f3 --- /dev/null +++ b/spec/features/profiles/emails_spec.rb @@ -0,0 +1,71 @@ +require 'rails_helper' + +feature 'Profile > Emails' do + let(:user) { create(:user) } + + before do + sign_in(user) + end + + describe 'User adds an email' do + before do + visit profile_emails_path + end + + scenario 'saves the new email' do + fill_in('Email', with: 'my@email.com') + click_button('Add email address') + + expect(page).to have_content('my@email.com Unverified') + expect(page).to have_content("#{user.email} Verified") + expect(page).to have_content('Resend confirmation email') + end + + scenario 'does not add a duplicate email' do + fill_in('Email', with: user.email) + click_button('Add email address') + + email = user.emails.find_by(email: user.email) + expect(email).to be_nil + expect(page).to have_content('Email has already been taken') + end + end + + scenario 'User removes email' do + user.emails.create(email: 'my@email.com') + visit profile_emails_path + expect(page).to have_content("my@email.com") + + click_link('Remove') + expect(page).not_to have_content("my@email.com") + end + + scenario 'User confirms email' do + email = user.emails.create(email: 'my@email.com') + visit profile_emails_path + expect(page).to have_content("#{email.email} Unverified") + + email.confirm + expect(email.confirmed?).to be_truthy + + visit profile_emails_path + expect(page).to have_content("#{email.email} Verified") + end + + scenario 'User re-sends confirmation email' do + email = user.emails.create(email: 'my@email.com') + visit profile_emails_path + + expect { click_link("Resend confirmation email") }.to change { ActionMailer::Base.deliveries.size } + expect(page).to have_content("Confirmation email sent to #{email.email}") + end + + scenario 'old unconfirmed emails show Send Confirmation button' do + email = user.emails.create(email: 'my@email.com') + email.update_attribute(:confirmation_sent_at, nil) + visit profile_emails_path + + expect(page).not_to have_content('Resend confirmation email') + expect(page).to have_content('Send confirmation email') + end +end diff --git a/spec/features/profiles/gpg_keys_spec.rb b/spec/features/profiles/gpg_keys_spec.rb index 623e4f341c5..59233e92f93 100644 --- a/spec/features/profiles/gpg_keys_spec.rb +++ b/spec/features/profiles/gpg_keys_spec.rb @@ -4,7 +4,7 @@ feature 'Profile > GPG Keys' do let(:user) { create(:user, email: GpgHelpers::User2.emails.first) } before do - login_as(user) + sign_in(user) end describe 'User adds a key' do @@ -20,6 +20,18 @@ feature 'Profile > GPG Keys' do expect(page).to have_content('bette.cartwright@example.net Unverified') expect(page).to have_content(GpgHelpers::User2.fingerprint) end + + scenario 'with multiple subkeys' do + fill_in('Key', with: GpgHelpers::User3.public_key) + click_button('Add key') + + expect(page).to have_content('john.doe@example.com Unverified') + expect(page).to have_content(GpgHelpers::User3.fingerprint) + + GpgHelpers::User3.subkey_fingerprints.each do |fingerprint| + expect(page).to have_content(fingerprint) + end + end end scenario 'User sees their key' do |