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>2023-11-03 12:08:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-11-03 12:08:44 +0300
commitb4c39709e346f437a85829f985f6596cb6209d35 (patch)
tree010b87019e3f523045141f3ce683a1f5d4141499 /spec/helpers/nav
parentea044b0c4c74b91c5d48435254e7fa60aea064ff (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers/nav')
-rw-r--r--spec/helpers/nav/new_dropdown_helper_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/helpers/nav/new_dropdown_helper_spec.rb b/spec/helpers/nav/new_dropdown_helper_spec.rb
index 47f23c4fa21..4252e10c922 100644
--- a/spec/helpers/nav/new_dropdown_helper_spec.rb
+++ b/spec/helpers/nav/new_dropdown_helper_spec.rb
@@ -11,6 +11,7 @@ RSpec.describe Nav::NewDropdownHelper, feature_category: :navigation do
let(:with_can_create_project) { false }
let(:with_can_create_group) { false }
let(:with_can_create_snippet) { false }
+ let(:with_can_create_organization) { false }
let(:title) { 'Create new...' }
subject(:view_model) do
@@ -24,6 +25,7 @@ RSpec.describe Nav::NewDropdownHelper, feature_category: :navigation do
allow(user).to receive(:can_create_group?) { with_can_create_group }
allow(user).to receive(:can?).and_call_original
allow(user).to receive(:can?).with(:create_snippet) { with_can_create_snippet }
+ allow(user).to receive(:can?).with(:create_organization) { with_can_create_organization }
end
shared_examples 'invite member item' do |partial|
@@ -135,6 +137,39 @@ RSpec.describe Nav::NewDropdownHelper, feature_category: :navigation do
)
end
end
+
+ context 'when can create organization' do
+ let(:with_can_create_organization) { true }
+
+ it 'has new organization menu item' do
+ expect(view_model[:menu_sections]).to eq(
+ expected_menu_section(
+ title: _('In GitLab'),
+ menu_item: ::Gitlab::Nav::TopNavMenuItem.build(
+ id: 'general_new_organization',
+ title: s_('Organization|New organization'),
+ href: '/-/organizations/new',
+ data: {
+ track_action: 'click_link_new_organization_parent',
+ track_label: 'plus_menu_dropdown',
+ track_property: 'navigation_top',
+ testid: 'global_new_organization_link'
+ }
+ )
+ )
+ )
+ end
+
+ context 'when ui_for_organizations feature flag is disabled' do
+ before do
+ stub_feature_flags(ui_for_organizations: false)
+ end
+
+ it 'does not have new organization menu item' do
+ expect(view_model[:menu_sections]).to match_array([])
+ end
+ end
+ end
end
context 'with persisted group' do