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-17 18:16:12 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-01-17 18:16:12 +0300
commit8432be20de0a29f4dde4980efe37d013c9e90034 (patch)
treeaf163db5a7c8ac17ca4da59d505c75552452956c /spec/lib/sidebars
parentdd33e917374b611cd5a596c7fa51b47af6e153f6 (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 7e8d0ab0518..5cbf0a13b66 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