debian-mirror-gitlab/spec/lib/sidebars/projects/super_sidebar_panel_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

67 lines
2.2 KiB
Ruby
Raw Normal View History

2023-05-27 22:25:52 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Sidebars::Projects::SuperSidebarPanel, feature_category: :navigation do
let_it_be(:project) { create(:project, :repository) }
let(:user) { project.first_owner }
let(:context) do
2023-07-09 08:55:56 +05:30
Sidebars::Projects::Context.new(
current_user: user,
container: project,
current_ref: project.repository.root_ref,
is_super_sidebar: true,
# Turn features on that impact the list of items rendered
can_view_pipeline_editor: true,
learn_gitlab_enabled: true,
show_discover_project_security: true,
# Turn features off that do not add/remove items
show_cluster_hint: false,
show_promotions: false
)
2023-05-27 22:25:52 +05:30
end
subject { described_class.new(context) }
2023-07-09 08:55:56 +05:30
before do
# Enable integrations with menu items
allow(project).to receive(:external_wiki).and_return(build(:external_wiki_integration, project: project))
allow(project).to receive(:external_issue_tracker).and_return(build(:bugzilla_integration, project: project))
end
2023-05-27 22:25:52 +05:30
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
})
end
describe '#renderable_menus' do
let(:category_menu) do
[
Sidebars::StaticMenu,
2023-06-20 00:43:36 +05:30
Sidebars::Projects::SuperSidebarMenus::ManageMenu,
2023-05-27 22:25:52 +05:30
Sidebars::Projects::SuperSidebarMenus::PlanMenu,
2023-06-20 00:43:36 +05:30
Sidebars::Projects::SuperSidebarMenus::CodeMenu,
Sidebars::Projects::SuperSidebarMenus::BuildMenu,
Sidebars::Projects::SuperSidebarMenus::SecureMenu,
2023-05-27 22:25:52 +05:30
Sidebars::Projects::SuperSidebarMenus::OperationsMenu,
2023-06-20 00:43:36 +05:30
Sidebars::Projects::SuperSidebarMenus::MonitorMenu,
Sidebars::Projects::SuperSidebarMenus::AnalyzeMenu,
2023-05-27 22:25:52 +05:30
Sidebars::UncategorizedMenu,
Sidebars::Projects::Menus::SettingsMenu
]
end
it "is exposed as a renderable menu" do
expect(subject.instance_variable_get(:@menus).map(&:class)).to eq(category_menu)
end
end
2023-07-09 08:55:56 +05:30
it_behaves_like 'a panel with uniquely identifiable menu items'
it_behaves_like 'a panel with all menu_items categorized'
2023-05-27 22:25:52 +05:30
end