diff options
author | Jose Ivan Vargas <jvargas@gitlab.com> | 2017-09-13 12:21:33 -0500 |
---|---|---|
committer | Jose Ivan Vargas <jvargas@gitlab.com> | 2017-09-13 12:21:33 -0500 |
commit | 4c0beb6c024b25ff24c7c2ea966bacab0ee860d5 (patch) | |
tree | f3e61556a1cc9132f439d222dca9d6366eb8a6ca /spec/features/profiles | |
parent | 2d58626a33bc0d4e78eaf0c25965d18a6239fa3b (diff) | |
parent | 33010da28b0f2e00e96cc4bf6c439363905a81d5 (diff) | |
download | gitlab-ce-4c0beb6c024b25ff24c7c2ea966bacab0ee860d5.tar.gz |
Merge branch 'master' into sh-headless-chrome-support
Diffstat (limited to 'spec/features/profiles')
-rw-r--r-- | spec/features/profiles/user_manages_emails_spec.rb | 78 | ||||
-rw-r--r-- | spec/features/profiles/user_visits_profile_account_page_spec.rb | 16 | ||||
-rw-r--r-- | spec/features/profiles/user_visits_profile_authentication_log_page_spec.rb | 16 | ||||
-rw-r--r-- | spec/features/profiles/user_visits_profile_page_spec.rb | 16 | ||||
-rw-r--r-- | spec/features/profiles/user_visits_profile_preferences_page_spec.rb (renamed from spec/features/profiles/preferences_spec.rb) | 14 | ||||
-rw-r--r-- | spec/features/profiles/user_visits_profile_ssh_keys_page_spec.rb | 16 |
6 files changed, 152 insertions, 4 deletions
diff --git a/spec/features/profiles/user_manages_emails_spec.rb b/spec/features/profiles/user_manages_emails_spec.rb new file mode 100644 index 00000000000..7283c76eb54 --- /dev/null +++ b/spec/features/profiles/user_manages_emails_spec.rb @@ -0,0 +1,78 @@ +require 'spec_helper' + +describe 'User manages emails' do + let(:user) { create(:user) } + + before do + sign_in(user) + + visit(profile_emails_path) + end + + it "shows user's emails" do + expect(page).to have_content(user.email) + + user.emails.each do |email| + expect(page).to have_content(email.email) + end + end + + it 'adds an email' do + fill_in('email_email', with: 'my@email.com') + click_button('Add') + + email = user.emails.find_by(email: 'my@email.com') + + expect(email).not_to be_nil + expect(page).to have_content('my@email.com') + expect(page).to have_content(user.email) + + user.emails.each do |email| + expect(page).to have_content(email.email) + end + end + + it 'does not add a duplicate email' do + fill_in('email_email', with: user.email) + click_button('Add') + + email = user.emails.find_by(email: user.email) + + expect(email).to be_nil + expect(page).to have_content(user.email) + + user.emails.each do |email| + expect(page).to have_content(email.email) + end + end + + it 'removes an email' do + fill_in('email_email', with: 'my@email.com') + click_button('Add') + + email = user.emails.find_by(email: 'my@email.com') + + expect(email).not_to be_nil + expect(page).to have_content('my@email.com') + expect(page).to have_content(user.email) + + user.emails.each do |email| + expect(page).to have_content(email.email) + end + + # There should be only one remove button at this time + click_link('Remove') + + # Force these to reload as they have been cached + user.emails.reload + email = user.emails.find_by(email: 'my@email.com') + + expect(email).to be_nil + expect(page).not_to have_content('my@email.com') + expect(page).to have_content(user.email) + + user.emails.each do |email| + expect(page).to have_content(email.email) + end + end +end diff --git a/spec/features/profiles/user_visits_profile_account_page_spec.rb b/spec/features/profiles/user_visits_profile_account_page_spec.rb new file mode 100644 index 00000000000..8c7233c77ad --- /dev/null +++ b/spec/features/profiles/user_visits_profile_account_page_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe 'User visits the profile account page' do + let(:user) { create(:user) } + + before do + sign_in(user) + + visit(profile_account_path) + end + + it 'shows correct menu item' do + expect(find('.sidebar-top-level-items > li.active')).to have_content('Account') + expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1) + end +end diff --git a/spec/features/profiles/user_visits_profile_authentication_log_page_spec.rb b/spec/features/profiles/user_visits_profile_authentication_log_page_spec.rb new file mode 100644 index 00000000000..ffb504cc573 --- /dev/null +++ b/spec/features/profiles/user_visits_profile_authentication_log_page_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe 'User visits the authentication log page' do + let(:user) { create(:user) } + + before do + sign_in(user) + + visit(audit_log_profile_path) + end + + it 'shows correct menu item' do + expect(find('.sidebar-top-level-items > li.active')).to have_content('Authentication log') + expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1) + end +end diff --git a/spec/features/profiles/user_visits_profile_page_spec.rb b/spec/features/profiles/user_visits_profile_page_spec.rb new file mode 100644 index 00000000000..3bf6d718bc7 --- /dev/null +++ b/spec/features/profiles/user_visits_profile_page_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe 'User visits the profile page' do + let(:user) { create(:user) } + + before do + sign_in(user) + + visit(profile_path) + end + + it 'shows correct menu item' do + expect(find('.sidebar-top-level-items > li.active')).to have_content('Profile') + expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1) + end +end diff --git a/spec/features/profiles/preferences_spec.rb b/spec/features/profiles/user_visits_profile_preferences_page_spec.rb index 091fb3a356c..fbc18d30e32 100644 --- a/spec/features/profiles/preferences_spec.rb +++ b/spec/features/profiles/user_visits_profile_preferences_page_spec.rb @@ -1,14 +1,20 @@ require 'spec_helper' -describe 'Profile > Preferences', :js do +describe 'User visits the profile preferences page' do let(:user) { create(:user) } before do sign_in(user) - visit profile_preferences_path + + visit(profile_preferences_path) + end + + it 'shows correct menu item' do + expect(find('.sidebar-top-level-items > li.active')).to have_content('Preferences') + expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1) end - describe 'User changes their syntax highlighting theme' do + describe 'User changes their syntax highlighting theme', :js do it 'creates a flash message' do choose 'user_color_scheme_id_5' @@ -27,7 +33,7 @@ describe 'Profile > Preferences', :js do end end - describe 'User changes their default dashboard' do + describe 'User changes their default dashboard', :js do it 'creates a flash message' do select 'Starred Projects', from: 'user_dashboard' click_button 'Save' diff --git a/spec/features/profiles/user_visits_profile_ssh_keys_page_spec.rb b/spec/features/profiles/user_visits_profile_ssh_keys_page_spec.rb new file mode 100644 index 00000000000..0b7a63b54b4 --- /dev/null +++ b/spec/features/profiles/user_visits_profile_ssh_keys_page_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe 'User visits the profile SSH keys page' do + let(:user) { create(:user) } + + before do + sign_in(user) + + visit(profile_keys_path) + end + + it 'shows correct menu item' do + expect(find('.sidebar-top-level-items > li.active')).to have_content('SSH Keys') + expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1) + end +end |