Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/nav_helper_spec.rb')
-rw-r--r--spec/helpers/nav_helper_spec.rb36
1 files changed, 30 insertions, 6 deletions
diff --git a/spec/helpers/nav_helper_spec.rb b/spec/helpers/nav_helper_spec.rb
index 4a02b184522..4b83561b265 100644
--- a/spec/helpers/nav_helper_spec.rb
+++ b/spec/helpers/nav_helper_spec.rb
@@ -169,15 +169,39 @@ RSpec.describe NavHelper, feature_category: :navigation do
end
end
- context 'when nil is provided' do
- specify { expect(helper.show_super_sidebar?(nil)).to eq false }
+ shared_examples 'anonymous show_super_sidebar is supposed to' do
+ before do
+ stub_feature_flags(super_sidebar_logged_out: feature_flag)
+ end
+
+ context 'when super_sidebar_logged_out feature flag is disabled' do
+ let(:feature_flag) { false }
+
+ specify { expect(subject).to eq false }
+ end
+
+ context 'when super_sidebar_logged_out feature flag is enabled' do
+ let(:feature_flag) { true }
+
+ specify { expect(subject).to eq true }
+ end
end
- context 'when no user is signed-in' do
- specify do
- allow(helper).to receive(:current_user).and_return(nil)
+ context 'without a user' do
+ context 'with current_user (nil) as a default' do
+ before do
+ allow(helper).to receive(:current_user).and_return(nil)
+ end
+
+ subject { helper.show_super_sidebar? }
+
+ it_behaves_like 'anonymous show_super_sidebar is supposed to'
+ end
+
+ context 'with nil provided as an argument' do
+ subject { helper.show_super_sidebar?(nil) }
- expect(helper.show_super_sidebar?).to eq false
+ it_behaves_like 'anonymous show_super_sidebar is supposed to'
end
end