summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/factories/bulk_import/entities.rb2
-rw-r--r--spec/features/admin/users/users_spec.rb5
-rw-r--r--spec/features/incidents/incident_timeline_events_spec.rb14
-rw-r--r--spec/features/issuables/sorting_list_spec.rb7
-rw-r--r--spec/features/jira_connect/branches_spec.rb20
-rw-r--r--spec/features/merge_request/user_creates_merge_request_spec.rb5
-rw-r--r--spec/features/merge_request/user_creates_mr_spec.rb2
-rw-r--r--spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb8
-rw-r--r--spec/features/merge_requests/user_sorts_merge_requests_spec.rb8
-rw-r--r--spec/features/projects/pipelines/pipelines_spec.rb6
-rw-r--r--spec/frontend/ci/runner/components/runner_header_spec.js6
-rw-r--r--spec/frontend/issues/show/components/description_spec.js14
-rw-r--r--spec/frontend/language_switcher/components/app_spec.js2
-rw-r--r--spec/frontend/sidebar/components/time_tracking/create_timelog_form_spec.js4
-rw-r--r--spec/helpers/snippets_helper_spec.rb15
-rw-r--r--spec/lib/bulk_imports/common/pipelines/boards_pipeline_spec.rb6
-rw-r--r--spec/lib/bulk_imports/common/pipelines/labels_pipeline_spec.rb4
-rw-r--r--spec/lib/bulk_imports/common/pipelines/milestones_pipeline_spec.rb6
-rw-r--r--spec/lib/bulk_imports/common/pipelines/wiki_pipeline_spec.rb4
-rw-r--r--spec/lib/bulk_imports/groups/pipelines/project_entities_pipeline_spec.rb12
-rw-r--r--spec/lib/bulk_imports/pipeline/context_spec.rb2
-rw-r--r--spec/lib/bulk_imports/projects/pipelines/auto_devops_pipeline_spec.rb2
-rw-r--r--spec/lib/bulk_imports/projects/pipelines/ci_pipelines_pipeline_spec.rb2
-rw-r--r--spec/lib/bulk_imports/projects/pipelines/issues_pipeline_spec.rb2
-rw-r--r--spec/lib/bulk_imports/projects/pipelines/merge_requests_pipeline_spec.rb2
-rw-r--r--spec/lib/bulk_imports/projects/pipelines/pipeline_schedules_pipeline_spec.rb2
-rw-r--r--spec/lib/bulk_imports/projects/pipelines/project_pipeline_spec.rb2
-rw-r--r--spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb2
-rw-r--r--spec/lib/bulk_imports/projects/pipelines/repository_pipeline_spec.rb4
-rw-r--r--spec/lib/bulk_imports/projects/pipelines/snippets_pipeline_spec.rb2
-rw-r--r--spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb2
-rw-r--r--spec/lib/bulk_imports/projects/transformers/project_attributes_transformer_spec.rb4
-rw-r--r--spec/lib/gitlab/regex_spec.rb46
-rw-r--r--spec/models/bulk_imports/entity_spec.rb32
-rw-r--r--spec/models/ci/build_spec.rb16
-rw-r--r--spec/models/group_spec.rb7
-rw-r--r--spec/models/project_spec.rb10
-rw-r--r--spec/presenters/user_presenter_spec.rb8
-rw-r--r--spec/services/bulk_imports/create_service_spec.rb10
-rw-r--r--spec/support/helpers/features/sorting_helpers.rb4
-rw-r--r--spec/support/helpers/listbox_helpers.rb8
-rw-r--r--spec/support/shared_examples/features/creatable_merge_request_shared_examples.rb5
42 files changed, 205 insertions, 119 deletions
diff --git a/spec/factories/bulk_import/entities.rb b/spec/factories/bulk_import/entities.rb
index 5d8d91ab07a..a662d42c7c9 100644
--- a/spec/factories/bulk_import/entities.rb
+++ b/spec/factories/bulk_import/entities.rb
@@ -8,7 +8,7 @@ FactoryBot.define do
sequence(:source_full_path) { |n| "source-path-#{n}" }
sequence(:destination_namespace) { |n| "destination-path-#{n}" }
- destination_name { 'imported-entity' }
+ destination_slug { 'imported-entity' }
sequence(:source_xid)
migrate_projects { true }
diff --git a/spec/features/admin/users/users_spec.rb b/spec/features/admin/users/users_spec.rb
index 975af84969d..07db0750074 100644
--- a/spec/features/admin/users/users_spec.rb
+++ b/spec/features/admin/users/users_spec.rb
@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec.describe 'Admin::Users', feature_category: :user_management do
include Spec::Support::Helpers::Features::AdminUsersHelpers
include Spec::Support::Helpers::ModalHelpers
+ include ListboxHelpers
let_it_be(:user, reload: true) { create(:omniauth_user, provider: 'twitter', extern_uid: '123456') }
let_it_be(:current_user) { create(:admin) }
@@ -608,8 +609,8 @@ RSpec.describe 'Admin::Users', feature_category: :user_management do
def sort_by(option)
page.within('.filtered-search-block') do
- find('.gl-dropdown').click
- find('.gl-dropdown-item', text: option).click
+ find('.gl-new-dropdown').click
+ select_listbox_item(option)
end
end
end
diff --git a/spec/features/incidents/incident_timeline_events_spec.rb b/spec/features/incidents/incident_timeline_events_spec.rb
index ffab23c58bc..7404ac64cc9 100644
--- a/spec/features/incidents/incident_timeline_events_spec.rb
+++ b/spec/features/incidents/incident_timeline_events_spec.rb
@@ -3,6 +3,8 @@
require 'spec_helper'
RSpec.describe 'Incident timeline events', :js, feature_category: :incident_management do
+ include ListboxHelpers
+
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user, developer_projects: [project]) }
let_it_be(:incident) { create(:incident, project: project) }
@@ -47,11 +49,7 @@ RSpec.describe 'Incident timeline events', :js, feature_category: :incident_mana
# Add event
click_button(s_('Incident|Add new timeline event'))
- click_button _('Select tags')
- page.within '.gl-dropdown-inner' do
- expect(page).to have_content(_('Start time'))
- page.find('.gl-dropdown-item-text-wrapper', text: _('Start time')).click
- end
+ select_from_listbox('Start time', from: 'Select tags')
complete_form('Event note goes here', '07', '25')
@@ -64,11 +62,9 @@ RSpec.describe 'Incident timeline events', :js, feature_category: :incident_mana
# Edit event
trigger_dropdown_action(_('Edit'))
- click_button _('Start time')
- page.within '.gl-dropdown-inner' do
- page.find('.gl-dropdown-item-text-wrapper', text: _('Start time')).click
- end
+ select_from_listbox('Start time', from: 'Start time')
+
complete_form('Edited event note goes here', '08', '30')
page.within '.timeline-event-note' do
diff --git a/spec/features/issuables/sorting_list_spec.rb b/spec/features/issuables/sorting_list_spec.rb
index b5362267309..9045124cc8c 100644
--- a/spec/features/issuables/sorting_list_spec.rb
+++ b/spec/features/issuables/sorting_list_spec.rb
@@ -2,6 +2,8 @@
require 'spec_helper'
RSpec.describe 'Sort Issuable List', feature_category: :team_planning do
+ include ListboxHelpers
+
let(:project) { create(:project, :public) }
let(:first_created_issuable) { issuables.order_created_asc.first }
@@ -94,8 +96,7 @@ RSpec.describe 'Sort Issuable List', feature_category: :team_planning do
it 'supports sorting in asc and desc order' do
visit_merge_requests_with_state(project, 'open')
- click_button('Created date')
- find('.dropdown-item', text: 'Updated date').click
+ select_from_listbox('Updated date', from: 'Created date')
expect(first_merge_request).to include(last_updated_issuable.title)
expect(last_merge_request).to include(first_updated_issuable.title)
@@ -209,7 +210,7 @@ RSpec.describe 'Sort Issuable List', feature_category: :team_planning do
end
def selected_sort_order
- find('.filter-dropdown-container .dropdown button').text.downcase
+ find('.filter-dropdown-container .gl-new-dropdown button').text.downcase
end
def visit_merge_requests_with_state(project, state)
diff --git a/spec/features/jira_connect/branches_spec.rb b/spec/features/jira_connect/branches_spec.rb
index 8cf07f2ade2..c90c0d2dda9 100644
--- a/spec/features/jira_connect/branches_spec.rb
+++ b/spec/features/jira_connect/branches_spec.rb
@@ -20,8 +20,8 @@ RSpec.describe 'Create GitLab branches from Jira', :js, feature_category: :integ
sign_in(alice)
end
- def within_dropdown(&block)
- within('.dropdown-menu', &block)
+ def within_project_listbox(&block)
+ within('#project-select', &block)
end
it 'select project and branch and submit the form' do
@@ -35,16 +35,16 @@ RSpec.describe 'Create GitLab branches from Jira', :js, feature_category: :integ
click_on 'Select a project'
- within_dropdown do
- expect(page).to have_text('Alice / foo')
- expect(page).to have_text('Alice / bar')
- expect(page).not_to have_text('Bob /')
+ within_project_listbox do
+ expect_listbox_item('Alice / foo')
+ expect_listbox_item('Alice / bar')
+ expect_no_listbox_item('Bob /')
fill_in 'Search', with: 'foo'
- expect(page).not_to have_text('Alice / bar')
+ expect_no_listbox_item('Alice / bar')
- find('span', text: 'Alice / foo', match: :first).click
+ select_listbox_item('Alice / foo')
end
expect(page).to have_field('Branch name', with: 'ACME-123-my-issue-title')
@@ -61,9 +61,9 @@ RSpec.describe 'Create GitLab branches from Jira', :js, feature_category: :integ
find('span', text: 'Alice / foo', match: :first).click
- within_dropdown do
+ within_project_listbox do
fill_in 'Search', with: ''
- find('span', text: 'Alice / bar', match: :first).click
+ select_listbox_item('Alice / bar')
end
click_on 'master'
diff --git a/spec/features/merge_request/user_creates_merge_request_spec.rb b/spec/features/merge_request/user_creates_merge_request_spec.rb
index 6be0eee21fc..97b423f2cc2 100644
--- a/spec/features/merge_request/user_creates_merge_request_spec.rb
+++ b/spec/features/merge_request/user_creates_merge_request_spec.rb
@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe 'User creates a merge request', :js, feature_category: :code_review_workflow do
include ProjectForksHelper
+ include ListboxHelpers
shared_examples 'creates a merge request' do
specify do
@@ -155,7 +156,7 @@ RSpec.describe 'User creates a merge request', :js, feature_category: :code_revi
wait_for_requests
find('.gl-listbox-search-input').set(project.full_path)
- first('.gl-dropdown-item', text: project.full_path).click
+ select_listbox_item(project.full_path)
end
def select_branch(selector, branch)
@@ -164,6 +165,6 @@ RSpec.describe 'User creates a merge request', :js, feature_category: :code_revi
wait_for_requests
find('.gl-listbox-search-input').set(branch)
- first('.gl-dropdown-item', text: branch).click
+ select_listbox_item(branch, exact_text: true)
end
end
diff --git a/spec/features/merge_request/user_creates_mr_spec.rb b/spec/features/merge_request/user_creates_mr_spec.rb
index cde1b71a7ee..6ee20a08a47 100644
--- a/spec/features/merge_request/user_creates_mr_spec.rb
+++ b/spec/features/merge_request/user_creates_mr_spec.rb
@@ -61,7 +61,7 @@ RSpec.describe 'Merge request > User creates MR', feature_category: :code_review
find('.js-source-project').click
find('.gl-listbox-search-input').set('source')
- expect(first('.merge-request-select .dropdown-menu')).not_to have_content(source_project.name)
+ expect(first('.merge-request-select .gl-new-dropdown-panel')).not_to have_content(source_project.name)
end
end
end
diff --git a/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb b/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb
index f79821e9420..0de59ea21c5 100644
--- a/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb
+++ b/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb
@@ -3,13 +3,15 @@
require 'spec_helper'
RSpec.describe 'Merge request > User selects branches for new MR', :js, feature_category: :code_review_workflow do
+ include ListboxHelpers
+
let(:project) { create(:project, :public, :repository) }
let(:user) { project.creator }
def select_source_branch(branch_name)
find('.js-source-branch', match: :first).click
find('.gl-listbox-search-input').native.send_keys branch_name
- find('.gl-dropdown-item', text: branch_name, match: :first).click
+ select_listbox_item(branch_name)
end
before do
@@ -27,7 +29,7 @@ RSpec.describe 'Merge request > User selects branches for new MR', :js, feature_
expect(page).to have_content('Target branch')
first('.js-source-branch').click
- find('.gl-dropdown-item', match: :first).click
+ find('.gl-new-dropdown-item', match: :first).click
expect(page).to have_content "b83d6e3"
end
@@ -44,7 +46,7 @@ RSpec.describe 'Merge request > User selects branches for new MR', :js, feature_
first('.js-target-branch').click
find('.gl-listbox-search-input').native.send_keys 'v1.1.0'
- find('.gl-dropdown-item', text: 'v1.1.0', match: :first).click
+ select_listbox_item('v1.1.0')
expect(page).to have_content "b83d6e3"
end
diff --git a/spec/features/merge_requests/user_sorts_merge_requests_spec.rb b/spec/features/merge_requests/user_sorts_merge_requests_spec.rb
index cf99f2cb94a..58d796f8288 100644
--- a/spec/features/merge_requests/user_sorts_merge_requests_spec.rb
+++ b/spec/features/merge_requests/user_sorts_merge_requests_spec.rb
@@ -27,15 +27,15 @@ RSpec.describe 'User sorts merge requests', :js, feature_category: :code_review_
visit(merge_requests_dashboard_path(assignee_username: user.username))
- expect(find('.filter-dropdown-container button.dropdown-toggle')).to have_content('Milestone')
+ expect(find('.filter-dropdown-container button.gl-new-dropdown-toggle')).to have_content('Milestone')
visit(project_merge_requests_path(project))
- expect(find('.filter-dropdown-container button.dropdown-toggle')).to have_content('Milestone')
+ expect(find('.filter-dropdown-container button.gl-new-dropdown-toggle')).to have_content('Milestone')
visit(merge_requests_group_path(group))
- expect(find('.filter-dropdown-container button.dropdown-toggle')).to have_content('Milestone')
+ expect(find('.filter-dropdown-container button.gl-new-dropdown-toggle')).to have_content('Milestone')
end
it 'fallbacks to issuable_sort cookie key when remembering the sorting option' do
@@ -43,7 +43,7 @@ RSpec.describe 'User sorts merge requests', :js, feature_category: :code_review_
visit(merge_requests_dashboard_path(assignee_username: user.username))
- expect(find('.filter-dropdown-container button.dropdown-toggle')).to have_content('Milestone')
+ expect(find('.filter-dropdown-container button.gl-new-dropdown-toggle')).to have_content('Milestone')
end
it 'separates remember sorting with issues', :js do
diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb
index 6a44f421249..b5f640f1cca 100644
--- a/spec/features/projects/pipelines/pipelines_spec.rb
+++ b/spec/features/projects/pipelines/pipelines_spec.rb
@@ -597,8 +597,8 @@ RSpec.describe 'Pipelines', :js, feature_category: :projects do
it 'changes the Pipeline ID column for Pipeline IID' do
page.find('[data-testid="pipeline-key-collapsible-box"]').click
- within '.gl-dropdown-contents' do
- dropdown_options = page.find_all '.gl-dropdown-item'
+ within '.gl-new-dropdown-contents' do
+ dropdown_options = page.find_all '.gl-new-dropdown-item'
dropdown_options[1].click
end
@@ -675,7 +675,7 @@ RSpec.describe 'Pipelines', :js, feature_category: :projects do
click_button project.default_branch
wait_for_requests
- find('.gl-dropdown-item', text: 'master').click
+ find('.gl-new-dropdown-item', text: 'master').click
wait_for_requests
end
diff --git a/spec/frontend/ci/runner/components/runner_header_spec.js b/spec/frontend/ci/runner/components/runner_header_spec.js
index a04011de1cd..abe3b47767e 100644
--- a/spec/frontend/ci/runner/components/runner_header_spec.js
+++ b/spec/frontend/ci/runner/components/runner_header_spec.js
@@ -6,7 +6,7 @@ import {
GROUP_TYPE,
STATUS_ONLINE,
} from '~/ci/runner/constants';
-import { TYPE_CI_RUNNER } from '~/graphql_shared/constants';
+import { TYPENAME_CI_RUNNER } from '~/graphql_shared/constants';
import { convertToGraphQLId } from '~/graphql_shared/utils';
import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue';
@@ -71,7 +71,7 @@ describe('RunnerHeader', () => {
it('displays the runner id', () => {
createComponent({
runner: {
- id: convertToGraphQLId(TYPE_CI_RUNNER, 99),
+ id: convertToGraphQLId(TYPENAME_CI_RUNNER, 99),
},
});
@@ -99,7 +99,7 @@ describe('RunnerHeader', () => {
it('does not display runner creation time if "createdAt" is missing', () => {
createComponent({
runner: {
- id: convertToGraphQLId(TYPE_CI_RUNNER, 99),
+ id: convertToGraphQLId(TYPENAME_CI_RUNNER, 99),
createdAt: null,
},
});
diff --git a/spec/frontend/issues/show/components/description_spec.js b/spec/frontend/issues/show/components/description_spec.js
index 9f36204139f..309930afa4d 100644
--- a/spec/frontend/issues/show/components/description_spec.js
+++ b/spec/frontend/issues/show/components/description_spec.js
@@ -261,7 +261,7 @@ describe('Description component', () => {
});
});
- describe('with work_items_create_from_markdown feature flag enabled', () => {
+ describe('with work_items_mvc_2 feature flag enabled', () => {
describe('empty description', () => {
beforeEach(() => {
createComponent({
@@ -270,7 +270,7 @@ describe('Description component', () => {
},
provide: {
glFeatures: {
- workItemsCreateFromMarkdown: true,
+ workItemsMvc2: true,
},
},
});
@@ -290,7 +290,7 @@ describe('Description component', () => {
},
provide: {
glFeatures: {
- workItemsCreateFromMarkdown: true,
+ workItemsMvc2: true,
},
},
});
@@ -330,7 +330,7 @@ describe('Description component', () => {
1. [ ] item 4;`;
createComponent({
props: { descriptionText },
- provide: { glFeatures: { workItemsCreateFromMarkdown: true } },
+ provide: { glFeatures: { workItemsMvc2: true } },
});
eventHub.$emit('delete-task-list-item', '4:4-5:19');
@@ -348,7 +348,7 @@ describe('Description component', () => {
descriptionHtml: descriptionHtmlWithTask,
},
provide: {
- glFeatures: { workItemsCreateFromMarkdown: true },
+ glFeatures: { workItemsMvc2: true },
},
});
return nextTick();
@@ -410,7 +410,7 @@ describe('Description component', () => {
createComponent({
props: { descriptionHtml: descriptionHtmlWithTask },
- provide: { glFeatures: { workItemsCreateFromMarkdown: true } },
+ provide: { glFeatures: { workItemsMvc2: true } },
});
expect(showDetailsModal).toHaveBeenCalledTimes(modalOpened);
@@ -426,7 +426,7 @@ describe('Description component', () => {
descriptionHtml: descriptionHtmlWithTask,
},
provide: {
- glFeatures: { workItemsCreateFromMarkdown: true },
+ glFeatures: { workItemsMvc2: true },
},
});
return nextTick();
diff --git a/spec/frontend/language_switcher/components/app_spec.js b/spec/frontend/language_switcher/components/app_spec.js
index effb71c2775..7f6fb138d89 100644
--- a/spec/frontend/language_switcher/components/app_spec.js
+++ b/spec/frontend/language_switcher/components/app_spec.js
@@ -28,7 +28,7 @@ describe('<LanguageSwitcher />', () => {
wrapper.destroy();
});
- const getPreferredLanguage = () => wrapper.find('.gl-dropdown-button-text').text();
+ const getPreferredLanguage = () => wrapper.find('.gl-new-dropdown-button-text').text();
const findLanguageDropdownItem = (code) => wrapper.findByTestId(`language_switcher_lang_${code}`);
const findFooter = () => wrapper.findByTestId('footer');
diff --git a/spec/frontend/sidebar/components/time_tracking/create_timelog_form_spec.js b/spec/frontend/sidebar/components/time_tracking/create_timelog_form_spec.js
index cb3bb7a4538..452240dd81b 100644
--- a/spec/frontend/sidebar/components/time_tracking/create_timelog_form_spec.js
+++ b/spec/frontend/sidebar/components/time_tracking/create_timelog_form_spec.js
@@ -7,7 +7,7 @@ import waitForPromises from 'helpers/wait_for_promises';
import { convertToGraphQLId } from '~/graphql_shared/utils';
import CreateTimelogForm from '~/sidebar/components/time_tracking/create_timelog_form.vue';
import createTimelogMutation from '~/sidebar/queries/create_timelog.mutation.graphql';
-import { TYPE_ISSUE, TYPE_MERGE_REQUEST } from '~/graphql_shared/constants';
+import { TYPENAME_ISSUE, TYPE_MERGE_REQUEST } from '~/graphql_shared/constants';
const mockMutationErrorMessage = 'Example error message';
@@ -157,7 +157,7 @@ describe('Create Timelog Form', () => {
it.each`
issuableType | typeConstant
- ${'issue'} | ${TYPE_ISSUE}
+ ${'issue'} | ${TYPENAME_ISSUE}
${'merge_request'} | ${TYPE_MERGE_REQUEST}
`(
'calls the mutation with all the fields when the the form is submitted and issuable type is $issuableType',
diff --git a/spec/helpers/snippets_helper_spec.rb b/spec/helpers/snippets_helper_spec.rb
index 48f67a291c4..43e663464c8 100644
--- a/spec/helpers/snippets_helper_spec.rb
+++ b/spec/helpers/snippets_helper_spec.rb
@@ -80,10 +80,25 @@ RSpec.describe SnippetsHelper do
context 'for Project Snippets' do
let(:snippet) { public_project_snippet }
+ let(:project) { snippet.project }
it 'returns copy button of embedded snippets' do
expect(subject).to eq(copy_button(blob.id.to_s))
end
+
+ describe 'path helpers' do
+ specify '#toggle_award_emoji_project_project_snippet_path' do
+ expect(toggle_award_emoji_project_project_snippet_path(project, snippet, a: 1)).to eq(
+ "/#{project.full_path}/-/snippets/#{snippet.id}/toggle_award_emoji?a=1"
+ )
+ end
+
+ specify '#toggle_award_emoji_project_project_snippet_url' do
+ expect(toggle_award_emoji_project_project_snippet_url(project, snippet, a: 1)).to eq(
+ "http://test.host/#{project.full_path}/-/snippets/#{snippet.id}/toggle_award_emoji?a=1"
+ )
+ end
+ end
end
def copy_button(blob_id)
diff --git a/spec/lib/bulk_imports/common/pipelines/boards_pipeline_spec.rb b/spec/lib/bulk_imports/common/pipelines/boards_pipeline_spec.rb
index 241bd694a2c..badc4a45c86 100644
--- a/spec/lib/bulk_imports/common/pipelines/boards_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/common/pipelines/boards_pipeline_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe BulkImports::Common::Pipelines::BoardsPipeline do
+RSpec.describe BulkImports::Common::Pipelines::BoardsPipeline, feature_category: :importers do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, group: group) }
@@ -53,7 +53,7 @@ RSpec.describe BulkImports::Common::Pipelines::BoardsPipeline do
project: project,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Group',
+ destination_slug: 'My-Destination-Group',
destination_namespace: group.full_path
)
end
@@ -78,7 +78,7 @@ RSpec.describe BulkImports::Common::Pipelines::BoardsPipeline do
group: group,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Group',
+ destination_slug: 'My-Destination-Group',
destination_namespace: group.full_path
)
end
diff --git a/spec/lib/bulk_imports/common/pipelines/labels_pipeline_spec.rb b/spec/lib/bulk_imports/common/pipelines/labels_pipeline_spec.rb
index ac516418ce8..23368f38889 100644
--- a/spec/lib/bulk_imports/common/pipelines/labels_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/common/pipelines/labels_pipeline_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe BulkImports::Common::Pipelines::LabelsPipeline do
+RSpec.describe BulkImports::Common::Pipelines::LabelsPipeline, feature_category: :importers do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:bulk_import) { create(:bulk_import, user: user) }
@@ -13,7 +13,7 @@ RSpec.describe BulkImports::Common::Pipelines::LabelsPipeline do
group: group,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Group',
+ destination_slug: 'My-Destination-Group',
destination_namespace: group.full_path
)
end
diff --git a/spec/lib/bulk_imports/common/pipelines/milestones_pipeline_spec.rb b/spec/lib/bulk_imports/common/pipelines/milestones_pipeline_spec.rb
index 902b29bc365..8a61e927712 100644
--- a/spec/lib/bulk_imports/common/pipelines/milestones_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/common/pipelines/milestones_pipeline_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe BulkImports::Common::Pipelines::MilestonesPipeline do
+RSpec.describe BulkImports::Common::Pipelines::MilestonesPipeline, feature_category: :importers do
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:bulk_import) { create(:bulk_import, user: user) }
@@ -97,7 +97,7 @@ RSpec.describe BulkImports::Common::Pipelines::MilestonesPipeline do
group: group,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Group',
+ destination_slug: 'My-Destination-Group',
destination_namespace: group.full_path
)
end
@@ -119,7 +119,7 @@ RSpec.describe BulkImports::Common::Pipelines::MilestonesPipeline do
project: project,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Project',
+ destination_slug: 'My-Destination-Project',
destination_namespace: group.full_path
)
end
diff --git a/spec/lib/bulk_imports/common/pipelines/wiki_pipeline_spec.rb b/spec/lib/bulk_imports/common/pipelines/wiki_pipeline_spec.rb
index 0eefb7390dc..30eef0b9f9e 100644
--- a/spec/lib/bulk_imports/common/pipelines/wiki_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/common/pipelines/wiki_pipeline_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe BulkImports::Common::Pipelines::WikiPipeline do
+RSpec.describe BulkImports::Common::Pipelines::WikiPipeline, feature_category: :importers do
describe '#run' do
let_it_be(:user) { create(:user) }
let_it_be(:bulk_import) { create(:bulk_import, user: user) }
@@ -14,7 +14,7 @@ RSpec.describe BulkImports::Common::Pipelines::WikiPipeline do
:project_entity,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Wiki',
+ destination_slug: 'My-Destination-Wiki',
destination_namespace: parent.full_path,
project: parent
)
diff --git a/spec/lib/bulk_imports/groups/pipelines/project_entities_pipeline_spec.rb b/spec/lib/bulk_imports/groups/pipelines/project_entities_pipeline_spec.rb
index c07d27e973f..395f3568913 100644
--- a/spec/lib/bulk_imports/groups/pipelines/project_entities_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/groups/pipelines/project_entities_pipeline_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe BulkImports::Groups::Pipelines::ProjectEntitiesPipeline do
+RSpec.describe BulkImports::Groups::Pipelines::ProjectEntitiesPipeline, feature_category: :importers do
let_it_be(:user) { create(:user) }
let_it_be(:destination_group) { create(:group) }
@@ -20,8 +20,9 @@ RSpec.describe BulkImports::Groups::Pipelines::ProjectEntitiesPipeline do
let(:extracted_data) do
BulkImports::Pipeline::ExtractedData.new(data: {
'id' => 'gid://gitlab/Project/1234567',
- 'name' => 'project',
- 'full_path' => 'group/project'
+ 'name' => 'My Project',
+ 'path' => 'my-project',
+ 'full_path' => 'group/my-project'
})
end
@@ -42,8 +43,9 @@ RSpec.describe BulkImports::Groups::Pipelines::ProjectEntitiesPipeline do
project_entity = BulkImports::Entity.last
expect(project_entity.source_type).to eq('project_entity')
- expect(project_entity.source_full_path).to eq('group/project')
- expect(project_entity.destination_name).to eq('project')
+ expect(project_entity.source_full_path).to eq('group/my-project')
+ expect(project_entity.destination_slug).to eq('my-project')
+ expect(project_entity.destination_name).to eq('my-project')
expect(project_entity.destination_namespace).to eq(destination_group.full_path)
expect(project_entity.source_xid).to eq(1234567)
end
diff --git a/spec/lib/bulk_imports/pipeline/context_spec.rb b/spec/lib/bulk_imports/pipeline/context_spec.rb
index 83d6f494d53..0f1d00172cd 100644
--- a/spec/lib/bulk_imports/pipeline/context_spec.rb
+++ b/spec/lib/bulk_imports/pipeline/context_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe BulkImports::Pipeline::Context do
create(
:bulk_import_entity,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Group',
+ destination_slug: 'My-Destination-Group',
destination_namespace: group.full_path,
group: group,
bulk_import: bulk_import
diff --git a/spec/lib/bulk_imports/projects/pipelines/auto_devops_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/auto_devops_pipeline_spec.rb
index e2744a6a457..b35ba612197 100644
--- a/spec/lib/bulk_imports/projects/pipelines/auto_devops_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/projects/pipelines/auto_devops_pipeline_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe BulkImports::Projects::Pipelines::AutoDevopsPipeline do
project: project,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Project',
+ destination_slug: 'My-Destination-Project',
destination_namespace: group.full_path
)
end
diff --git a/spec/lib/bulk_imports/projects/pipelines/ci_pipelines_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/ci_pipelines_pipeline_spec.rb
index 98a2e8b6a57..a78f524b227 100644
--- a/spec/lib/bulk_imports/projects/pipelines/ci_pipelines_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/projects/pipelines/ci_pipelines_pipeline_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe BulkImports::Projects::Pipelines::CiPipelinesPipeline do
project: project,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Project',
+ destination_slug: 'My-Destination-Project',
destination_namespace: group.full_path
)
end
diff --git a/spec/lib/bulk_imports/projects/pipelines/issues_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/issues_pipeline_spec.rb
index 19e3a1fecc3..a0789522ea8 100644
--- a/spec/lib/bulk_imports/projects/pipelines/issues_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/projects/pipelines/issues_pipeline_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe BulkImports::Projects::Pipelines::IssuesPipeline do
project: project,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Project',
+ destination_slug: 'My-Destination-Project',
destination_namespace: group.full_path
)
end
diff --git a/spec/lib/bulk_imports/projects/pipelines/merge_requests_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/merge_requests_pipeline_spec.rb
index e780cde4ae2..5b85b3eee79 100644
--- a/spec/lib/bulk_imports/projects/pipelines/merge_requests_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/projects/pipelines/merge_requests_pipeline_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe BulkImports::Projects::Pipelines::MergeRequestsPipeline do
project: project,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Project',
+ destination_slug: 'My-Destination-Project',
destination_namespace: group.full_path
)
end
diff --git a/spec/lib/bulk_imports/projects/pipelines/pipeline_schedules_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/pipeline_schedules_pipeline_spec.rb
index 12713f008bb..0bfd9410808 100644
--- a/spec/lib/bulk_imports/projects/pipelines/pipeline_schedules_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/projects/pipelines/pipeline_schedules_pipeline_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe BulkImports::Projects::Pipelines::PipelineSchedulesPipeline do
project: project,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Project',
+ destination_slug: 'My-Destination-Project',
destination_namespace: group.full_path
)
end
diff --git a/spec/lib/bulk_imports/projects/pipelines/project_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/project_pipeline_spec.rb
index 567a0a4fcc3..09385a261b6 100644
--- a/spec/lib/bulk_imports/projects/pipelines/project_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/projects/pipelines/project_pipeline_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe BulkImports::Projects::Pipelines::ProjectPipeline do
source_type: :project_entity,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Project',
+ destination_slug: 'My-Destination-Project',
destination_namespace: group.full_path
)
end
diff --git a/spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb
index a376cdd712c..339ca727b57 100644
--- a/spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe BulkImports::Projects::Pipelines::ReleasesPipeline do
project: project,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Project',
+ destination_slug: 'My-Destination-Project',
destination_namespace: group.full_path
)
end
diff --git a/spec/lib/bulk_imports/projects/pipelines/repository_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/repository_pipeline_spec.rb
index a968104fc91..0cc8da80a61 100644
--- a/spec/lib/bulk_imports/projects/pipelines/repository_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/projects/pipelines/repository_pipeline_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe BulkImports::Projects::Pipelines::RepositoryPipeline do
+RSpec.describe BulkImports::Projects::Pipelines::RepositoryPipeline, feature_category: :importers do
let_it_be(:user) { create(:user) }
let_it_be(:parent) { create(:project) }
let_it_be(:bulk_import) { create(:bulk_import, user: user) }
@@ -14,7 +14,7 @@ RSpec.describe BulkImports::Projects::Pipelines::RepositoryPipeline do
:project_entity,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Repository',
+ destination_slug: 'My-Destination-Repository',
destination_namespace: parent.full_path,
project: parent
)
diff --git a/spec/lib/bulk_imports/projects/pipelines/snippets_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/snippets_pipeline_spec.rb
index dae879de998..41b3ea37804 100644
--- a/spec/lib/bulk_imports/projects/pipelines/snippets_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/projects/pipelines/snippets_pipeline_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe BulkImports::Projects::Pipelines::SnippetsPipeline do
project: project,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Project',
+ destination_slug: 'My-Destination-Project',
destination_namespace: group.full_path
)
end
diff --git a/spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb
index dfd01cdf4bb..56c0f8c8807 100644
--- a/spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe BulkImports::Projects::Pipelines::SnippetsRepositoryPipeline do
project: project,
bulk_import: bulk_import_configuration.bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'My Destination Project',
+ destination_slug: 'My-Destination-Project',
destination_namespace: project.full_path
)
end
diff --git a/spec/lib/bulk_imports/projects/transformers/project_attributes_transformer_spec.rb b/spec/lib/bulk_imports/projects/transformers/project_attributes_transformer_spec.rb
index a62d82da35d..36dc63a9331 100644
--- a/spec/lib/bulk_imports/projects/transformers/project_attributes_transformer_spec.rb
+++ b/spec/lib/bulk_imports/projects/transformers/project_attributes_transformer_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe BulkImports::Projects::Transformers::ProjectAttributesTransformer
source_type: :project_entity,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_slug: 'Destination Project Name',
+ destination_slug: 'Destination-Project-Name',
destination_namespace: destination_namespace
)
end
@@ -58,7 +58,7 @@ RSpec.describe BulkImports::Projects::Transformers::ProjectAttributesTransformer
source_type: :project_entity,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_slug: 'Destination Project Name',
+ destination_slug: 'Destination-Project-Name',
destination_namespace: ''
)
diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb
index 353b8eb7edb..0def40bd4e4 100644
--- a/spec/lib/gitlab/regex_spec.rb
+++ b/spec/lib/gitlab/regex_spec.rb
@@ -21,6 +21,7 @@ RSpec.describe Gitlab::Regex, feature_category: :tooling do
it_behaves_like 'project/group name chars regex'
it { is_expected.not_to match('?gitlab') }
it { is_expected.not_to match("Users's something") }
+ it { is_expected.not_to match('users/something') }
end
shared_examples_for 'project name regex' do
@@ -28,6 +29,7 @@ RSpec.describe Gitlab::Regex, feature_category: :tooling do
it { is_expected.to match("Gitlab++") }
it { is_expected.not_to match('?gitlab') }
it { is_expected.not_to match("Users's something") }
+ it { is_expected.not_to match('users/something') }
end
describe '.project_name_regex' do
@@ -72,8 +74,47 @@ RSpec.describe Gitlab::Regex, feature_category: :tooling do
it { is_expected.to eq("can contain only letters, digits, emojis, '_', '.', dash, space, parenthesis. It must start with letter, digit, emoji or '_'.") }
end
- describe '.bulk_import_namespace_path_regex' do
- subject { described_class.bulk_import_namespace_path_regex }
+ describe '.bulk_import_destination_namespace_path_regex_message' do
+ subject { described_class.bulk_import_destination_namespace_path_regex_message }
+
+ it {
+ is_expected
+ .to eq("cannot start with a non-alphanumeric character except for periods or underscores, " \
+ "can contain only alphanumeric characters, forward slashes, periods, and underscores, " \
+ "cannot end with a period or forward slash, and has a relative path structure " \
+ "with no http protocol chars or leading or trailing forward slashes")
+ }
+ end
+
+ describe '.bulk_import_destination_namespace_path_regex' do
+ subject { described_class.bulk_import_destination_namespace_path_regex }
+
+ it { is_expected.not_to match('?gitlab') }
+ it { is_expected.not_to match("Users's something") }
+ it { is_expected.not_to match('/source') }
+ it { is_expected.not_to match('http:') }
+ it { is_expected.not_to match('https:') }
+ it { is_expected.not_to match('example.com/?stuff=true') }
+ it { is_expected.not_to match('example.com:5000/?stuff=true') }
+ it { is_expected.not_to match('http://gitlab.example/gitlab-org/manage/import/gitlab-migration-test') }
+ it { is_expected.not_to match('_good_for_me!') }
+ it { is_expected.not_to match('good_for+you') }
+ it { is_expected.not_to match('source/') }
+ it { is_expected.not_to match('.source/full./path') }
+
+ it { is_expected.to match('source') }
+ it { is_expected.to match('.source') }
+ it { is_expected.to match('_source') }
+ it { is_expected.to match('source/full') }
+ it { is_expected.to match('source/full/path') }
+ it { is_expected.to match('.source/.full/.path') }
+ it { is_expected.to match('domain_namespace') }
+ it { is_expected.to match('gitlab-migration-test') }
+ it { is_expected.to match('') } # it is possible to pass an empty string for destination_namespace in bulk_import POST request
+ end
+
+ describe '.bulk_import_source_full_path_regex' do
+ subject { described_class.bulk_import_source_full_path_regex }
it { is_expected.not_to match('?gitlab') }
it { is_expected.not_to match("Users's something") }
@@ -87,6 +128,7 @@ RSpec.describe Gitlab::Regex, feature_category: :tooling do
it { is_expected.not_to match('good_for+you') }
it { is_expected.not_to match('source/') }
it { is_expected.not_to match('.source/full./path') }
+ it { is_expected.not_to match('') }
it { is_expected.to match('source') }
it { is_expected.to match('.source') }
diff --git a/spec/models/bulk_imports/entity_spec.rb b/spec/models/bulk_imports/entity_spec.rb
index dd947b5abb3..56796aa1fe4 100644
--- a/spec/models/bulk_imports/entity_spec.rb
+++ b/spec/models/bulk_imports/entity_spec.rb
@@ -17,6 +17,38 @@ RSpec.describe BulkImports::Entity, type: :model, feature_category: :importers d
it { is_expected.to define_enum_for(:source_type).with_values(%i[group_entity project_entity]) }
+ context 'when formatting with regexes' do
+ subject { described_class.new(group: Group.new) }
+
+ it { is_expected.to allow_values('namespace', 'parent/namespace', 'parent/group/subgroup', '').for(:destination_namespace) }
+ it { is_expected.not_to allow_values('parent/namespace/', '/namespace', 'parent group/subgroup', '@namespace').for(:destination_namespace) }
+
+ it { is_expected.to allow_values('source', 'source/path', 'source/full/path').for(:source_full_path) }
+ it { is_expected.not_to allow_values('/source', 'http://source/path', 'sou rce/full/path', '').for(:source_full_path) }
+
+ it { is_expected.to allow_values('destination', 'destination-slug', 'new-destination-slug').for(:destination_slug) }
+
+ # it { is_expected.not_to allow_values('destination/slug', '/destination-slug', 'destination slug').for(:destination_slug) } <-- this test should
+ # succeed but it's failing possibly due to rspec caching. To ensure this case is covered see the more cumbersome test below:
+ context 'when destination_slug is invalid' do
+ let(:invalid_slugs) { ['destination/slug', '/destination-slug', 'destination slug'] }
+ let(:error_message) do
+ 'cannot start with a non-alphanumeric character except for periods or underscores, ' \
+ 'can contain only alphanumeric characters, periods, and underscores, ' \
+ 'cannot end with a period or forward slash, and has no ' \
+ 'leading or trailing forward slashes'
+ end
+
+ it 'raises an error' do
+ invalid_slugs.each do |slug|
+ entity = build(:bulk_import_entity, :group_entity, group: build(:group), project: nil, destination_slug: slug)
+ expect(entity).not_to be_valid
+ expect(entity.errors.errors[0].message).to include(error_message)
+ end
+ end
+ end
+ end
+
context 'when associated with a group and project' do
it 'is invalid' do
entity = build(:bulk_import_entity, group: build(:group), project: build(:project))
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index a3982263de8..2b0791323ff 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -2,16 +2,16 @@
require 'spec_helper'
-RSpec.describe Ci::Build, feature_category: :continuous_integration do
+RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_default: :keep do
include Ci::TemplateHelpers
include AfterNextHelpers
let_it_be(:user) { create(:user) }
- let_it_be(:group, reload: true) { create(:group) }
- let_it_be(:project, reload: true) { create(:project, :repository, group: group) }
+ let_it_be(:group, reload: true) { create_default(:group) }
+ let_it_be(:project, reload: true) { create_default(:project, :repository, group: group) }
let_it_be(:pipeline, reload: true) do
- create(:ci_pipeline, project: project,
+ create_default(:ci_pipeline, project: project,
sha: project.commit.id,
ref: project.default_branch,
status: 'success')
@@ -904,9 +904,7 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration do
subject(:locked_artifacts) { build.locked_artifacts? }
context 'when pipeline is artifacts_locked' do
- before do
- build.pipeline.artifacts_locked!
- end
+ let(:pipeline) { create(:ci_pipeline, locked: :artifacts_locked) }
context 'artifacts archive does not exist' do
let(:build) { create(:ci_build, pipeline: pipeline) }
@@ -922,9 +920,7 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration do
end
context 'when pipeline is unlocked' do
- before do
- build.pipeline.unlocked!
- end
+ let(:pipeline) { create(:ci_pipeline, locked: :unlocked) }
context 'artifacts archive does not exist' do
let(:build) { create(:ci_build, pipeline: pipeline) }
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb
index 7e4354221fa..1a255379098 100644
--- a/spec/models/group_spec.rb
+++ b/spec/models/group_spec.rb
@@ -3549,13 +3549,6 @@ RSpec.describe Group, feature_category: :subgroups do
end
end
- describe '#work_items_create_from_markdown_feature_flag_enabled?' do
- it_behaves_like 'checks self and root ancestor feature flag' do
- let(:feature_flag) { :work_items_create_from_markdown }
- let(:feature_flag_method) { :work_items_create_from_markdown_feature_flag_enabled? }
- end
- end
-
describe 'group shares' do
let!(:sub_group) { create(:group, parent: group) }
let!(:sub_sub_group) { create(:group, parent: sub_group) }
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index f277dd054ee..9d6ab7d6137 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -8449,16 +8449,6 @@ RSpec.describe Project, factory_default: :keep, feature_category: :projects do
end
end
- describe '#work_items_create_from_markdown_feature_flag_enabled?' do
- let_it_be(:group_project) { create(:project, :in_subgroup) }
-
- it_behaves_like 'checks parent group feature flag' do
- let(:feature_flag_method) { :work_items_create_from_markdown_feature_flag_enabled? }
- let(:feature_flag) { :work_items_create_from_markdown }
- let(:subject_project) { group_project }
- end
- end
-
describe 'serialization' do
let(:object) { build(:project) }
diff --git a/spec/presenters/user_presenter_spec.rb b/spec/presenters/user_presenter_spec.rb
index 883eec68304..d1124d73dbd 100644
--- a/spec/presenters/user_presenter_spec.rb
+++ b/spec/presenters/user_presenter_spec.rb
@@ -17,6 +17,14 @@ RSpec.describe UserPresenter do
it { expect(presenter.web_url).to eq("http://localhost/#{user.username}") }
end
+ describe '#can?' do
+ it 'forwards call to the given user' do
+ expect(user).to receive(:can?).with("a", b: 24)
+
+ presenter.send(:can?, "a", b: 24)
+ end
+ end
+
context 'Gitpod' do
let(:gitpod_url) { "https://gitpod.io" }
let(:gitpod_application_enabled) { true }
diff --git a/spec/services/bulk_imports/create_service_spec.rb b/spec/services/bulk_imports/create_service_spec.rb
index 3086184c5b3..7f892cfe722 100644
--- a/spec/services/bulk_imports/create_service_spec.rb
+++ b/spec/services/bulk_imports/create_service_spec.rb
@@ -8,6 +8,7 @@ RSpec.describe BulkImports::CreateService, feature_category: :importers do
let(:destination_group) { create(:group, path: 'destination1') }
let(:migrate_projects) { true }
let_it_be(:parent_group) { create(:group, path: 'parent-group') }
+ # note: destination_name and destination_slug are currently interchangable so we need to test for both possibilities
let(:params) do
[
{
@@ -20,7 +21,7 @@ RSpec.describe BulkImports::CreateService, feature_category: :importers do
{
source_type: 'group_entity',
source_full_path: 'full/path/to/group2',
- destination_slug: 'destination-group-2',
+ destination_name: 'destination-group-2',
destination_namespace: 'parent-group',
migrate_projects: migrate_projects
},
@@ -225,7 +226,12 @@ RSpec.describe BulkImports::CreateService, feature_category: :importers do
expect(result).to be_a(ServiceResponse)
expect(result).to be_error
- expect(result.message).to eq("Validation failed: Source full path can't be blank")
+ expect(result.message).to eq("Validation failed: Source full path can't be blank, " \
+ "Source full path cannot start with a non-alphanumeric character except " \
+ "for periods or underscores, can contain only alphanumeric characters, " \
+ "forward slashes, periods, and underscores, cannot end with " \
+ "a period or forward slash, and has a relative path structure " \
+ "with no http protocol chars or leading or trailing forward slashes")
end
describe '#user-role' do
diff --git a/spec/support/helpers/features/sorting_helpers.rb b/spec/support/helpers/features/sorting_helpers.rb
index 50b8083ebb3..504a9b764cf 100644
--- a/spec/support/helpers/features/sorting_helpers.rb
+++ b/spec/support/helpers/features/sorting_helpers.rb
@@ -26,8 +26,8 @@ module Spec
# all of the dropdowns are converted, pajamas_sort_by can be renamed to sort_by
# https://gitlab.com/groups/gitlab-org/-/epics/7551
def pajamas_sort_by(value)
- find('.filter-dropdown-container .dropdown').click
- find('.dropdown-item', text: value).click
+ find('.filter-dropdown-container .gl-new-dropdown').click
+ find('.gl-new-dropdown-item', text: value).click
end
end
end
diff --git a/spec/support/helpers/listbox_helpers.rb b/spec/support/helpers/listbox_helpers.rb
index c23927bb0c0..e943790fc65 100644
--- a/spec/support/helpers/listbox_helpers.rb
+++ b/spec/support/helpers/listbox_helpers.rb
@@ -7,18 +7,18 @@ module ListboxHelpers
end
def select_listbox_item(text, exact_text: false)
- find('.gl-dropdown-item[role="option"]', text: text, exact_text: exact_text).click
+ find('.gl-new-dropdown-item[role="option"]', text: text, exact_text: exact_text).click
end
def expect_listbox_item(text)
- expect(page).to have_css('.gl-dropdown-item[role="option"]', text: text)
+ expect(page).to have_css('.gl-new-dropdown-item[role="option"]', text: text)
end
def expect_no_listbox_item(text)
- expect(page).not_to have_css('.gl-dropdown-item[role="option"]', text: text)
+ expect(page).not_to have_css('.gl-new-dropdown-item[role="option"]', text: text)
end
def expect_listbox_items(items)
- expect(find_all('.gl-dropdown-item[role="option"]').map(&:text)).to eq(items)
+ expect(find_all('.gl-new-dropdown-item[role="option"]').map(&:text)).to eq(items)
end
end
diff --git a/spec/support/shared_examples/features/creatable_merge_request_shared_examples.rb b/spec/support/shared_examples/features/creatable_merge_request_shared_examples.rb
index 3941a239c51..96e57980c68 100644
--- a/spec/support/shared_examples/features/creatable_merge_request_shared_examples.rb
+++ b/spec/support/shared_examples/features/creatable_merge_request_shared_examples.rb
@@ -2,6 +2,7 @@
RSpec.shared_examples 'a creatable merge request' do
include WaitForRequests
+ include ListboxHelpers
it 'creates new merge request', :js do
find('.js-assignee-search').click
@@ -64,7 +65,7 @@ RSpec.shared_examples 'a creatable merge request' do
visit project_new_merge_request_path(source_project)
first('.js-target-project').click
- find('.gl-dropdown-item', text: target_project.full_path).click
+ select_listbox_item(target_project.full_path)
wait_for_requests
@@ -74,6 +75,6 @@ RSpec.shared_examples 'a creatable merge request' do
wait_for_requests
- expect(page).to have_selector('.gl-dropdown-item', text: 'a-brand-new-branch-to-test')
+ expect_listbox_item('a-brand-new-branch-to-test')
end
end