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
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-05 21:10:31 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-05 21:10:31 +0300
commit8f4d63426a207611f71bc19dae62eb19765a4cf2 (patch)
treeb5843aaef889b0d1305e669404693f11ce414d22 /spec
parentcf05fd7f3956f0b1a17caf313e89bb7b3315d947 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/registrations/welcome_controller_spec.rb24
-rw-r--r--spec/features/admin/admin_settings_spec.rb69
-rw-r--r--spec/features/projects/navbar_spec.rb26
-rw-r--r--spec/features/projects/user_uses_shortcuts_spec.rb16
-rw-r--r--spec/frontend/issuable/components/csv_export_modal_spec.js2
-rw-r--r--spec/frontend/jobs/mock_data.js4
-rw-r--r--spec/frontend/pipeline_new/mock_data.js6
-rw-r--r--spec/frontend/projects/compare/components/app_legacy_spec.js2
-rw-r--r--spec/frontend/projects/compare/components/revision_dropdown_legacy_spec.js2
-rw-r--r--spec/lib/gitlab/highlight_spec.rb5
-rw-r--r--spec/lib/gitlab/static_site_editor/config/generated_config_spec.rb7
-rw-r--r--spec/lib/sidebars/projects/menus/operations_menu_spec.rb54
-rw-r--r--spec/models/group_spec.rb8
-rw-r--r--spec/models/project_spec.rb8
-rw-r--r--spec/requests/api/issues/issues_spec.rb29
-rw-r--r--spec/support/shared_contexts/navbar_structure_context.rb32
-rw-r--r--spec/support/shared_examples/requests/api/issuable_update_shared_examples.rb2
-rw-r--r--spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb135
18 files changed, 334 insertions, 97 deletions
diff --git a/spec/controllers/registrations/welcome_controller_spec.rb b/spec/controllers/registrations/welcome_controller_spec.rb
index 008259a8bfa..6d34b56df09 100644
--- a/spec/controllers/registrations/welcome_controller_spec.rb
+++ b/spec/controllers/registrations/welcome_controller_spec.rb
@@ -77,6 +77,30 @@ RSpec.describe Registrations::WelcomeController do
it { is_expected.to redirect_to(dashboard_projects_path)}
+ context 'when the new user already has any accepted group membership' do
+ let!(:member1) { create(:group_member, user: user) }
+
+ it 'redirects to the group activity page' do
+ expect(subject).to redirect_to(activity_group_path(member1.source))
+ end
+
+ context 'when the new user already has more than 1 accepted group membership' do
+ it 'redirects to the most recent membership group activty page' do
+ member2 = create(:group_member, user: user)
+
+ expect(subject).to redirect_to(activity_group_path(member2.source))
+ end
+ end
+
+ context 'when the member has an orphaned source at the time of the welcome' do
+ it 'redirects to the project dashboard page' do
+ member1.source.delete
+
+ expect(subject).to redirect_to(dashboard_projects_path)
+ end
+ end
+ end
+
context 'when the user opted in' do
let(:email_opted_in) { '1' }
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb
index 4f17260f87d..0a7113a5559 100644
--- a/spec/features/admin/admin_settings_spec.rb
+++ b/spec/features/admin/admin_settings_spec.rb
@@ -251,41 +251,62 @@ RSpec.describe 'Admin updates settings' do
end
end
- context 'when the Slack Notifications Service template is active' do
+ context 'when Service Templates are enabled' do
before do
- create(:service, :template, type: 'SlackService', active: true)
-
+ stub_feature_flags(disable_service_templates: false)
visit general_admin_application_settings_path
end
- it 'change Slack Notifications Service template settings', :js do
- first(:link, 'Service Templates').click
- click_link 'Slack notifications'
- fill_in 'Webhook', with: 'http://localhost'
- fill_in 'Username', with: 'test_user'
- fill_in 'service[push_channel]', with: '#test_channel'
- page.check('Notify only broken pipelines')
- page.select 'All branches', from: 'Branches to be notified'
- page.select 'Match any of the labels', from: 'Labels to be notified behavior'
+ it 'shows Service Templates link' do
+ expect(page).to have_link('Service Templates')
+ end
- check_all_events
- click_button 'Save changes'
+ context 'when the Slack Notifications Service template is active' do
+ before do
+ create(:service, :template, type: 'SlackService', active: true)
- expect(page).to have_content 'Application settings saved successfully'
+ visit general_admin_application_settings_path
+ end
- click_link 'Slack notifications'
+ it 'change Slack Notifications Service template settings', :js do
+ first(:link, 'Service Templates').click
+ click_link 'Slack notifications'
+ fill_in 'Webhook', with: 'http://localhost'
+ fill_in 'Username', with: 'test_user'
+ fill_in 'service[push_channel]', with: '#test_channel'
+ page.check('Notify only broken pipelines')
+ page.select 'All branches', from: 'Branches to be notified'
+ page.select 'Match any of the labels', from: 'Labels to be notified behavior'
+
+ check_all_events
+ click_button 'Save changes'
+
+ expect(page).to have_content 'Application settings saved successfully'
- expect(page.all('input[type=checkbox]')).to all(be_checked)
- expect(find_field('Webhook').value).to eq 'http://localhost'
- expect(find_field('Username').value).to eq 'test_user'
- expect(find('[name="service[push_channel]"]').value).to eq '#test_channel'
+ click_link 'Slack notifications'
+
+ expect(page.all('input[type=checkbox]')).to all(be_checked)
+ expect(find_field('Webhook').value).to eq 'http://localhost'
+ expect(find_field('Username').value).to eq 'test_user'
+ expect(find('[name="service[push_channel]"]').value).to eq '#test_channel'
+ end
+
+ it 'defaults Deployment events to false for chat notification template settings', :js do
+ first(:link, 'Service Templates').click
+ click_link 'Slack notifications'
+
+ expect(find_field('Deployment')).not_to be_checked
+ end
end
+ end
- it 'defaults Deployment events to false for chat notification template settings', :js do
- first(:link, 'Service Templates').click
- click_link 'Slack notifications'
+ context 'When Service templates are disabled' do
+ before do
+ stub_feature_flags(disable_service_templates: true)
+ end
- expect(find_field('Deployment')).not_to be_checked
+ it 'does not show Service Templates link' do
+ expect(page).not_to have_link('Service Templates')
end
end
diff --git a/spec/features/projects/navbar_spec.rb b/spec/features/projects/navbar_spec.rb
index 5ab75a6b914..d01e4aa85ab 100644
--- a/spec/features/projects/navbar_spec.rb
+++ b/spec/features/projects/navbar_spec.rb
@@ -72,6 +72,20 @@ RSpec.describe 'Project navbar' do
end
context 'when sidebar refactor feature flag is on' do
+ let(:operations_menu_items) do
+ [
+ _('Metrics'),
+ _('Logs'),
+ _('Tracing'),
+ _('Error Tracking'),
+ _('Alerts'),
+ _('Incidents'),
+ _('Environments'),
+ _('Feature Flags'),
+ _('Product Analytics')
+ ]
+ end
+
before do
stub_feature_flags(sidebar_refactor: true)
stub_config(registry: { enabled: true })
@@ -84,6 +98,18 @@ RSpec.describe 'Project navbar' do
new_sub_nav_item_name: _('Packages & Registries')
)
+ insert_after_nav_item(
+ _('Operations'),
+ new_nav_item: {
+ nav_item: _('Infrastructure'),
+ nav_sub_items: [
+ _('Kubernetes clusters'),
+ _('Serverless platform'),
+ _('Terraform')
+ ]
+ }
+ )
+
visit project_path(project)
end
diff --git a/spec/features/projects/user_uses_shortcuts_spec.rb b/spec/features/projects/user_uses_shortcuts_spec.rb
index b6fde19e0d4..b73a1f6b9fa 100644
--- a/spec/features/projects/user_uses_shortcuts_spec.rb
+++ b/spec/features/projects/user_uses_shortcuts_spec.rb
@@ -182,11 +182,25 @@ RSpec.describe 'User uses shortcuts', :js do
expect(page).to have_active_sub_navigation('Environments')
end
+ context 'when feature flag :sidebar_refactor is disabled' do
+ it 'redirects to the Kubernetes page with active Operations' do
+ stub_feature_flags(sidebar_refactor: false)
+
+ find('body').native.send_key('g')
+ find('body').native.send_key('k')
+
+ expect(page).to have_active_navigation('Operations')
+ expect(page).to have_active_sub_navigation('Kubernetes')
+ end
+ end
+ end
+
+ context 'when navigating to the Infrastructure pages' do
it 'redirects to the Kubernetes page' do
find('body').native.send_key('g')
find('body').native.send_key('k')
- expect(page).to have_active_navigation('Operations')
+ expect(page).to have_active_navigation('Infrastructure')
expect(page).to have_active_sub_navigation('Kubernetes')
end
end
diff --git a/spec/frontend/issuable/components/csv_export_modal_spec.js b/spec/frontend/issuable/components/csv_export_modal_spec.js
index a327da2d63a..7eb85a946ae 100644
--- a/spec/frontend/issuable/components/csv_export_modal_spec.js
+++ b/spec/frontend/issuable/components/csv_export_modal_spec.js
@@ -13,6 +13,8 @@ describe('CsvExportModal', () => {
mount(CsvExportModal, {
propsData: {
modalId: 'csv-export-modal',
+ exportCsvPath: 'export/csv/path',
+ issuableCount: 1,
...props,
},
provide: {
diff --git a/spec/frontend/jobs/mock_data.js b/spec/frontend/jobs/mock_data.js
index 48d575ac0f6..85bdd87abc6 100644
--- a/spec/frontend/jobs/mock_data.js
+++ b/spec/frontend/jobs/mock_data.js
@@ -1464,8 +1464,8 @@ export const mockJobsQueryResponse = {
__typename: 'DetailedStatus',
},
id: 'gid://gitlab/Ci::Build/2336',
- refName: 'master',
- refPath: '/root/ci-project/-/commits/master',
+ refName: 'main',
+ refPath: '/root/ci-project/-/commits/main',
tags: [],
shortSha: '4408fa2a',
commitPath: '/root/ci-project/-/commit/4408fa2a27aaadfdf42d8dda3d6a9c01ce6cad78',
diff --git a/spec/frontend/pipeline_new/mock_data.js b/spec/frontend/pipeline_new/mock_data.js
index 3f49ffe9664..3174b73098a 100644
--- a/spec/frontend/pipeline_new/mock_data.js
+++ b/spec/frontend/pipeline_new/mock_data.js
@@ -46,16 +46,16 @@ export const mockTagRefs = ['1.0.0', '1.1.0', '1.2.0'];
export const mockVariables = [
{
- uniqueId: 'var-refs/heads/master2',
+ uniqueId: 'var-refs/heads/main2',
variable_type: 'env_var',
key: 'var_without_value',
value: '',
},
{
- uniqueId: 'var-refs/heads/master3',
+ uniqueId: 'var-refs/heads/main3',
variable_type: 'env_var',
key: 'var_with_value',
value: 'test_value',
},
- { uniqueId: 'var-refs/heads/master4', variable_type: 'env_var', key: '', value: '' },
+ { uniqueId: 'var-refs/heads/main4', variable_type: 'env_var', key: '', value: '' },
];
diff --git a/spec/frontend/projects/compare/components/app_legacy_spec.js b/spec/frontend/projects/compare/components/app_legacy_spec.js
index 93e96c8b9f7..6fdf4014575 100644
--- a/spec/frontend/projects/compare/components/app_legacy_spec.js
+++ b/spec/frontend/projects/compare/components/app_legacy_spec.js
@@ -7,7 +7,7 @@ jest.mock('~/lib/utils/csrf', () => ({ token: 'mock-csrf-token' }));
const projectCompareIndexPath = 'some/path';
const refsProjectPath = 'some/refs/path';
-const paramsFrom = 'master';
+const paramsFrom = 'main';
const paramsTo = 'some-other-branch';
describe('CompareApp component', () => {
diff --git a/spec/frontend/projects/compare/components/revision_dropdown_legacy_spec.js b/spec/frontend/projects/compare/components/revision_dropdown_legacy_spec.js
index ca208395e82..38e13dc5462 100644
--- a/spec/frontend/projects/compare/components/revision_dropdown_legacy_spec.js
+++ b/spec/frontend/projects/compare/components/revision_dropdown_legacy_spec.js
@@ -9,7 +9,7 @@ const defaultProps = {
refsProjectPath: 'some/refs/path',
revisionText: 'Target',
paramsName: 'from',
- paramsBranch: 'master',
+ paramsBranch: 'main',
};
jest.mock('~/flash');
diff --git a/spec/lib/gitlab/highlight_spec.rb b/spec/lib/gitlab/highlight_spec.rb
index 1a929373716..5dcee1ff724 100644
--- a/spec/lib/gitlab/highlight_spec.rb
+++ b/spec/lib/gitlab/highlight_spec.rb
@@ -47,8 +47,9 @@ RSpec.describe Gitlab::Highlight do
end
it 'returns plain version for long content' do
- stub_const('Gitlab::Highlight::MAXIMUM_TEXT_HIGHLIGHT_SIZE', 1)
- result = described_class.highlight(file_name, content)
+ stub_config(extra: { 'maximum_text_highlight_size_kilobytes' => 0.0001 } ) # 1.024 bytes
+
+ result = described_class.highlight(file_name, content) # content is 44 bytes
expect(result).to eq(%[<span id="LC1" class="line" lang="">(make-pathname :defaults name</span>\n<span id="LC2" class="line" lang="">:type "assem")</span>])
end
diff --git a/spec/lib/gitlab/static_site_editor/config/generated_config_spec.rb b/spec/lib/gitlab/static_site_editor/config/generated_config_spec.rb
index 0b2055d3db5..8cd3feba339 100644
--- a/spec/lib/gitlab/static_site_editor/config/generated_config_spec.rb
+++ b/spec/lib/gitlab/static_site_editor/config/generated_config_spec.rb
@@ -54,13 +54,14 @@ RSpec.describe Gitlab::StaticSiteEditor::Config::GeneratedConfig do
path,
'',
message: 'message',
- branch_name: 'master'
+ branch_name: ref
)
end
+ let(:ref) { 'main' }
let(:path) { 'README.md.erb' }
- it { is_expected.to include(is_supported_content: true) }
+ it { is_expected.to include(branch: ref, is_supported_content: true) }
end
context 'when file path is nested' do
@@ -69,7 +70,7 @@ RSpec.describe Gitlab::StaticSiteEditor::Config::GeneratedConfig do
it { is_expected.to include(base_url: '/namespace/project/-/sse/master%2Flib%2FREADME.md') }
end
- context 'when branch is not master' do
+ context 'when branch is not master or main' do
let(:ref) { 'my-branch' }
it { is_expected.to include(is_supported_content: false) }
diff --git a/spec/lib/sidebars/projects/menus/operations_menu_spec.rb b/spec/lib/sidebars/projects/menus/operations_menu_spec.rb
index f8b4fc3757d..6e764dbb83a 100644
--- a/spec/lib/sidebars/projects/menus/operations_menu_spec.rb
+++ b/spec/lib/sidebars/projects/menus/operations_menu_spec.rb
@@ -131,36 +131,66 @@ RSpec.describe Sidebars::Projects::Menus::OperationsMenu do
describe 'Serverless' do
let(:item_id) { :serverless }
- specify { is_expected.not_to be_nil }
+ context 'when feature flag :sidebar_refactor is enabled' do
+ specify { is_expected.to be_nil }
+ end
- describe 'when the user does not have access' do
- let(:user) { nil }
+ context 'when feature flag :sidebar_refactor is disabled' do
+ before do
+ stub_feature_flags(sidebar_refactor: false)
+ end
- specify { is_expected.to be_nil }
+ specify { is_expected.not_to be_nil }
+
+ describe 'when the user does not have access' do
+ let(:user) { nil }
+
+ specify { is_expected.to be_nil }
+ end
end
end
describe 'Terraform' do
let(:item_id) { :terraform }
- specify { is_expected.not_to be_nil }
+ context 'when feature flag :sidebar_refactor is enabled' do
+ specify { is_expected.to be_nil }
+ end
- describe 'when the user does not have access' do
- let(:user) { nil }
+ context 'when feature flag :sidebar_refactor is disabled' do
+ before do
+ stub_feature_flags(sidebar_refactor: false)
+ end
- specify { is_expected.to be_nil }
+ specify { is_expected.not_to be_nil }
+
+ describe 'when the user does not have access' do
+ let(:user) { nil }
+
+ specify { is_expected.to be_nil }
+ end
end
end
describe 'Kubernetes' do
let(:item_id) { :kubernetes }
- specify { is_expected.not_to be_nil }
+ context 'when feature flag :sidebar_refactor is enabled' do
+ specify { is_expected.to be_nil }
+ end
- describe 'when the user does not have access' do
- let(:user) { nil }
+ context 'when feature flag :sidebar_refactor is disabled' do
+ before do
+ stub_feature_flags(sidebar_refactor: false)
+ end
- specify { is_expected.to be_nil }
+ specify { is_expected.not_to be_nil }
+
+ describe 'when the user does not have access' do
+ let(:user) { nil }
+
+ specify { is_expected.to be_nil }
+ end
end
end
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb
index 7c02029fa40..abb0b3d0b6f 100644
--- a/spec/models/group_spec.rb
+++ b/spec/models/group_spec.rb
@@ -2398,4 +2398,12 @@ RSpec.describe Group do
expect(group.to_ability_name).to eq('group')
end
end
+
+ describe '#activity_path' do
+ it 'returns the group activity_path' do
+ expected_path = "/groups/#{group.name}/-/activity"
+
+ expect(group.activity_path).to eq(expected_path)
+ end
+ end
end
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 55b13128c17..bf47e75cc7a 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -6890,6 +6890,14 @@ RSpec.describe Project, factory_default: :keep do
end
end
end
+
+ describe '#activity_path' do
+ it 'returns the project activity_path' do
+ expected_path = "/#{project.namespace.path}/#{project.name}/activity"
+
+ expect(project.activity_path).to eq(expected_path)
+ end
+ end
end
describe '#default_branch_or_main' do
diff --git a/spec/requests/api/issues/issues_spec.rb b/spec/requests/api/issues/issues_spec.rb
index 8f10de59526..125db58ed69 100644
--- a/spec/requests/api/issues/issues_spec.rb
+++ b/spec/requests/api/issues/issues_spec.rb
@@ -115,6 +115,7 @@ RSpec.describe API::Issues do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response.dig('author', 'id')).to eq(issue.author.id)
expect(json_response['description']).to eq(issue.description)
+ expect(json_response['issue_type']).to eq('issue')
end
end
@@ -378,6 +379,14 @@ RSpec.describe API::Issues do
expect_paginated_array_response([issue.id, closed_issue.id])
end
+ it 'returns issues with a given issue_type' do
+ issue2 = create(:incident, project: project)
+
+ get api('/issues', user), params: { issue_type: 'incident' }
+
+ expect_paginated_array_response(issue2.id)
+ end
+
it 'returns issues matching given search string for title' do
get api('/issues', user), params: { search: issue.title }
@@ -939,7 +948,17 @@ RSpec.describe API::Issues do
end
end
- describe 'PUT /projects/:id/issues/:issue_id' do
+ describe "POST /projects/:id/issues" do
+ it 'creates a new project issue' do
+ post api("/projects/#{project.id}/issues", user), params: { title: 'new issue' }
+
+ expect(response).to have_gitlab_http_status(:created)
+ expect(json_response['title']).to eq('new issue')
+ expect(json_response['issue_type']).to eq('issue')
+ end
+ end
+
+ describe 'PUT /projects/:id/issues/:issue_iid' do
it_behaves_like 'issuable update endpoint' do
let(:entity) { issue }
end
@@ -971,6 +990,14 @@ RSpec.describe API::Issues do
expect(ResourceLabelEvent.last.created_at).to be_like_time(fixed_time)
end
end
+
+ describe 'issue_type param' do
+ it 'allows issue type to be converted' do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user), params: { issue_type: 'incident' }
+
+ expect(issue.reload.incident?).to be(true)
+ end
+ end
end
describe 'DELETE /projects/:id/issues/:issue_iid' do
diff --git a/spec/support/shared_contexts/navbar_structure_context.rb b/spec/support/shared_contexts/navbar_structure_context.rb
index 65528f3900f..37f18e52449 100644
--- a/spec/support/shared_contexts/navbar_structure_context.rb
+++ b/spec/support/shared_contexts/navbar_structure_context.rb
@@ -24,6 +24,23 @@ RSpec.shared_context 'project navbar structure' do
}
end
+ let(:operations_menu_items) do
+ [
+ _('Metrics'),
+ _('Logs'),
+ _('Tracing'),
+ _('Error Tracking'),
+ _('Alerts'),
+ _('Incidents'),
+ _('Serverless'),
+ _('Terraform'),
+ _('Kubernetes'),
+ _('Environments'),
+ _('Feature Flags'),
+ _('Product Analytics')
+ ]
+ end
+
let(:structure) do
[
{
@@ -75,20 +92,7 @@ RSpec.shared_context 'project navbar structure' do
security_and_compliance_nav_item,
{
nav_item: _('Operations'),
- nav_sub_items: [
- _('Metrics'),
- _('Logs'),
- _('Tracing'),
- _('Error Tracking'),
- _('Alerts'),
- _('Incidents'),
- _('Serverless'),
- _('Terraform'),
- _('Kubernetes'),
- _('Environments'),
- _('Feature Flags'),
- _('Product Analytics')
- ]
+ nav_sub_items: operations_menu_items
},
analytics_nav_item,
{
diff --git a/spec/support/shared_examples/requests/api/issuable_update_shared_examples.rb b/spec/support/shared_examples/requests/api/issuable_update_shared_examples.rb
index ded381fd402..a3378d4619b 100644
--- a/spec/support/shared_examples/requests/api/issuable_update_shared_examples.rb
+++ b/spec/support/shared_examples/requests/api/issuable_update_shared_examples.rb
@@ -3,7 +3,7 @@
RSpec.shared_examples 'issuable update endpoint' do
let(:area) { entity.class.name.underscore.pluralize }
- describe 'PUT /projects/:id/issues/:issue_id' do
+ describe 'PUT /projects/:id/issues/:issue_iid' do
let(:url) { "/projects/#{project.id}/#{area}/#{entity.iid}" }
it 'clears labels when labels param is nil' do
diff --git a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
index d5320b2d044..7bb9570e90a 100644
--- a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
+++ b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
@@ -471,56 +471,71 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
end
end
- describe 'Serverless' do
- it 'has a link to the serverless page' do
- render
-
- expect(rendered).to have_link('Serverless', href: project_serverless_functions_path(project))
+ context 'when feature flag :sidebar_refactor is disabled' do
+ before do
+ stub_feature_flags(sidebar_refactor: false)
end
- describe 'when the user does not have access' do
- let(:user) { nil }
-
- it 'does not have a link to the serverless page' do
+ describe 'Serverless' do
+ it 'has a link to the serverless page' do
render
- expect(rendered).not_to have_link('Serverless')
+ page = Nokogiri::HTML.parse(rendered)
+
+ expect(page.at_css('.shortcuts-operations').parent.css('[aria-label="Serverless"]')).not_to be_empty
+ expect(rendered).to have_link('Serverless', href: project_serverless_functions_path(project))
end
- end
- end
- describe 'Terraform' do
- it 'has a link to the terraform page' do
- render
+ describe 'when the user does not have access' do
+ let(:user) { nil }
- expect(rendered).to have_link('Terraform', href: project_terraform_index_path(project))
- end
+ it 'does not have a link to the serverless page' do
+ render
- describe 'when the user does not have access' do
- let(:user) { nil }
+ expect(rendered).not_to have_link('Serverless')
+ end
+ end
+ end
- it 'does not have a link to the terraform page' do
+ describe 'Terraform' do
+ it 'has a link to the terraform page' do
render
- expect(rendered).not_to have_link('Terraform')
+ page = Nokogiri::HTML.parse(rendered)
+
+ expect(page.at_css('.shortcuts-operations').parent.css('[aria-label="Terraform"]')).not_to be_empty
+ expect(rendered).to have_link('Terraform', href: project_terraform_index_path(project))
end
- end
- end
- describe 'Kubernetes' do
- it 'has a link to the kubernetes page' do
- render
+ describe 'when the user does not have access' do
+ let(:user) { nil }
- expect(rendered).to have_link('Kubernetes', href: project_clusters_path(project))
- end
+ it 'does not have a link to the terraform page' do
+ render
- describe 'when the user does not have access' do
- let(:user) { nil }
+ expect(rendered).not_to have_link('Terraform')
+ end
+ end
+ end
- it 'does not have a link to the kubernetes page' do
+ describe 'Kubernetes' do
+ it 'has a link to the kubernetes page' do
render
- expect(rendered).not_to have_link('Kubernetes')
+ page = Nokogiri::HTML.parse(rendered)
+
+ expect(page.at_css('.shortcuts-operations').parent.css('[aria-label="Kubernetes"]')).not_to be_empty
+ expect(rendered).to have_link('Kubernetes', href: project_clusters_path(project))
+ end
+
+ describe 'when the user does not have access' do
+ let(:user) { nil }
+
+ it 'does not have a link to the kubernetes page' do
+ render
+
+ expect(rendered).not_to have_link('Kubernetes')
+ end
end
end
end
@@ -580,6 +595,62 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
end
end
+ describe 'Infrastructure' do
+ describe 'Serverless platform' do
+ it 'has a link to the serverless page' do
+ render
+
+ expect(rendered).to have_link('Serverless platform', href: project_serverless_functions_path(project))
+ end
+
+ describe 'when the user does not have access' do
+ let(:user) { nil }
+
+ it 'does not have a link to the serverless page' do
+ render
+
+ expect(rendered).not_to have_link('Serverless platform')
+ end
+ end
+ end
+
+ describe 'Terraform' do
+ it 'has a link to the terraform page' do
+ render
+
+ expect(rendered).to have_link('Terraform', href: project_terraform_index_path(project))
+ end
+
+ describe 'when the user does not have access' do
+ let(:user) { nil }
+
+ it 'does not have a link to the terraform page' do
+ render
+
+ expect(rendered).not_to have_link('Terraform')
+ end
+ end
+ end
+
+ describe 'Kubernetes clusters' do
+ it 'has a link to the kubernetes page' do
+ render
+
+ expect(rendered).to have_link('Kubernetes clusters', href: project_clusters_path(project))
+ end
+
+ describe 'when the user does not have access' do
+ let(:user) { nil }
+
+ it 'does not have a link to the kubernetes page' do
+ render
+
+ expect(rendered).not_to have_link('Kubernetes clusters')
+ end
+ end
+ end
+ end
+
describe 'Packages and Registries' do
let(:registry_enabled) { true }
let(:packages_enabled) { true }