summaryrefslogtreecommitdiff
path: root/spec/services/quick_actions/interpret_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/quick_actions/interpret_service_spec.rb')
-rw-r--r--spec/services/quick_actions/interpret_service_spec.rb28
1 files changed, 26 insertions, 2 deletions
diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb
index b65ee16c189..788f83cc233 100644
--- a/spec/services/quick_actions/interpret_service_spec.rb
+++ b/spec/services/quick_actions/interpret_service_spec.rb
@@ -586,6 +586,22 @@ describe QuickActions::InterpretService do
expect(message).to eq('Made this issue confidential.')
end
+
+ context 'when issuable is already confidential' do
+ before do
+ issuable.update(confidential: true)
+ end
+
+ it 'does not return the success message' do
+ _, _, message = service.execute(content, issuable)
+
+ expect(message).to be_empty
+ end
+
+ it 'is not part of the available commands' do
+ expect(service.available_commands(issuable)).not_to include(a_hash_including(name: :confidential))
+ end
+ end
end
shared_examples 'shrug command' do
@@ -1529,12 +1545,20 @@ describe QuickActions::InterpretService do
end
it 'limits to commands passed ' do
- content = "/shrug\n/close"
+ content = "/shrug test\n/close"
text, commands = service.execute(content, issue, only: [:shrug])
expect(commands).to be_empty
- expect(text).to eq("#{described_class::SHRUG}\n/close")
+ expect(text).to eq("test #{described_class::SHRUG}\n/close")
+ end
+
+ it 'preserves leading whitespace ' do
+ content = " - list\n\n/close\n\ntest\n\n"
+
+ text, _ = service.execute(content, issue)
+
+ expect(text).to eq(" - list\n\ntest")
end
context '/create_merge_request command' do