2017-01-03 13:45:42 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-10-03 04:35:01 -04:00
|
|
|
RSpec.describe 'Dashboard Active Tab', :js do
|
2017-01-03 13:45:42 -05:00
|
|
|
before do
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(create(:user))
|
2017-01-03 13:45:42 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
shared_examples 'page has active tab' do |title|
|
|
|
|
it "#{title} tab" do
|
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)
|
2017-01-03 13:45:42 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on dashboard projects' do
|
|
|
|
before do
|
|
|
|
visit dashboard_projects_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'page has active tab', 'Projects'
|
|
|
|
end
|
|
|
|
|
2017-08-18 07:07:10 -04:00
|
|
|
context 'on dashboard groups' do
|
2017-01-03 13:45:42 -05:00
|
|
|
before do
|
2017-08-18 07:07:10 -04:00
|
|
|
visit dashboard_groups_path
|
2017-01-03 13:45:42 -05:00
|
|
|
end
|
|
|
|
|
2017-08-18 07:07:10 -04:00
|
|
|
it_behaves_like 'page has active tab', 'Groups'
|
2017-01-03 13:45:42 -05:00
|
|
|
end
|
|
|
|
|
2017-08-18 07:07:10 -04:00
|
|
|
context 'on activity projects' do
|
2017-01-03 13:45:42 -05:00
|
|
|
before do
|
2017-08-18 07:07:10 -04:00
|
|
|
visit activity_dashboard_path
|
2017-01-03 13:45:42 -05:00
|
|
|
end
|
|
|
|
|
2017-08-18 07:07:10 -04:00
|
|
|
it_behaves_like 'page has active tab', 'Activity'
|
2017-01-03 13:45:42 -05:00
|
|
|
end
|
|
|
|
end
|