summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorLee Tickett <lee@tickett.net>2019-09-06 16:16:39 +0000
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-09-06 16:16:39 +0000
commit6639aa3f489b6ad2a6184f9b748c887d512ec4b4 (patch)
treef7984e35c5ad89877539409f0ac36fbe2faca9ff /spec/services
parentaf0eb56ea1be60a1b99d6ba7a8dd8848f0a29a6c (diff)
downloadgitlab-ce-6639aa3f489b6ad2a6184f9b748c887d512ec4b4.tar.gz
Only show `/copy_metadata` when usable
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/quick_actions/interpret_service_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb
index 6ca0a3fa448..b65ee16c189 100644
--- a/spec/services/quick_actions/interpret_service_spec.rb
+++ b/spec/services/quick_actions/interpret_service_spec.rb
@@ -1140,6 +1140,19 @@ describe QuickActions::InterpretService do
let(:todo_label) { create(:label, project: project, title: 'To Do') }
let(:inreview_label) { create(:label, project: project, title: 'In Review') }
+ it 'is available when the user is a developer' do
+ expect(service.available_commands(issue)).to include(a_hash_including(name: :copy_metadata))
+ end
+
+ context 'when the user does not have permission' do
+ let(:guest) { create(:user) }
+ let(:service) { described_class.new(project, guest) }
+
+ it 'is not available' do
+ expect(service.available_commands(issue)).not_to include(a_hash_including(name: :copy_metadata))
+ end
+ end
+
it_behaves_like 'empty command' do
let(:content) { '/copy_metadata' }
let(:issuable) { issue }