debian-mirror-gitlab/spec/features/admin/admin_active_tab_spec.rb

91 lines
2.1 KiB
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
require 'spec_helper'
2019-01-03 12:48:30 +05:30
RSpec.describe 'admin active tab' do
before do
sign_in(create(:admin))
end
2017-08-17 22:00:37 +05:30
shared_examples 'page has active tab' do |title|
it "activates #{title} tab" do
2019-01-03 12:48:30 +05:30
expect(page).to have_selector('.nav-sidebar .sidebar-top-level-items > li.active', count: 1)
expect(page.find('.nav-sidebar .sidebar-top-level-items > li.active')).to have_content(title)
2017-08-17 22:00:37 +05:30
end
end
shared_examples 'page has active sub tab' do |title|
it "activates #{title} sub tab" do
2019-01-03 12:48:30 +05:30
expect(page).to have_selector('.sidebar-sub-level-items > li.active', count: 2)
expect(page.all('.sidebar-sub-level-items > li.active')[1]).to have_content(title)
2017-08-17 22:00:37 +05:30
end
end
context 'on home page' do
before do
2019-01-03 12:48:30 +05:30
visit admin_root_path
2017-08-17 22:00:37 +05:30
end
it_behaves_like 'page has active tab', 'Overview'
end
context 'on projects' do
before do
2019-01-03 12:48:30 +05:30
visit admin_projects_path
2017-08-17 22:00:37 +05:30
end
it_behaves_like 'page has active tab', 'Overview'
it_behaves_like 'page has active sub tab', 'Projects'
end
context 'on groups' do
before do
2019-01-03 12:48:30 +05:30
visit admin_groups_path
2017-08-17 22:00:37 +05:30
end
it_behaves_like 'page has active tab', 'Overview'
it_behaves_like 'page has active sub tab', 'Groups'
end
context 'on users' do
before do
2019-01-03 12:48:30 +05:30
visit admin_users_path
2017-08-17 22:00:37 +05:30
end
it_behaves_like 'page has active tab', 'Overview'
it_behaves_like 'page has active sub tab', 'Users'
end
context 'on logs' do
before do
2019-01-03 12:48:30 +05:30
visit admin_logs_path
2017-08-17 22:00:37 +05:30
end
it_behaves_like 'page has active tab', 'Monitoring'
it_behaves_like 'page has active sub tab', 'Logs'
end
context 'on messages' do
before do
2019-01-03 12:48:30 +05:30
visit admin_broadcast_messages_path
2017-08-17 22:00:37 +05:30
end
it_behaves_like 'page has active tab', 'Messages'
end
context 'on hooks' do
before do
2019-01-03 12:48:30 +05:30
visit admin_hooks_path
2017-08-17 22:00:37 +05:30
end
it_behaves_like 'page has active tab', 'Hooks'
end
context 'on background jobs' do
before do
2019-01-03 12:48:30 +05:30
visit admin_background_jobs_path
2017-08-17 22:00:37 +05:30
end
it_behaves_like 'page has active tab', 'Monitoring'
it_behaves_like 'page has active sub tab', 'Background Jobs'
end
end