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/lib/sidebars')
-rw-r--r--spec/lib/sidebars/admin/panel_spec.rb8
-rw-r--r--spec/lib/sidebars/concerns/has_avatar_spec.rb29
-rw-r--r--spec/lib/sidebars/explore/panel_spec.rb17
-rw-r--r--spec/lib/sidebars/groups/menus/packages_registries_menu_spec.rb39
-rw-r--r--spec/lib/sidebars/groups/menus/scope_menu_spec.rb5
-rw-r--r--spec/lib/sidebars/groups/super_sidebar_panel_spec.rb8
-rw-r--r--spec/lib/sidebars/menu_item_spec.rb9
-rw-r--r--spec/lib/sidebars/menu_spec.rb12
-rw-r--r--spec/lib/sidebars/organizations/menus/scope_menu_spec.rb4
-rw-r--r--spec/lib/sidebars/organizations/panel_spec.rb1
-rw-r--r--spec/lib/sidebars/organizations/super_sidebar_panel_spec.rb7
-rw-r--r--spec/lib/sidebars/panel_spec.rb18
-rw-r--r--spec/lib/sidebars/projects/menus/issues_menu_spec.rb1
-rw-r--r--spec/lib/sidebars/projects/menus/monitor_menu_spec.rb14
-rw-r--r--spec/lib/sidebars/projects/menus/packages_registries_menu_spec.rb25
-rw-r--r--spec/lib/sidebars/projects/menus/scope_menu_spec.rb5
-rw-r--r--spec/lib/sidebars/projects/super_sidebar_panel_spec.rb8
-rw-r--r--spec/lib/sidebars/search/panel_spec.rb7
-rw-r--r--spec/lib/sidebars/static_menu_spec.rb4
-rw-r--r--spec/lib/sidebars/user_profile/menus/overview_menu_spec.rb5
-rw-r--r--spec/lib/sidebars/user_profile/panel_spec.rb7
-rw-r--r--spec/lib/sidebars/user_settings/panel_spec.rb3
-rw-r--r--spec/lib/sidebars/your_work/menus/organizations_menu_spec.rb42
-rw-r--r--spec/lib/sidebars/your_work/panel_spec.rb3
24 files changed, 161 insertions, 120 deletions
diff --git a/spec/lib/sidebars/admin/panel_spec.rb b/spec/lib/sidebars/admin/panel_spec.rb
index 9c362f527f5..83ad867050c 100644
--- a/spec/lib/sidebars/admin/panel_spec.rb
+++ b/spec/lib/sidebars/admin/panel_spec.rb
@@ -18,14 +18,10 @@ RSpec.describe Sidebars::Admin::Panel, feature_category: :navigation do
describe '#super_sidebar_context_header' do
it 'returns a hash with the correct title and icon' do
- expected_header = {
- title: panel.aria_label,
- icon: 'admin'
- }
-
- expect(panel.super_sidebar_context_header).to eq(expected_header)
+ expect(panel.super_sidebar_context_header).to eq(_('Admin Area'))
end
end
it_behaves_like 'a panel with uniquely identifiable menu items'
+ it_behaves_like 'a panel instantiable by the anonymous user'
end
diff --git a/spec/lib/sidebars/concerns/has_avatar_spec.rb b/spec/lib/sidebars/concerns/has_avatar_spec.rb
new file mode 100644
index 00000000000..bc9038c216e
--- /dev/null
+++ b/spec/lib/sidebars/concerns/has_avatar_spec.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+require 'fast_spec_helper'
+
+RSpec.describe Sidebars::Concerns::HasAvatar, feature_category: :navigation do
+ subject do
+ Class.new do
+ include Sidebars::Concerns::HasAvatar
+ end.new
+ end
+
+ describe '#avatar' do
+ it 'returns nil' do
+ expect(subject.avatar).to be_nil
+ end
+ end
+
+ describe '#avatar_shape' do
+ it 'returns rect' do
+ expect(subject.avatar_shape).to eq('rect')
+ end
+ end
+
+ describe '#entity_id' do
+ it 'returns nil' do
+ expect(subject.entity_id).to be_nil
+ end
+ end
+end
diff --git a/spec/lib/sidebars/explore/panel_spec.rb b/spec/lib/sidebars/explore/panel_spec.rb
new file mode 100644
index 00000000000..b3030dfe2e4
--- /dev/null
+++ b/spec/lib/sidebars/explore/panel_spec.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Sidebars::Explore::Panel, feature_category: :navigation do
+ let(:user) { build_stubbed(:user) }
+
+ let(:context) { Sidebars::Context.new(current_user: user, container: nil) }
+
+ subject { described_class.new(context) }
+
+ it_behaves_like 'a panel with uniquely identifiable menu items'
+
+ it 'implements #super_sidebar_context_header' do
+ expect(subject.super_sidebar_context_header).to eq(_('Explore'))
+ end
+end
diff --git a/spec/lib/sidebars/groups/menus/packages_registries_menu_spec.rb b/spec/lib/sidebars/groups/menus/packages_registries_menu_spec.rb
index 382ee07e458..713e22e2e76 100644
--- a/spec/lib/sidebars/groups/menus/packages_registries_menu_spec.rb
+++ b/spec/lib/sidebars/groups/menus/packages_registries_menu_spec.rb
@@ -24,29 +24,16 @@ RSpec.describe Sidebars::Groups::Menus::PackagesRegistriesMenu, feature_category
expect(menu.render?).to eq true
end
end
-
- context 'when menu does not have any menu item to show' do
- it 'returns false' do
- stub_feature_flags(harbor_registry_integration: false)
- stub_container_registry_config(enabled: false)
- stub_config(packages: { enabled: false })
- stub_config(dependency_proxy: { enabled: false })
-
- expect(menu.render?).to eq false
- end
- end
end
describe '#link' do
let(:registry_enabled) { true }
let(:packages_enabled) { true }
- let(:harbor_registry_integration) { true }
before do
stub_container_registry_config(enabled: registry_enabled)
stub_config(packages: { enabled: packages_enabled })
stub_config(dependency_proxy: { enabled: true })
- stub_feature_flags(harbor_registry_integration: harbor_registry_integration)
end
subject { menu.link }
@@ -70,14 +57,6 @@ RSpec.describe Sidebars::Groups::Menus::PackagesRegistriesMenu, feature_category
it 'menu link points to Harbor Registry page' do
expect(subject).to eq find_menu(menu, :harbor_registry).link
end
-
- context 'when Harbor Registry is not visible' do
- let(:harbor_registry_integration) { false }
-
- it 'menu link points to Dependency Proxy page' do
- expect(subject).to eq find_menu(menu, :dependency_proxy).link
- end
- end
end
end
end
@@ -194,29 +173,13 @@ RSpec.describe Sidebars::Groups::Menus::PackagesRegistriesMenu, feature_category
describe 'Harbor Registry' do
let(:item_id) { :harbor_registry }
- before do
- stub_feature_flags(harbor_registry_integration: harbor_registry_enabled)
- end
-
- context 'when config harbor registry setting is disabled' do
- let(:harbor_registry_enabled) { false }
-
- it_behaves_like 'the menu entry is not available'
- end
-
- context 'when config harbor registry setting is enabled' do
- let(:harbor_registry_enabled) { true }
-
- it_behaves_like 'the menu entry is available'
- end
+ it_behaves_like 'the menu entry is available'
context 'when config harbor registry setting is not activated' do
before do
harbor_integration.update!(active: false)
end
- let(:harbor_registry_enabled) { true }
-
it_behaves_like 'the menu entry is not available'
end
end
diff --git a/spec/lib/sidebars/groups/menus/scope_menu_spec.rb b/spec/lib/sidebars/groups/menus/scope_menu_spec.rb
index d3aceaf422b..2cce2d28e68 100644
--- a/spec/lib/sidebars/groups/menus/scope_menu_spec.rb
+++ b/spec/lib/sidebars/groups/menus/scope_menu_spec.rb
@@ -17,9 +17,10 @@ RSpec.describe Sidebars::Groups::Menus::ScopeMenu, feature_category: :navigation
it_behaves_like 'serializable as super_sidebar_menu_args' do
let(:extra_attrs) do
{
- sprite_icon: 'group',
super_sidebar_parent: ::Sidebars::StaticMenu,
- title: _('Group overview'),
+ title: group.name,
+ avatar: group.avatar_url,
+ entity_id: group.id,
item_id: :group_overview
}
end
diff --git a/spec/lib/sidebars/groups/super_sidebar_panel_spec.rb b/spec/lib/sidebars/groups/super_sidebar_panel_spec.rb
index 52c3a35a9d7..c939dd870c4 100644
--- a/spec/lib/sidebars/groups/super_sidebar_panel_spec.rb
+++ b/spec/lib/sidebars/groups/super_sidebar_panel_spec.rb
@@ -20,12 +20,7 @@ RSpec.describe Sidebars::Groups::SuperSidebarPanel, feature_category: :navigatio
subject { described_class.new(context) }
it 'implements #super_sidebar_context_header' do
- expect(subject.super_sidebar_context_header).to eq(
- {
- title: group.name,
- avatar: group.avatar_url,
- id: group.id
- })
+ expect(subject.super_sidebar_context_header).to eq(_('Group'))
end
describe '#renderable_menus' do
@@ -53,4 +48,5 @@ RSpec.describe Sidebars::Groups::SuperSidebarPanel, feature_category: :navigatio
it_behaves_like 'a panel with uniquely identifiable menu items'
it_behaves_like 'a panel with all menu_items categorized'
+ it_behaves_like 'a panel instantiable by the anonymous user'
end
diff --git a/spec/lib/sidebars/menu_item_spec.rb b/spec/lib/sidebars/menu_item_spec.rb
index 3ff5b80e5d9..7f67b5a2e8d 100644
--- a/spec/lib/sidebars/menu_item_spec.rb
+++ b/spec/lib/sidebars/menu_item_spec.rb
@@ -5,7 +5,8 @@ require 'fast_spec_helper'
RSpec.describe Sidebars::MenuItem, feature_category: :navigation do
let(:title) { 'foo' }
let(:html_options) { {} }
- let(:menu_item) { described_class.new(title: title, active_routes: {}, link: '', container_html_options: html_options) }
+ let(:extra) { {} }
+ let(:menu_item) { described_class.new(title: title, active_routes: {}, link: '', container_html_options: html_options, **extra) }
it 'includes by default aria-label attribute set to the title' do
expect(menu_item.container_html_options).to eq({ aria: { label: title } })
@@ -21,11 +22,17 @@ RSpec.describe Sidebars::MenuItem, feature_category: :navigation do
describe "#serialize_for_super_sidebar" do
let(:html_options) { { class: 'custom-class' } }
+ let(:extra) { { avatar: '/avatar.png', entity_id: 123 } }
subject { menu_item.serialize_for_super_sidebar }
it 'includes custom CSS classes' do
expect(subject[:link_classes]).to be('custom-class')
end
+
+ it 'includes avatar data' do
+ expect(subject[:avatar]).to be('/avatar.png')
+ expect(subject[:entity_id]).to be(123)
+ end
end
end
diff --git a/spec/lib/sidebars/menu_spec.rb b/spec/lib/sidebars/menu_spec.rb
index 00202ac7d2b..e59a8cd2163 100644
--- a/spec/lib/sidebars/menu_spec.rb
+++ b/spec/lib/sidebars/menu_spec.rb
@@ -33,6 +33,8 @@ RSpec.describe Sidebars::Menu, feature_category: :navigation do
item_id: 'id1',
title: 'Is active',
link: 'foo2',
+ avatar: '/avatar.png',
+ entity_id: 123,
active_routes: { controller: 'fooc' }
))
menu.add_item(Sidebars::MenuItem.new(
@@ -51,6 +53,9 @@ RSpec.describe Sidebars::Menu, feature_category: :navigation do
{
title: "Title",
icon: nil,
+ avatar: nil,
+ avatar_shape: 'rect',
+ entity_id: nil,
link: "foo2",
is_active: true,
pill_count: nil,
@@ -60,6 +65,8 @@ RSpec.describe Sidebars::Menu, feature_category: :navigation do
id: 'id1',
title: "Is active",
icon: nil,
+ avatar: '/avatar.png',
+ entity_id: 123,
link: "foo2",
is_active: true,
pill_count: nil,
@@ -69,6 +76,8 @@ RSpec.describe Sidebars::Menu, feature_category: :navigation do
id: 'id2',
title: "Not active",
icon: nil,
+ avatar: nil,
+ entity_id: nil,
link: "foo3",
is_active: false,
pill_count: 10,
@@ -85,6 +94,9 @@ RSpec.describe Sidebars::Menu, feature_category: :navigation do
{
title: "Title",
icon: nil,
+ avatar: nil,
+ avatar_shape: 'rect',
+ entity_id: nil,
link: nil,
is_active: false,
pill_count: 'foo',
diff --git a/spec/lib/sidebars/organizations/menus/scope_menu_spec.rb b/spec/lib/sidebars/organizations/menus/scope_menu_spec.rb
index bc03787e95f..999889a72ee 100644
--- a/spec/lib/sidebars/organizations/menus/scope_menu_spec.rb
+++ b/spec/lib/sidebars/organizations/menus/scope_menu_spec.rb
@@ -11,8 +11,8 @@ RSpec.describe Sidebars::Organizations::Menus::ScopeMenu, feature_category: :nav
let(:menu) { described_class.new(context) }
let(:extra_attrs) do
{
- title: s_('Organization|Organization overview'),
- sprite_icon: 'organization',
+ avatar: nil,
+ entity_id: organization.id,
super_sidebar_parent: ::Sidebars::StaticMenu,
item_id: :organization_overview
}
diff --git a/spec/lib/sidebars/organizations/panel_spec.rb b/spec/lib/sidebars/organizations/panel_spec.rb
index 1f0b8d72aef..edaa676aa41 100644
--- a/spec/lib/sidebars/organizations/panel_spec.rb
+++ b/spec/lib/sidebars/organizations/panel_spec.rb
@@ -14,4 +14,5 @@ RSpec.describe Sidebars::Organizations::Panel, feature_category: :navigation do
end
it_behaves_like 'a panel with uniquely identifiable menu items'
+ it_behaves_like 'a panel instantiable by the anonymous user'
end
diff --git a/spec/lib/sidebars/organizations/super_sidebar_panel_spec.rb b/spec/lib/sidebars/organizations/super_sidebar_panel_spec.rb
index 99b33a5edf8..b8ceda615c4 100644
--- a/spec/lib/sidebars/organizations/super_sidebar_panel_spec.rb
+++ b/spec/lib/sidebars/organizations/super_sidebar_panel_spec.rb
@@ -15,11 +15,7 @@ RSpec.describe Sidebars::Organizations::SuperSidebarPanel, feature_category: :na
subject { described_class.new(context) }
it 'implements #super_sidebar_context_header' do
- expect(subject.super_sidebar_context_header).to eq(
- {
- title: organization.name,
- id: organization.id
- })
+ expect(subject.super_sidebar_context_header).to eq(s_('Organization|Organization'))
end
describe '#renderable_menus' do
@@ -36,4 +32,5 @@ RSpec.describe Sidebars::Organizations::SuperSidebarPanel, feature_category: :na
end
it_behaves_like 'a panel with uniquely identifiable menu items'
+ it_behaves_like 'a panel instantiable by the anonymous user'
end
diff --git a/spec/lib/sidebars/panel_spec.rb b/spec/lib/sidebars/panel_spec.rb
index 857cb1139b5..e4b3b973484 100644
--- a/spec/lib/sidebars/panel_spec.rb
+++ b/spec/lib/sidebars/panel_spec.rb
@@ -46,17 +46,25 @@ RSpec.describe Sidebars::Panel, feature_category: :navigation do
end
end
- describe '#has_renderable_menus?' do
- it 'returns false when no renderable menus' do
- expect(panel.has_renderable_menus?).to be false
+ describe '#render?' do
+ it 'returns false with no menus' do
+ expect(panel.render?).to be false
end
- it 'returns true when no renderable menus' do
+ it 'returns false with no renderable menus' do
+ allow(menu1).to receive(:render?).and_return(false)
+
+ panel.add_menu(menu1)
+
+ expect(panel.render?).to be false
+ end
+
+ it 'returns true with renderable menus' do
allow(menu1).to receive(:render?).and_return(true)
panel.add_menu(menu1)
- expect(panel.has_renderable_menus?).to be true
+ expect(panel.render?).to be true
end
end
diff --git a/spec/lib/sidebars/projects/menus/issues_menu_spec.rb b/spec/lib/sidebars/projects/menus/issues_menu_spec.rb
index 53d92d013a9..91913e5b733 100644
--- a/spec/lib/sidebars/projects/menus/issues_menu_spec.rb
+++ b/spec/lib/sidebars/projects/menus/issues_menu_spec.rb
@@ -14,6 +14,7 @@ RSpec.describe Sidebars::Projects::Menus::IssuesMenu, feature_category: :navigat
let(:extra_attrs) do
{
item_id: :project_issue_list,
+ active_routes: { path: %w[projects/issues#index projects/issues#show projects/issues#new] },
pill_count: menu.pill_count,
has_pill: menu.has_pill?,
super_sidebar_parent: Sidebars::Projects::SuperSidebarMenus::PlanMenu
diff --git a/spec/lib/sidebars/projects/menus/monitor_menu_spec.rb b/spec/lib/sidebars/projects/menus/monitor_menu_spec.rb
index c0787aa9db5..f1df56823b1 100644
--- a/spec/lib/sidebars/projects/menus/monitor_menu_spec.rb
+++ b/spec/lib/sidebars/projects/menus/monitor_menu_spec.rb
@@ -88,19 +88,5 @@ RSpec.describe Sidebars::Projects::Menus::MonitorMenu, feature_category: :naviga
it_behaves_like 'access rights checks'
end
-
- describe 'Tracing' do
- let(:item_id) { :tracing }
-
- specify { is_expected.not_to be_nil }
-
- describe 'when feature is disabled' do
- before do
- stub_feature_flags(observability_tracing: false)
- end
-
- specify { is_expected.to be_nil }
- end
- end
end
end
diff --git a/spec/lib/sidebars/projects/menus/packages_registries_menu_spec.rb b/spec/lib/sidebars/projects/menus/packages_registries_menu_spec.rb
index b917208bac1..0cf95391a26 100644
--- a/spec/lib/sidebars/projects/menus/packages_registries_menu_spec.rb
+++ b/spec/lib/sidebars/projects/menus/packages_registries_menu_spec.rb
@@ -39,7 +39,7 @@ RSpec.describe Sidebars::Projects::Menus::PackagesRegistriesMenu, feature_catego
before do
stub_container_registry_config(enabled: registry_enabled)
stub_config(packages: { enabled: packages_enabled })
- stub_feature_flags(harbor_registry_integration: false, ml_experiment_tracking: false)
+ stub_feature_flags(ml_experiment_tracking: false)
end
context 'when Packages Registry is visible' do
@@ -58,8 +58,8 @@ RSpec.describe Sidebars::Projects::Menus::PackagesRegistriesMenu, feature_catego
context 'when Container Registry is not visible' do
let(:registry_enabled) { false }
- it 'does not display menu link' do
- expect(subject.render?).to eq false
+ it 'displays menu link' do
+ expect(subject.render?).to eq true
end
end
end
@@ -155,26 +155,13 @@ RSpec.describe Sidebars::Projects::Menus::PackagesRegistriesMenu, feature_catego
describe 'Harbor Registry' do
let(:item_id) { :harbor_registry }
- context 'when config harbor registry setting is disabled' do
- it 'does not add the menu item to the list' do
- stub_feature_flags(harbor_registry_integration: false)
-
- is_expected.to be_nil
- end
- end
-
- context 'when config harbor registry setting is enabled' do
- it 'the menu item is added to list of menu items' do
- stub_feature_flags(harbor_registry_integration: true)
-
- is_expected.not_to be_nil
- expect(subject.active_routes[:controller]).to eq('projects/harbor/repositories')
- end
+ it 'the menu item is added to list of menu items' do
+ is_expected.not_to be_nil
+ expect(subject.active_routes[:controller]).to eq('projects/harbor/repositories')
end
context 'when config harbor registry setting is not activated' do
it 'does not add the menu item to the list' do
- stub_feature_flags(harbor_registry_integration: true)
project.harbor_integration.update!(active: false)
is_expected.to be_nil
diff --git a/spec/lib/sidebars/projects/menus/scope_menu_spec.rb b/spec/lib/sidebars/projects/menus/scope_menu_spec.rb
index 45464278880..1c2d159950a 100644
--- a/spec/lib/sidebars/projects/menus/scope_menu_spec.rb
+++ b/spec/lib/sidebars/projects/menus/scope_menu_spec.rb
@@ -11,8 +11,9 @@ RSpec.describe Sidebars::Projects::Menus::ScopeMenu, feature_category: :navigati
let(:menu) { described_class.new(context) }
let(:extra_attrs) do
{
- title: _('Project overview'),
- sprite_icon: 'project',
+ title: project.name,
+ avatar: project.avatar_url,
+ entity_id: project.id,
super_sidebar_parent: ::Sidebars::StaticMenu,
item_id: :project_overview
}
diff --git a/spec/lib/sidebars/projects/super_sidebar_panel_spec.rb b/spec/lib/sidebars/projects/super_sidebar_panel_spec.rb
index 3fc6cd5083f..dc264c1c14f 100644
--- a/spec/lib/sidebars/projects/super_sidebar_panel_spec.rb
+++ b/spec/lib/sidebars/projects/super_sidebar_panel_spec.rb
@@ -31,12 +31,7 @@ RSpec.describe Sidebars::Projects::SuperSidebarPanel, feature_category: :navigat
end
it 'implements #super_sidebar_context_header' do
- expect(subject.super_sidebar_context_header).to eq(
- {
- title: project.name,
- avatar: project.avatar_url,
- id: project.id
- })
+ expect(subject.super_sidebar_context_header).to eq(_('Project'))
end
describe '#renderable_menus' do
@@ -64,4 +59,5 @@ RSpec.describe Sidebars::Projects::SuperSidebarPanel, feature_category: :navigat
it_behaves_like 'a panel with uniquely identifiable menu items'
it_behaves_like 'a panel with all menu_items categorized'
+ it_behaves_like 'a panel instantiable by the anonymous user'
end
diff --git a/spec/lib/sidebars/search/panel_spec.rb b/spec/lib/sidebars/search/panel_spec.rb
index 39c0f112793..fa1b4266a2f 100644
--- a/spec/lib/sidebars/search/panel_spec.rb
+++ b/spec/lib/sidebars/search/panel_spec.rb
@@ -12,6 +12,7 @@ RSpec.describe Sidebars::Search::Panel, feature_category: :navigation do
subject { described_class.new(context) }
it_behaves_like 'a panel with uniquely identifiable menu items'
+ it_behaves_like 'a panel instantiable by the anonymous user'
describe '#aria_label' do
it 'returns the correct aria label' do
@@ -21,11 +22,7 @@ RSpec.describe Sidebars::Search::Panel, feature_category: :navigation do
describe '#super_sidebar_context_header' do
it 'returns a hash with the correct title and icon' do
- expected_header = {
- title: 'Search results',
- icon: 'search-results'
- }
- expect(panel.super_sidebar_context_header).to eq(expected_header)
+ expect(panel.super_sidebar_context_header).to eq(_('Search results'))
end
end
end
diff --git a/spec/lib/sidebars/static_menu_spec.rb b/spec/lib/sidebars/static_menu_spec.rb
index 3d9feee0494..fda953c0791 100644
--- a/spec/lib/sidebars/static_menu_spec.rb
+++ b/spec/lib/sidebars/static_menu_spec.rb
@@ -23,6 +23,8 @@ RSpec.describe Sidebars::StaticMenu, feature_category: :navigation do
id: 'id1',
title: "Is active",
icon: nil,
+ avatar: nil,
+ entity_id: nil,
link: "foo2",
is_active: true,
pill_count: nil,
@@ -32,6 +34,8 @@ RSpec.describe Sidebars::StaticMenu, feature_category: :navigation do
id: 'id2',
title: "Not active",
icon: nil,
+ avatar: nil,
+ entity_id: nil,
link: "foo3",
is_active: false,
pill_count: nil,
diff --git a/spec/lib/sidebars/user_profile/menus/overview_menu_spec.rb b/spec/lib/sidebars/user_profile/menus/overview_menu_spec.rb
index 7cf86676892..ef12ce023b4 100644
--- a/spec/lib/sidebars/user_profile/menus/overview_menu_spec.rb
+++ b/spec/lib/sidebars/user_profile/menus/overview_menu_spec.rb
@@ -4,8 +4,9 @@ require 'spec_helper'
RSpec.describe Sidebars::UserProfile::Menus::OverviewMenu, feature_category: :navigation do
it_behaves_like 'User profile menu',
- title: s_('UserProfile|Overview'),
- icon: 'overview',
+ icon: nil,
+ expect_avatar: true,
+ avatar_shape: 'circle',
active_route: 'users#show' do
let(:link) { "/#{user.username}" }
end
diff --git a/spec/lib/sidebars/user_profile/panel_spec.rb b/spec/lib/sidebars/user_profile/panel_spec.rb
index a2bf490bc58..97fe13397a9 100644
--- a/spec/lib/sidebars/user_profile/panel_spec.rb
+++ b/spec/lib/sidebars/user_profile/panel_spec.rb
@@ -11,16 +11,13 @@ RSpec.describe Sidebars::UserProfile::Panel, feature_category: :navigation do
subject { described_class.new(context) }
it_behaves_like 'a panel with uniquely identifiable menu items'
+ it_behaves_like 'a panel instantiable by the anonymous user'
it 'implements #aria_label' do
expect(subject.aria_label).to eq(s_('UserProfile|User profile navigation'))
end
it 'implements #super_sidebar_context_header' do
- expect(subject.super_sidebar_context_header).to eq({
- title: user.name,
- avatar: user.avatar_url,
- avatar_shape: 'circle'
- })
+ expect(subject.super_sidebar_context_header).to eq(_('Profile'))
end
end
diff --git a/spec/lib/sidebars/user_settings/panel_spec.rb b/spec/lib/sidebars/user_settings/panel_spec.rb
index d574652188d..e65717d75d6 100644
--- a/spec/lib/sidebars/user_settings/panel_spec.rb
+++ b/spec/lib/sidebars/user_settings/panel_spec.rb
@@ -10,8 +10,9 @@ RSpec.describe Sidebars::UserSettings::Panel, feature_category: :navigation do
subject { described_class.new(context) }
it_behaves_like 'a panel with uniquely identifiable menu items'
+ it_behaves_like 'a panel instantiable by the anonymous user'
it 'implements #super_sidebar_context_header' do
- expect(subject.super_sidebar_context_header).to eq({ title: _('User settings'), avatar: user.avatar_url })
+ expect(subject.super_sidebar_context_header).to eq(_('User settings'))
end
end
diff --git a/spec/lib/sidebars/your_work/menus/organizations_menu_spec.rb b/spec/lib/sidebars/your_work/menus/organizations_menu_spec.rb
new file mode 100644
index 00000000000..304725ce8ca
--- /dev/null
+++ b/spec/lib/sidebars/your_work/menus/organizations_menu_spec.rb
@@ -0,0 +1,42 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Sidebars::YourWork::Menus::OrganizationsMenu, feature_category: :navigation do
+ let(:user) { build_stubbed(:user) }
+ let(:context) { Sidebars::Context.new(current_user: user, container: nil) }
+
+ subject { described_class.new(context) }
+
+ describe '#render?' do
+ context 'when `ui_for_organizations` feature flag is enabled' do
+ context 'when `current_user` is available' do
+ before do
+ stub_feature_flags(ui_for_organizations: [user])
+ end
+
+ it 'returns true' do
+ expect(subject.render?).to eq true
+ end
+ end
+
+ context 'when `current_user` is not available' do
+ let(:user) { nil }
+
+ it 'returns false' do
+ expect(subject.render?).to eq false
+ end
+ end
+ end
+
+ context 'when `ui_for_organizations` feature flag is disabled' do
+ before do
+ stub_feature_flags(ui_for_organizations: false)
+ end
+
+ it 'returns false' do
+ expect(subject.render?).to eq false
+ end
+ end
+ end
+end
diff --git a/spec/lib/sidebars/your_work/panel_spec.rb b/spec/lib/sidebars/your_work/panel_spec.rb
index 65c2786a16d..8037f7eb7c1 100644
--- a/spec/lib/sidebars/your_work/panel_spec.rb
+++ b/spec/lib/sidebars/your_work/panel_spec.rb
@@ -10,8 +10,9 @@ RSpec.describe Sidebars::YourWork::Panel, feature_category: :navigation do
subject { described_class.new(context) }
it_behaves_like 'a panel with uniquely identifiable menu items'
+ it_behaves_like 'a panel instantiable by the anonymous user'
it 'implements #super_sidebar_context_header' do
- expect(subject.super_sidebar_context_header).to eq({ title: 'Your work', icon: 'work' })
+ expect(subject.super_sidebar_context_header).to eq(_('Your work'))
end
end