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>2022-02-23 18:12:28 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-23 18:12:28 +0300
commit98014c0c43c1b1114d17c5851cd6313a9011d3ab (patch)
tree405bb6fb3e3e1bbdad0be2e4de43e353db8aeebd /spec
parent3f274363e9dc9a1be75edfcd3dd5adb64b1e8c29 (diff)
Add latest changes from gitlab-org/gitlab@14-8-stable-ee
Diffstat (limited to 'spec')
-rw-r--r--spec/factories/users.rb4
-rw-r--r--spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb22
-rw-r--r--spec/features/merge_request/user_sees_pipelines_spec.rb6
-rw-r--r--spec/features/projects/pipelines/pipelines_spec.rb2
-rw-r--r--spec/frontend/pipelines/mock_data.js175
-rw-r--r--spec/frontend/pipelines/pipeline_url_spec.js37
-rw-r--r--spec/frontend/vue_shared/components/markdown/header_spec.js7
-rw-r--r--spec/lib/backup/artifacts_spec.rb14
-rw-r--r--spec/lib/backup/lfs_spec.rb1
-rw-r--r--spec/lib/backup/manager_spec.rb5
-rw-r--r--spec/lib/backup/object_backup_spec.rb1
-rw-r--r--spec/lib/backup/pages_spec.rb6
-rw-r--r--spec/lib/backup/uploads_spec.rb16
-rw-r--r--spec/services/quick_actions/interpret_service_spec.rb32
14 files changed, 43 insertions, 285 deletions
diff --git a/spec/factories/users.rb b/spec/factories/users.rb
index 5f325717ec5..8764ac90af8 100644
--- a/spec/factories/users.rb
+++ b/spec/factories/users.rb
@@ -19,6 +19,10 @@ FactoryBot.define do
public_email { email }
end
+ trait :private_profile do
+ private_profile { true }
+ end
+
trait :blocked do
after(:build) { |user, _| user.block! }
end
diff --git a/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb b/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb
index b77b3d69fc1..2a49109d360 100644
--- a/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb
+++ b/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb
@@ -64,7 +64,7 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request',
it 'sees branch pipelines and detached merge request pipelines in correct order' do
page.within('.ci-table') do
expect(page).to have_selector('.ci-created', count: 2)
- expect(first('[data-testid="pipeline-identifier"]')).to have_content("##{detached_merge_request_pipeline.id}")
+ expect(first('[data-testid="pipeline-url-link"]')).to have_content("##{detached_merge_request_pipeline.id}")
end
end
@@ -101,16 +101,16 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request',
page.within('.ci-table') do
expect(page).to have_selector('.ci-pending', count: 4)
- expect(all('[data-testid="pipeline-identifier"]')[0])
+ expect(all('[data-testid="pipeline-url-link"]')[0])
.to have_content("##{detached_merge_request_pipeline_2.id}")
- expect(all('[data-testid="pipeline-identifier"]')[1])
+ expect(all('[data-testid="pipeline-url-link"]')[1])
.to have_content("##{detached_merge_request_pipeline.id}")
- expect(all('[data-testid="pipeline-identifier"]')[2])
+ expect(all('[data-testid="pipeline-url-link"]')[2])
.to have_content("##{push_pipeline_2.id}")
- expect(all('[data-testid="pipeline-identifier"]')[3])
+ expect(all('[data-testid="pipeline-url-link"]')[3])
.to have_content("##{push_pipeline.id}")
end
end
@@ -201,7 +201,7 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request',
it 'sees a branch pipeline in pipeline tab' do
page.within('.ci-table') do
expect(page).to have_selector('.ci-created', count: 1)
- expect(first('[data-testid="pipeline-identifier"]')).to have_content("##{push_pipeline.id}")
+ expect(first('[data-testid="pipeline-url-link"]')).to have_content("##{push_pipeline.id}")
end
end
@@ -252,7 +252,7 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request',
it 'sees branch pipelines and detached merge request pipelines in correct order' do
page.within('.ci-table') do
expect(page).to have_selector('.ci-pending', count: 2)
- expect(first('[data-testid="pipeline-identifier"]')).to have_content("##{detached_merge_request_pipeline.id}")
+ expect(first('[data-testid="pipeline-url-link"]')).to have_content("##{detached_merge_request_pipeline.id}")
end
end
@@ -295,16 +295,16 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request',
page.within('.ci-table') do
expect(page).to have_selector('.ci-pending', count: 4)
- expect(all('[data-testid="pipeline-identifier"]')[0])
+ expect(all('[data-testid="pipeline-url-link"]')[0])
.to have_content("##{detached_merge_request_pipeline_2.id}")
- expect(all('[data-testid="pipeline-identifier"]')[1])
+ expect(all('[data-testid="pipeline-url-link"]')[1])
.to have_content("##{detached_merge_request_pipeline.id}")
- expect(all('[data-testid="pipeline-identifier"]')[2])
+ expect(all('[data-testid="pipeline-url-link"]')[2])
.to have_content("##{push_pipeline_2.id}")
- expect(all('[data-testid="pipeline-identifier"]')[3])
+ expect(all('[data-testid="pipeline-url-link"]')[3])
.to have_content("##{push_pipeline.id}")
end
end
diff --git a/spec/features/merge_request/user_sees_pipelines_spec.rb b/spec/features/merge_request/user_sees_pipelines_spec.rb
index a356dd50898..266ae0d8c37 100644
--- a/spec/features/merge_request/user_sees_pipelines_spec.rb
+++ b/spec/features/merge_request/user_sees_pipelines_spec.rb
@@ -134,7 +134,7 @@ RSpec.describe 'Merge request > User sees pipelines', :js do
create_merge_request_pipeline
act_on_security_warning(action: 'Run pipeline')
- check_pipeline(expected_project: parent_project, link_selector: 'pipeline-url-link')
+ check_pipeline(expected_project: parent_project)
check_head_pipeline(expected_project: parent_project)
end
@@ -179,13 +179,13 @@ RSpec.describe 'Merge request > User sees pipelines', :js do
click_button('Run pipeline')
end
- def check_pipeline(expected_project:, link_selector: 'commit-title')
+ def check_pipeline(expected_project:)
page.within('.ci-table') do
expect(page).to have_selector('.commit', count: 2)
page.within(first('.commit')) do
page.within('.pipeline-tags') do
- expect(page.find("[data-testid=#{link_selector}]")[:href]).to include(expected_project.full_path)
+ expect(page.find('[data-testid="pipeline-url-link"]')[:href]).to include(expected_project.full_path)
expect(page).to have_content('detached')
end
page.within('.pipeline-triggerer') do
diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb
index d5b470194a2..37ac5a9d5a2 100644
--- a/spec/features/projects/pipelines/pipelines_spec.rb
+++ b/spec/features/projects/pipelines/pipelines_spec.rb
@@ -711,7 +711,7 @@ RSpec.describe 'Pipelines', :js do
end
expect(page.find('[data-testid="pipeline-th"]')).to have_content 'Pipeline'
- expect(page.find('[data-testid="pipeline-identifier"]')).to have_content "##{pipeline.iid}"
+ expect(page.find('[data-testid="pipeline-url-link"]')).to have_content "##{pipeline.iid}"
end
end
end
diff --git a/spec/frontend/pipelines/mock_data.js b/spec/frontend/pipelines/mock_data.js
index 8cb6cf3bed6..59d4e808b32 100644
--- a/spec/frontend/pipelines/mock_data.js
+++ b/spec/frontend/pipelines/mock_data.js
@@ -676,7 +676,7 @@ export const mockPipeline = (projectPath) => {
short_id: 'fd6df5b3',
created_at: '2021-10-19T21:17:12.000+00:00',
parent_ids: ['7147906b84306e83cb3fec6582a25390b75713c6'],
- title: 'Commit Title',
+ title: 'Commit',
message: 'Commit',
author_name: 'Administrator',
author_email: 'admin@example.com',
@@ -1141,176 +1141,3 @@ export const mockPipelineBranch = () => {
viewType: 'root',
};
};
-
-export const mockPipelineNoCommit = () => {
- return {
- pipeline: {
- id: 268,
- iid: 34,
- user: {
- id: 1,
- username: 'root',
- name: 'Administrator',
- state: 'active',
- avatar_url:
- 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
- web_url: 'http://gdk.test:3000/root',
- show_status: false,
- path: '/root',
- },
- active: false,
- source: 'push',
- created_at: '2022-01-14T17:40:27.866Z',
- updated_at: '2022-01-14T18:02:35.850Z',
- path: '/root/mr-widgets/-/pipelines/268',
- flags: {
- stuck: false,
- auto_devops: false,
- merge_request: false,
- yaml_errors: false,
- retryable: true,
- cancelable: false,
- failure_reason: false,
- detached_merge_request_pipeline: false,
- merge_request_pipeline: false,
- merge_train_pipeline: false,
- latest: true,
- },
- details: {
- status: {
- icon: 'status_warning',
- text: 'passed',
- label: 'passed with warnings',
- group: 'success-with-warnings',
- tooltip: 'passed',
- has_details: true,
- details_path: '/root/mr-widgets/-/pipelines/268',
- illustration: null,
- favicon:
- '/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png',
- },
- stages: [
- {
- name: 'validate',
- title: 'validate: passed with warnings',
- status: {
- icon: 'status_warning',
- text: 'passed',
- label: 'passed with warnings',
- group: 'success-with-warnings',
- tooltip: 'passed',
- has_details: true,
- details_path: '/root/mr-widgets/-/pipelines/268#validate',
- illustration: null,
- favicon:
- '/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png',
- },
- path: '/root/mr-widgets/-/pipelines/268#validate',
- dropdown_path: '/root/mr-widgets/-/pipelines/268/stage.json?stage=validate',
- },
- {
- name: 'test',
- title: 'test: passed',
- status: {
- icon: 'status_success',
- text: 'passed',
- label: 'passed',
- group: 'success',
- tooltip: 'passed',
- has_details: true,
- details_path: '/root/mr-widgets/-/pipelines/268#test',
- illustration: null,
- favicon:
- '/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png',
- },
- path: '/root/mr-widgets/-/pipelines/268#test',
- dropdown_path: '/root/mr-widgets/-/pipelines/268/stage.json?stage=test',
- },
- {
- name: 'build',
- title: 'build: passed',
- status: {
- icon: 'status_success',
- text: 'passed',
- label: 'passed',
- group: 'success',
- tooltip: 'passed',
- has_details: true,
- details_path: '/root/mr-widgets/-/pipelines/268#build',
- illustration: null,
- favicon:
- '/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png',
- },
- path: '/root/mr-widgets/-/pipelines/268#build',
- dropdown_path: '/root/mr-widgets/-/pipelines/268/stage.json?stage=build',
- },
- ],
- duration: 75,
- finished_at: '2022-01-14T18:02:35.842Z',
- name: 'Pipeline',
- manual_actions: [],
- scheduled_actions: [],
- },
- ref: {
- name: 'update-ci',
- path: '/root/mr-widgets/-/commits/update-ci',
- tag: false,
- branch: true,
- merge_request: false,
- },
- retry_path: '/root/mr-widgets/-/pipelines/268/retry',
- delete_path: '/root/mr-widgets/-/pipelines/268',
- failed_builds: [
- {
- id: 1260,
- name: 'fmt',
- started: '2022-01-14T17:40:36.435Z',
- complete: true,
- archived: false,
- build_path: '/root/mr-widgets/-/jobs/1260',
- retry_path: '/root/mr-widgets/-/jobs/1260/retry',
- playable: false,
- scheduled: false,
- created_at: '2022-01-14T17:40:27.879Z',
- updated_at: '2022-01-14T17:40:42.129Z',
- status: {
- icon: 'status_warning',
- text: 'failed',
- label: 'failed (allowed to fail)',
- group: 'failed-with-warnings',
- tooltip: 'failed - (script failure) (allowed to fail)',
- has_details: true,
- details_path: '/root/mr-widgets/-/jobs/1260',
- illustration: {
- image:
- '/assets/illustrations/skipped-job_empty-29a8a37d8a61d1b6f68cf3484f9024e53cd6eb95e28eae3554f8011a1146bf27.svg',
- size: 'svg-430',
- title: 'This job does not have a trace.',
- },
- favicon:
- '/assets/ci_favicons/favicon_status_failed-41304d7f7e3828808b0c26771f0309e55296819a9beea3ea9fbf6689d9857c12.png',
- action: {
- icon: 'retry',
- title: 'Retry',
- path: '/root/mr-widgets/-/jobs/1260/retry',
- method: 'post',
- button_title: 'Retry this job',
- },
- },
- recoverable: false,
- },
- ],
- project: {
- id: 23,
- name: 'mr-widgets',
- full_path: '/root/mr-widgets',
- full_name: 'Administrator / mr-widgets',
- },
- triggered_by: null,
- triggered: [],
- },
- pipelineScheduleUrl: 'foo',
- pipelineKey: 'id',
- viewType: 'root',
- };
-};
diff --git a/spec/frontend/pipelines/pipeline_url_spec.js b/spec/frontend/pipelines/pipeline_url_spec.js
index b24e2e09ea8..2f083faaaa6 100644
--- a/spec/frontend/pipelines/pipeline_url_spec.js
+++ b/spec/frontend/pipelines/pipeline_url_spec.js
@@ -1,12 +1,7 @@
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import { trimText } from 'helpers/text_helper';
import PipelineUrlComponent from '~/pipelines/components/pipelines_list/pipeline_url.vue';
-import {
- mockPipeline,
- mockPipelineBranch,
- mockPipelineTag,
- mockPipelineNoCommit,
-} from './mock_data';
+import { mockPipeline, mockPipelineBranch, mockPipelineTag } from './mock_data';
const projectPath = 'test/test';
@@ -31,7 +26,7 @@ describe('Pipeline Url Component', () => {
const findCommitIconType = () => wrapper.findByTestId('commit-icon-type');
const findCommitTitleContainer = () => wrapper.findByTestId('commit-title-container');
- const findCommitTitle = () => wrapper.findByTestId('commit-title');
+ const findCommitTitle = (commitWrapper) => commitWrapper.find('[data-testid="commit-title"]');
const defaultProps = mockPipeline(projectPath);
@@ -237,33 +232,5 @@ describe('Pipeline Url Component', () => {
expect(findCommitIconType().attributes('title')).toBe(expectedTitle);
},
);
-
- describe('with commit', () => {
- beforeEach(() => {
- createComponent({}, true);
- });
-
- it('displays commit title with link to pipeline', () => {
- expect(findCommitTitle().attributes('href')).toBe(defaultProps.pipeline.path);
- });
-
- it('displays commit title text', () => {
- expect(findCommitTitle().text()).toBe(defaultProps.pipeline.commit.title);
- });
- });
-
- describe('without commit', () => {
- beforeEach(() => {
- createComponent(mockPipelineNoCommit(), true);
- });
-
- it('displays cant find head commit text', () => {
- expect(findCommitTitle().text()).toBe("Can't find HEAD commit for this branch");
- });
-
- it('displays link to pipeline', () => {
- expect(findCommitTitle().attributes('href')).toBe(mockPipelineNoCommit().pipeline.path);
- });
- });
});
});
diff --git a/spec/frontend/vue_shared/components/markdown/header_spec.js b/spec/frontend/vue_shared/components/markdown/header_spec.js
index 93ce3935fab..700ec75fcee 100644
--- a/spec/frontend/vue_shared/components/markdown/header_spec.js
+++ b/spec/frontend/vue_shared/components/markdown/header_spec.js
@@ -20,6 +20,7 @@ describe('Markdown field header component', () => {
const findWriteTab = () => wrapper.findByTestId('write-tab');
const findPreviewTab = () => wrapper.findByTestId('preview-tab');
+ const findToolbar = () => wrapper.findByTestId('md-header-toolbar');
const findToolbarButtons = () => wrapper.findAll(ToolbarButton);
const findToolbarButtonByProp = (prop, value) =>
findToolbarButtons()
@@ -90,6 +91,12 @@ describe('Markdown field header component', () => {
expect(findPreviewTab().attributes('active')).toBe('true');
});
+ it('hides toolbar in preview mode', () => {
+ createWrapper({ previewMarkdown: true });
+
+ expect(findToolbar().classes().includes('gl-display-none')).toBe(true);
+ });
+
it('emits toggle markdown event when clicking preview tab', async () => {
const eventData = { target: {} };
findPreviewTab().vm.$emit('click', eventData);
diff --git a/spec/lib/backup/artifacts_spec.rb b/spec/lib/backup/artifacts_spec.rb
index 102d787a5e1..e65dc79b65b 100644
--- a/spec/lib/backup/artifacts_spec.rb
+++ b/spec/lib/backup/artifacts_spec.rb
@@ -7,16 +7,6 @@ RSpec.describe Backup::Artifacts do
subject(:backup) { described_class.new(progress) }
- describe '#initialize' do
- it 'uses the correct upload dir' do
- Dir.mktmpdir do |tmpdir|
- allow(JobArtifactUploader).to receive(:root) { "#{tmpdir}" }
-
- expect(backup.app_files_dir).to eq("#{File.realpath(tmpdir)}")
- end
- end
- end
-
describe '#dump' do
before do
allow(File).to receive(:realpath).with('/var/gitlab-artifacts').and_return('/var/gitlab-artifacts')
@@ -24,10 +14,6 @@ RSpec.describe Backup::Artifacts do
allow(JobArtifactUploader).to receive(:root) { '/var/gitlab-artifacts' }
end
- it 'uses the correct artifact dir' do
- expect(backup.app_files_dir).to eq('/var/gitlab-artifacts')
- end
-
it 'excludes tmp from backup tar' do
expect(backup).to receive(:tar).and_return('blabla-tar')
expect(backup).to receive(:run_pipeline!).with([%w(blabla-tar --exclude=lost+found --exclude=./tmp -C /var/gitlab-artifacts -cf - .), 'gzip -c -1'], any_args).and_return([[true, true], ''])
diff --git a/spec/lib/backup/lfs_spec.rb b/spec/lib/backup/lfs_spec.rb
index fdc1c0c885d..6525019d9ac 100644
--- a/spec/lib/backup/lfs_spec.rb
+++ b/spec/lib/backup/lfs_spec.rb
@@ -16,7 +16,6 @@ RSpec.describe Backup::Lfs do
end
it 'uses the correct lfs dir in tar command', :aggregate_failures do
- expect(backup.app_files_dir).to eq('/var/lfs-objects')
expect(backup).to receive(:tar).and_return('blabla-tar')
expect(backup).to receive(:run_pipeline!).with([%w(blabla-tar --exclude=lost+found -C /var/lfs-objects -cf - .), 'gzip -c -1'], any_args).and_return([[true, true], ''])
expect(backup).to receive(:pipeline_succeeded?).and_return(true)
diff --git a/spec/lib/backup/manager_spec.rb b/spec/lib/backup/manager_spec.rb
index ac693ad8b98..9c186205067 100644
--- a/spec/lib/backup/manager_spec.rb
+++ b/spec/lib/backup/manager_spec.rb
@@ -12,11 +12,6 @@ RSpec.describe Backup::Manager do
before do
allow(progress).to receive(:puts)
allow(progress).to receive(:print)
- FileUtils.mkdir_p('tmp/tests/public/uploads')
- end
-
- after do
- FileUtils.rm_rf('tmp/tests/public/uploads', secure: true)
end
describe '#pack' do
diff --git a/spec/lib/backup/object_backup_spec.rb b/spec/lib/backup/object_backup_spec.rb
index 6192b5c3482..4d34dc0ade7 100644
--- a/spec/lib/backup/object_backup_spec.rb
+++ b/spec/lib/backup/object_backup_spec.rb
@@ -17,7 +17,6 @@ RSpec.shared_examples 'backup object' do |setting|
end
it 'uses the correct storage dir in tar command and excludes tmp', :aggregate_failures do
- expect(backup.app_files_dir).to eq(backup_path)
expect(backup).to receive(:tar).and_return('blabla-tar')
expect(backup).to receive(:run_pipeline!).with([%W(blabla-tar --exclude=lost+found --exclude=./tmp -C #{backup_path} -cf - .), 'gzip -c -1'], any_args).and_return([[true, true], ''])
expect(backup).to receive(:pipeline_succeeded?).and_return(true)
diff --git a/spec/lib/backup/pages_spec.rb b/spec/lib/backup/pages_spec.rb
index 551d2df8f30..f9ee4bbdc41 100644
--- a/spec/lib/backup/pages_spec.rb
+++ b/spec/lib/backup/pages_spec.rb
@@ -13,12 +13,6 @@ RSpec.describe Backup::Pages do
end
describe '#dump' do
- it 'uses the correct pages dir' do
- allow(Gitlab.config.pages).to receive(:path) { '/var/gitlab-pages' }
-
- expect(subject.app_files_dir).to eq('/var/gitlab-pages')
- end
-
it 'excludes tmp from backup tar' do
allow(Gitlab.config.pages).to receive(:path) { '/var/gitlab-pages' }
diff --git a/spec/lib/backup/uploads_spec.rb b/spec/lib/backup/uploads_spec.rb
index c173916fe91..25ad0c0d3f7 100644
--- a/spec/lib/backup/uploads_spec.rb
+++ b/spec/lib/backup/uploads_spec.rb
@@ -7,18 +7,6 @@ RSpec.describe Backup::Uploads do
subject(:backup) { described_class.new(progress) }
- describe '#initialize' do
- it 'uses the correct upload dir' do
- Dir.mktmpdir do |tmpdir|
- FileUtils.mkdir_p("#{tmpdir}/uploads")
-
- allow(Gitlab.config.uploads).to receive(:storage_path) { tmpdir }
-
- expect(backup.app_files_dir).to eq("#{File.realpath(tmpdir)}/uploads")
- end
- end
- end
-
describe '#dump' do
before do
allow(File).to receive(:realpath).and_call_original
@@ -27,10 +15,6 @@ RSpec.describe Backup::Uploads do
allow(Gitlab.config.uploads).to receive(:storage_path) { '/var' }
end
- it 'uses the correct upload dir' do
- expect(backup.app_files_dir).to eq('/var/uploads')
- end
-
it 'excludes tmp from backup tar' do
expect(backup).to receive(:tar).and_return('blabla-tar')
expect(backup).to receive(:run_pipeline!).with([%w(blabla-tar --exclude=lost+found --exclude=./tmp -C /var/uploads -cf - .), 'gzip -c -1'], any_args).and_return([[true, true], ''])
diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb
index ca3ae437540..afeb95a3ca3 100644
--- a/spec/services/quick_actions/interpret_service_spec.rb
+++ b/spec/services/quick_actions/interpret_service_spec.rb
@@ -682,6 +682,20 @@ RSpec.describe QuickActions::InterpretService do
expect(message).to eq("Assigned #{developer.to_reference}.")
end
+
+ context 'when the user has a private profile' do
+ let(:user) { create(:user, :private_profile) }
+ let(:content) { "/assign #{user.to_reference}" }
+
+ it 'assigns to the user' do
+ issuable.project.add_developer(user)
+
+ _, updates, message = service.execute(content, issuable)
+
+ expect(updates).to eq(assignee_ids: [user.id])
+ expect(message).to eq("Assigned #{user.to_reference}.")
+ end
+ end
end
shared_examples 'assign_reviewer command' do
@@ -971,24 +985,6 @@ RSpec.describe QuickActions::InterpretService do
it_behaves_like 'assign_reviewer command'
end
- context 'with a private user' do
- let(:ref) { create(:user, :unconfirmed).to_reference }
- let(:content) { "/assign_reviewer #{ref}" }
-
- it_behaves_like 'failed command', 'a parse error' do
- let(:match_msg) { eq "Could not apply assign_reviewer command. Failed to find users for '#{ref}'." }
- end
- end
-
- context 'with a private user, bare username' do
- let(:ref) { create(:user, :unconfirmed).username }
- let(:content) { "/assign_reviewer #{ref}" }
-
- it_behaves_like 'failed command', 'a parse error' do
- let(:match_msg) { eq "Could not apply assign_reviewer command. Failed to find users for '#{ref}'." }
- end
- end
-
context 'with @all' do
let(:content) { "/assign_reviewer @all" }