gitlab-org--gitlab-foss/spec/features/dashboard/active_tab_spec.rb

47 lines
1.1 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Dashboard Active Tab', :js do
before do
sign_in(create(:user))
end
shared_examples 'page has active tab' do |title|
it "#{title} tab" do
2018-07-25 11:36:08 -04:00
subject
2017-08-17 04:51:19 -04:00
expect(page).to have_selector('.navbar-sub-nav li.active', count: 1)
expect(find('.navbar-sub-nav li.active')).to have_content(title)
end
end
context 'on dashboard projects' do
2018-07-25 11:36:08 -04:00
it_behaves_like 'page has active tab', 'Projects' do
subject { visit dashboard_projects_path }
end
end
2017-08-18 07:07:10 -04:00
context 'on dashboard groups' do
2018-07-25 11:36:08 -04:00
it_behaves_like 'page has active tab', 'Groups' do
subject { visit dashboard_groups_path }
end
end
2017-08-18 07:07:10 -04:00
context 'on activity projects' do
2018-07-25 11:36:08 -04:00
it_behaves_like 'page has active tab', 'Activity' do
subject { visit activity_dashboard_path }
end
2018-07-25 11:36:08 -04:00
end
2018-07-25 11:36:08 -04:00
context 'on instance statistics' do
subject { visit instance_statistics_root_path }
it 'shows Instance Statistics` as active' do
subject
expect(find('.navbar-sub-nav li.active')).to have_link('Instance Statistics')
end
end
end