diff options
Diffstat (limited to 'spec/lib/sidebars')
-rw-r--r-- | spec/lib/sidebars/menu_spec.rb | 23 | ||||
-rw-r--r-- | spec/lib/sidebars/projects/menus/learn_gitlab_menu_spec.rb | 11 | ||||
-rw-r--r-- | spec/lib/sidebars/projects/menus/monitor_menu_spec.rb | 19 | ||||
-rw-r--r-- | spec/lib/sidebars/projects/menus/settings_menu_spec.rb | 26 |
4 files changed, 53 insertions, 26 deletions
diff --git a/spec/lib/sidebars/menu_spec.rb b/spec/lib/sidebars/menu_spec.rb index 1db80351e45..eb6a68f1afd 100644 --- a/spec/lib/sidebars/menu_spec.rb +++ b/spec/lib/sidebars/menu_spec.rb @@ -198,4 +198,27 @@ RSpec.describe Sidebars::Menu do end end end + + describe '#link' do + let(:foo_path) { '/foo_path'} + + let(:foo_menu) do + ::Sidebars::MenuItem.new( + title: 'foo', + link: foo_path, + active_routes: {}, + item_id: :foo + ) + end + + it 'returns first visible menu item link' do + menu.add_item(foo_menu) + + expect(menu.link).to eq foo_path + end + + it 'returns nil if there are no visible menu items' do + expect(menu.link).to be_nil + end + end end diff --git a/spec/lib/sidebars/projects/menus/learn_gitlab_menu_spec.rb b/spec/lib/sidebars/projects/menus/learn_gitlab_menu_spec.rb index 231e5a850c2..36a76e70a48 100644 --- a/spec/lib/sidebars/projects/menus/learn_gitlab_menu_spec.rb +++ b/spec/lib/sidebars/projects/menus/learn_gitlab_menu_spec.rb @@ -4,15 +4,13 @@ require 'spec_helper' RSpec.describe Sidebars::Projects::Menus::LearnGitlabMenu do let_it_be(:project) { build(:project) } - let_it_be(:experiment_enabled) { true } - let_it_be(:tracking_category) { 'Growth::Activation::Experiment::LearnGitLabB' } + let_it_be(:learn_gitlab_enabled) { true } let(:context) do Sidebars::Projects::Context.new( current_user: nil, container: project, - learn_gitlab_experiment_enabled: experiment_enabled, - learn_gitlab_experiment_tracking_category: tracking_category + learn_gitlab_enabled: learn_gitlab_enabled ) end @@ -27,7 +25,6 @@ RSpec.describe Sidebars::Projects::Menus::LearnGitlabMenu do { class: 'home', data: { - track_property: tracking_category, track_label: 'learn_gitlab' } } @@ -46,7 +43,7 @@ RSpec.describe Sidebars::Projects::Menus::LearnGitlabMenu do end context 'when learn gitlab experiment is disabled' do - let(:experiment_enabled) { false } + let(:learn_gitlab_enabled) { false } it 'returns false' do expect(subject.render?).to eq false @@ -62,7 +59,7 @@ RSpec.describe Sidebars::Projects::Menus::LearnGitlabMenu do end context 'when learn gitlab experiment is disabled' do - let(:experiment_enabled) { false } + let(:learn_gitlab_enabled) { false } it 'returns false' do expect(subject.has_pill?).to eq false diff --git a/spec/lib/sidebars/projects/menus/monitor_menu_spec.rb b/spec/lib/sidebars/projects/menus/monitor_menu_spec.rb index 381842be5ab..77efe99aaa9 100644 --- a/spec/lib/sidebars/projects/menus/monitor_menu_spec.rb +++ b/spec/lib/sidebars/projects/menus/monitor_menu_spec.rb @@ -49,25 +49,6 @@ RSpec.describe Sidebars::Projects::Menus::MonitorMenu do end end - describe '#link' do - let(:foo_path) { '/foo_path'} - - let(:foo_menu) do - ::Sidebars::MenuItem.new( - title: 'foo', - link: foo_path, - active_routes: {}, - item_id: :foo - ) - end - - it 'returns first visible item link' do - subject.insert_element_before(subject.renderable_items, subject.renderable_items.first.item_id, foo_menu) - - expect(subject.link).to eq foo_path - end - end - context 'Menu items' do subject { described_class.new(context).renderable_items.index { |e| e.item_id == item_id } } diff --git a/spec/lib/sidebars/projects/menus/settings_menu_spec.rb b/spec/lib/sidebars/projects/menus/settings_menu_spec.rb index 9b79614db20..3079c781d73 100644 --- a/spec/lib/sidebars/projects/menus/settings_menu_spec.rb +++ b/spec/lib/sidebars/projects/menus/settings_menu_spec.rb @@ -158,5 +158,31 @@ RSpec.describe Sidebars::Projects::Menus::SettingsMenu do end end end + + describe 'Usage Quotas' do + let(:item_id) { :usage_quotas } + + describe 'with project_storage_ui feature flag enabled' do + before do + stub_feature_flags(project_storage_ui: true) + end + + specify { is_expected.not_to be_nil } + + describe 'when the user does not have access' do + let(:user) { nil } + + specify { is_expected.to be_nil } + end + end + + describe 'with project_storage_ui feature flag disabled' do + before do + stub_feature_flags(project_storage_ui: false) + end + + specify { is_expected.to be_nil } + end + end end end |