Improve 'spec/features/profiles/*' specs

parent 20295b3d
......@@ -10,7 +10,6 @@ describe 'User visits the profile account page' do
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)
expect(page).to have_active_navigation('Account')
end
end
require 'spec_helper'
describe 'User visits the authentication log page' do
describe 'User visits the authentication log' do
let(:user) { create(:user) }
before do
......@@ -10,7 +10,6 @@ describe 'User visits the authentication log page' do
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)
expect(page).to have_active_navigation('Authentication log')
end
end
......@@ -10,8 +10,7 @@ describe 'User visits the profile preferences page' do
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)
expect(page).to have_active_navigation('Preferences')
end
describe 'User changes their syntax highlighting theme', :js do
......
require 'spec_helper'
describe 'User visits the profile page' do
describe 'User visits their profile' do
let(:user) { create(:user) }
before do
......@@ -10,7 +10,6 @@ describe 'User visits the profile page' do
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)
expect(page).to have_active_navigation('Profile')
end
end
......@@ -10,7 +10,6 @@ describe 'User visits the profile SSH keys page' do
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)
expect(page).to have_active_navigation('SSH Keys')
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