Commit f0f835ad authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'improve_spec_features_profiles_specs' into 'master'

Improve 'spec/features/profiles/*' specs

Closes #37855 et #37856

See merge request gitlab-org/gitlab-ce!14317
parents 2b4b7649 2a966f1b
...@@ -10,7 +10,6 @@ describe 'User visits the profile account page' do ...@@ -10,7 +10,6 @@ describe 'User visits the profile account page' do
end end
it 'shows correct menu item' do it 'shows correct menu item' do
expect(find('.sidebar-top-level-items > li.active')).to have_content('Account') expect(page).to have_active_navigation('Account')
expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1)
end end
end end
require 'spec_helper' require 'spec_helper'
describe 'User visits the authentication log page' do describe 'User visits the authentication log' do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
...@@ -10,7 +10,6 @@ describe 'User visits the authentication log page' do ...@@ -10,7 +10,6 @@ describe 'User visits the authentication log page' do
end end
it 'shows correct menu item' do it 'shows correct menu item' do
expect(find('.sidebar-top-level-items > li.active')).to have_content('Authentication log') expect(page).to have_active_navigation('Authentication log')
expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1)
end end
end end
...@@ -10,8 +10,7 @@ describe 'User visits the profile preferences page' do ...@@ -10,8 +10,7 @@ describe 'User visits the profile preferences page' do
end end
it 'shows correct menu item' do it 'shows correct menu item' do
expect(find('.sidebar-top-level-items > li.active')).to have_content('Preferences') expect(page).to have_active_navigation('Preferences')
expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1)
end end
describe 'User changes their syntax highlighting theme', :js do describe 'User changes their syntax highlighting theme', :js do
......
require 'spec_helper' require 'spec_helper'
describe 'User visits the profile page' do describe 'User visits their profile' do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
...@@ -10,7 +10,6 @@ describe 'User visits the profile page' do ...@@ -10,7 +10,6 @@ describe 'User visits the profile page' do
end end
it 'shows correct menu item' do it 'shows correct menu item' do
expect(find('.sidebar-top-level-items > li.active')).to have_content('Profile') expect(page).to have_active_navigation('Profile')
expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1)
end end
end end
...@@ -10,7 +10,6 @@ describe 'User visits the profile SSH keys page' do ...@@ -10,7 +10,6 @@ describe 'User visits the profile SSH keys page' do
end end
it 'shows correct menu item' do it 'shows correct menu item' do
expect(find('.sidebar-top-level-items > li.active')).to have_content('SSH Keys') expect(page).to have_active_navigation('SSH Keys')
expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1)
end end
end end
RSpec::Matchers.define :have_active_navigation do |expected|
match do |page|
expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1)
expect(page.find('.sidebar-top-level-items > li.active')).to have_content(expected)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment