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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-01-31 09:12:59 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-01-31 09:12:59 +0300
commit62aae3415c1a5e53f35668a84fdafc04be5e0f27 (patch)
tree66ac676d1bf2050d245cac7061e94273b0bdba18 /spec/lib/sidebars
parent358bd7fce38ee22a301d5af76954ccd774df8891 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/sidebars')
-rw-r--r--spec/lib/sidebars/concerns/work_item_hierarchy_spec.rb36
-rw-r--r--spec/lib/sidebars/projects/menus/project_information_menu_spec.rb20
2 files changed, 56 insertions, 0 deletions
diff --git a/spec/lib/sidebars/concerns/work_item_hierarchy_spec.rb b/spec/lib/sidebars/concerns/work_item_hierarchy_spec.rb
new file mode 100644
index 00000000000..f0a5e032764
--- /dev/null
+++ b/spec/lib/sidebars/concerns/work_item_hierarchy_spec.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Sidebars::Concerns::WorkItemHierarchy do
+ shared_examples 'hierarchy menu' do
+ let(:item_id) { :hierarchy }
+
+ context 'when the feature is disabled does not render' do
+ before do
+ stub_feature_flags(work_items_hierarchy: false)
+ end
+
+ specify { is_expected.to be_nil }
+ end
+
+ context 'when the feature is enabled does render' do
+ before do
+ stub_feature_flags(work_items_hierarchy: true)
+ end
+
+ specify { is_expected.not_to be_nil }
+ end
+ end
+
+ describe 'Project hierarchy menu item' do
+ let_it_be_with_reload(:project) { create(:project, :repository) }
+
+ let(:user) { project.owner }
+ let(:context) { Sidebars::Projects::Context.new(current_user: user, container: project) }
+
+ subject { Sidebars::Projects::Menus::ProjectInformationMenu.new(context).renderable_items.index { |e| e.item_id == item_id } }
+
+ it_behaves_like 'hierarchy menu'
+ end
+end
diff --git a/spec/lib/sidebars/projects/menus/project_information_menu_spec.rb b/spec/lib/sidebars/projects/menus/project_information_menu_spec.rb
index 7ff06ac229e..76367782d68 100644
--- a/spec/lib/sidebars/projects/menus/project_information_menu_spec.rb
+++ b/spec/lib/sidebars/projects/menus/project_information_menu_spec.rb
@@ -59,5 +59,25 @@ RSpec.describe Sidebars::Projects::Menus::ProjectInformationMenu do
specify { is_expected.to be_nil }
end
end
+
+ describe 'Hierarchy' do
+ let(:item_id) { :hierarchy }
+
+ context 'when the feature is disabled' do
+ before do
+ stub_feature_flags(work_items_hierarchy: false)
+ end
+
+ specify { is_expected.to be_nil }
+ end
+
+ context 'when the feature is enabled' do
+ before do
+ stub_feature_flags(work_items_hierarchy: true)
+ end
+
+ specify { is_expected.not_to be_nil }
+ end
+ end
end
end