diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/services/quick_actions | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) | |
download | gitlab-ce-311b0269b4eb9839fa63f80c8d7a58f32b8138a0.tar.gz |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'spec/services/quick_actions')
-rw-r--r-- | spec/services/quick_actions/interpret_service_spec.rb | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb index d67b189f90e..611261cd92c 100644 --- a/spec/services/quick_actions/interpret_service_spec.rb +++ b/spec/services/quick_actions/interpret_service_spec.rb @@ -1326,14 +1326,25 @@ RSpec.describe QuickActions::InterpretService do let(:issuable) { issue } end - it_behaves_like 'confidential command' do - let(:content) { '/confidential' } - let(:issuable) { issue } - end + context '/confidential' do + it_behaves_like 'confidential command' do + let(:content) { '/confidential' } + let(:issuable) { issue } + end - it_behaves_like 'confidential command' do - let(:content) { '/confidential' } - let(:issuable) { create(:incident, project: project) } + it_behaves_like 'confidential command' do + let(:content) { '/confidential' } + let(:issuable) { create(:incident, project: project) } + end + + context 'when non-member is creating a new issue' do + let(:service) { described_class.new(project, create(:user)) } + + it_behaves_like 'confidential command' do + let(:content) { '/confidential' } + let(:issuable) { build(:issue, project: project) } + end + end end it_behaves_like 'lock command' do @@ -2542,4 +2553,32 @@ RSpec.describe QuickActions::InterpretService do end end end + + describe '#available_commands' do + context 'when Guest is creating a new issue' do + let_it_be(:guest) { create(:user) } + + let(:issue) { build(:issue, project: public_project) } + let(:service) { described_class.new(project, guest) } + + before_all do + public_project.add_guest(guest) + end + + it 'includes commands to set metadata' do + # milestone action is only available when project has a milestone + milestone + + available_commands = service.available_commands(issue) + + expect(available_commands).to include( + a_hash_including(name: :label), + a_hash_including(name: :milestone), + a_hash_including(name: :copy_metadata), + a_hash_including(name: :assign), + a_hash_including(name: :due) + ) + end + end + end end |