From 6639aa3f489b6ad2a6184f9b748c887d512ec4b4 Mon Sep 17 00:00:00 2001 From: Lee Tickett Date: Fri, 6 Sep 2019 16:16:39 +0000 Subject: Only show `/copy_metadata` when usable --- spec/services/quick_actions/interpret_service_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'spec/services') 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 } -- cgit v1.2.1