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>2020-03-19 18:09:41 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-19 18:09:41 +0300
commit78d8830cec030ff12afed3c8ae1dddec454d0a24 (patch)
treeb5494f60c7d28be787eee7872fd3d99dcbf9f8c8 /spec/support
parent652bd073731b0028641672a75355c7918b5ac116 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/helpers/navbar_structure_helper.rb21
-rw-r--r--spec/support/shared_contexts/navbar_structure_context.rb163
2 files changed, 184 insertions, 0 deletions
diff --git a/spec/support/helpers/navbar_structure_helper.rb b/spec/support/helpers/navbar_structure_helper.rb
new file mode 100644
index 00000000000..cfb1b185560
--- /dev/null
+++ b/spec/support/helpers/navbar_structure_helper.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+module NavbarStructureHelper
+ def insert_after_nav_item(before_nav_item_name, new_nav_item:)
+ expect(structure).to include(a_hash_including(nav_item: before_nav_item_name))
+
+ index = structure.find_index { |h| h[:nav_item] == before_nav_item_name }
+ structure.insert(index + 1, new_nav_item)
+ end
+
+ def insert_after_sub_nav_item(before_sub_nav_item_name, within:, new_sub_nav_item_name:)
+ expect(structure).to include(a_hash_including(nav_item: within))
+ hash = structure.find { |h| h[:nav_item] == within }
+
+ expect(hash).to have_key(:nav_sub_items)
+ expect(hash[:nav_sub_items]).to include(before_sub_nav_item_name)
+
+ index = hash[:nav_sub_items].find_index(before_sub_nav_item_name)
+ hash[:nav_sub_items].insert(index + 1, new_sub_nav_item_name)
+ end
+end
diff --git a/spec/support/shared_contexts/navbar_structure_context.rb b/spec/support/shared_contexts/navbar_structure_context.rb
new file mode 100644
index 00000000000..c7df54f9501
--- /dev/null
+++ b/spec/support/shared_contexts/navbar_structure_context.rb
@@ -0,0 +1,163 @@
+# frozen_string_literal: true
+
+RSpec.shared_context 'project navbar structure' do
+ let(:requirements_nav_item) do
+ {
+ nav_item: _('Requirements'),
+ nav_sub_items: [_('List')]
+ }
+ end
+
+ let(:analytics_nav_item) do
+ {
+ nav_item: _('Analytics'),
+ nav_sub_items: [
+ _('CI / CD'),
+ (_('Code Review') if Gitlab.ee?),
+ _('Repository'),
+ _('Value Stream')
+ ]
+ }
+ end
+
+ let(:structure) do
+ [
+ {
+ nav_item: _('Project overview'),
+ nav_sub_items: [
+ _('Details'),
+ _('Activity'),
+ _('Releases')
+ ]
+ },
+ {
+ nav_item: _('Repository'),
+ nav_sub_items: [
+ _('Files'),
+ _('Commits'),
+ _('Branches'),
+ _('Tags'),
+ _('Contributors'),
+ _('Graph'),
+ _('Compare'),
+ (_('Locked Files') if Gitlab.ee?)
+ ]
+ },
+ {
+ nav_item: _('Issues'),
+ nav_sub_items: [
+ _('List'),
+ _('Boards'),
+ _('Labels'),
+ _('Milestones')
+ ]
+ },
+ {
+ nav_item: _('Merge Requests'),
+ nav_sub_items: []
+ },
+ (requirements_nav_item if Gitlab.ee?),
+ {
+ nav_item: _('CI / CD'),
+ nav_sub_items: [
+ _('Pipelines'),
+ _('Jobs'),
+ _('Artifacts'),
+ _('Schedules')
+ ]
+ },
+ {
+ nav_item: _('Operations'),
+ nav_sub_items: [
+ _('Metrics'),
+ _('Environments'),
+ _('Error Tracking'),
+ _('Serverless'),
+ _('Logs'),
+ _('Kubernetes')
+ ]
+ },
+ analytics_nav_item,
+ {
+ nav_item: _('Wiki'),
+ nav_sub_items: []
+ },
+ {
+ nav_item: _('Snippets'),
+ nav_sub_items: []
+ },
+ {
+ nav_item: _('Settings'),
+ nav_sub_items: [
+ _('General'),
+ _('Members'),
+ _('Integrations'),
+ _('Webhooks'),
+ _('Repository'),
+ _('CI / CD'),
+ _('Operations'),
+ (_('Audit Events') if Gitlab.ee?)
+ ].compact
+ }
+ ].compact
+ end
+end
+
+RSpec.shared_context 'group navbar structure' do
+ let(:analytics_nav_item) do
+ {
+ nav_item: _('Analytics'),
+ nav_sub_items: [
+ _('Contribution')
+ ]
+ }
+ end
+
+ let(:settings_nav_item) do
+ {
+ nav_item: _('Settings'),
+ nav_sub_items: [
+ _('General'),
+ _('Projects'),
+ _('CI / CD'),
+ _('Webhooks'),
+ _('Audit Events'),
+ _('Usage Quotas')
+ ]
+ }
+ end
+
+ let(:structure) do
+ [
+ {
+ nav_item: _('Group overview'),
+ nav_sub_items: [
+ _('Details'),
+ _('Activity')
+ ]
+ },
+ {
+ nav_item: _('Issues'),
+ nav_sub_items: [
+ _('List'),
+ _('Board'),
+ _('Labels'),
+ _('Milestones')
+ ]
+ },
+ {
+ nav_item: _('Merge Requests'),
+ nav_sub_items: []
+ },
+ {
+ nav_item: _('Kubernetes'),
+ nav_sub_items: []
+ },
+ (analytics_nav_item if Gitlab.ee?),
+ {
+ nav_item: _('Members'),
+ nav_sub_items: []
+ }
+ ]
+ end
+end