diff options
Diffstat (limited to 'spec/features/user_can_display_performance_bar_spec.rb')
-rw-r--r-- | spec/features/user_can_display_performance_bar_spec.rb | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/spec/features/user_can_display_performance_bar_spec.rb b/spec/features/user_can_display_performance_bar_spec.rb index 1bd7e038939..670e8dda916 100644 --- a/spec/features/user_can_display_performance_bar_spec.rb +++ b/spec/features/user_can_display_performance_bar_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe 'User can display performacne bar', :js do +describe 'User can display performance bar', :js do shared_examples 'performance bar is disabled' do it 'does not show the performance bar by default' do expect(page).not_to have_css('#peek') @@ -27,28 +27,30 @@ describe 'User can display performacne bar', :js do find('body').native.send_keys('pb') end - it 'does not show the performance bar by default' do - expect(page).not_to have_css('#peek') + it 'shows the performance bar' do + expect(page).to have_css('#peek') end end end + let(:group) { create(:group) } + context 'when user is logged-out' do before do visit root_path end - context 'when the gitlab_performance_bar feature is disabled' do + context 'when the performance_bar feature is disabled' do before do - Feature.disable('gitlab_performance_bar') + stub_application_setting(performance_bar_allowed_group_id: nil) end it_behaves_like 'performance bar is disabled' end - context 'when the gitlab_performance_bar feature is enabled' do + context 'when the performance_bar feature is enabled' do before do - Feature.enable('gitlab_performance_bar') + stub_application_setting(performance_bar_allowed_group_id: group.id) end it_behaves_like 'performance bar is disabled' @@ -57,22 +59,25 @@ describe 'User can display performacne bar', :js do context 'when user is logged-in' do before do - gitlab_sign_in(create(:user)) + user = create(:user) + + sign_in(user) + group.add_guest(user) visit root_path end - context 'when the gitlab_performance_bar feature is disabled' do + context 'when the performance_bar feature is disabled' do before do - Feature.disable('gitlab_performance_bar') + stub_application_setting(performance_bar_allowed_group_id: nil) end it_behaves_like 'performance bar is disabled' end - context 'when the gitlab_performance_bar feature is enabled' do + context 'when the performance_bar feature is enabled' do before do - Feature.enable('gitlab_performance_bar') + stub_application_setting(performance_bar_allowed_group_id: group.id) end it_behaves_like 'performance bar is enabled' |