diff options
author | Rémy Coutable <remy@rymai.me> | 2018-01-16 21:13:31 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-01-17 15:56:05 +0300 |
commit | 28d39447c39981565cd0cdfad63dab5e5126e524 (patch) | |
tree | 8663a412652f1cf9bbd3c1e407c7fa4cbd3cd499 /spec/features/user_can_display_performance_bar_spec.rb | |
parent | 612d2266253a37a4f56b053f4dc17dd4f351f0d6 (diff) |
In development, allow the toggling of the performance bar
The performance bar is still displayed by default in development.
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/features/user_can_display_performance_bar_spec.rb')
-rw-r--r-- | spec/features/user_can_display_performance_bar_spec.rb | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/spec/features/user_can_display_performance_bar_spec.rb b/spec/features/user_can_display_performance_bar_spec.rb index 670e8dda916..975c157bcf5 100644 --- a/spec/features/user_can_display_performance_bar_spec.rb +++ b/spec/features/user_can_display_performance_bar_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe 'User can display performance bar', :js do - shared_examples 'performance bar is disabled' do + shared_examples 'performance bar cannot be displayed' do it 'does not show the performance bar by default' do expect(page).not_to have_css('#peek') end @@ -17,7 +17,7 @@ describe 'User can display performance bar', :js do end end - shared_examples 'performance bar is enabled' do + shared_examples 'performance bar can be displayed' do it 'does not show the performance bar by default' do expect(page).not_to have_css('#peek') end @@ -33,6 +33,18 @@ describe 'User can display performance bar', :js do end end + shared_examples 'performance bar is enabled by default in development' do + before do + allow(Rails.env).to receive(:development?).and_return(true) + end + + it 'shows the performance bar by default' do + refresh # Because we're stubbing Rails.env after the 1st visit to root_path + + expect(page).to have_css('#peek') + end + end + let(:group) { create(:group) } context 'when user is logged-out' do @@ -45,7 +57,7 @@ describe 'User can display performance bar', :js do stub_application_setting(performance_bar_allowed_group_id: nil) end - it_behaves_like 'performance bar is disabled' + it_behaves_like 'performance bar cannot be displayed' end context 'when the performance_bar feature is enabled' do @@ -53,7 +65,7 @@ describe 'User can display performance bar', :js do stub_application_setting(performance_bar_allowed_group_id: group.id) end - it_behaves_like 'performance bar is disabled' + it_behaves_like 'performance bar cannot be displayed' end end @@ -72,7 +84,8 @@ describe 'User can display performance bar', :js do stub_application_setting(performance_bar_allowed_group_id: nil) end - it_behaves_like 'performance bar is disabled' + it_behaves_like 'performance bar cannot be displayed' + it_behaves_like 'performance bar is enabled by default in development' end context 'when the performance_bar feature is enabled' do @@ -80,7 +93,8 @@ describe 'User can display performance bar', :js do stub_application_setting(performance_bar_allowed_group_id: group.id) end - it_behaves_like 'performance bar is enabled' + it_behaves_like 'performance bar is enabled by default in development' + it_behaves_like 'performance bar can be displayed' end end end |