summaryrefslogtreecommitdiff
path: root/spec/services/notes/create_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/notes/create_service_spec.rb')
-rw-r--r--spec/services/notes/create_service_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/services/notes/create_service_spec.rb b/spec/services/notes/create_service_spec.rb
index f59749f0b63..d28cb118529 100644
--- a/spec/services/notes/create_service_spec.rb
+++ b/spec/services/notes/create_service_spec.rb
@@ -345,6 +345,24 @@ RSpec.describe Notes::CreateService do
expect(note.errors[:commands_only]).to be_present
end
+
+ it 'adds commands failed message to note errors' do
+ note_text = %(/reopen)
+ note = described_class.new(project, user, opts.merge(note: note_text)).execute
+
+ expect(note.errors[:commands_only]).to contain_exactly('Could not apply reopen command.')
+ end
+
+ it 'generates success and failed error messages' do
+ note_text = %(/close\n/reopen)
+ service = double(:service)
+ allow(Issues::UpdateService).to receive(:new).and_return(service)
+ expect(service).to receive(:execute)
+
+ note = described_class.new(project, user, opts.merge(note: note_text)).execute
+
+ expect(note.errors[:commands_only]).to contain_exactly('Closed this issue. Could not apply reopen command.')
+ end
end
end