summaryrefslogtreecommitdiff
path: root/spec/services/commits
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/commits')
-rw-r--r--spec/services/commits/update_service_spec.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/services/commits/update_service_spec.rb b/spec/services/commits/update_service_spec.rb
index cfca3a85236..05d1e4ec254 100644
--- a/spec/services/commits/update_service_spec.rb
+++ b/spec/services/commits/update_service_spec.rb
@@ -22,11 +22,26 @@ describe Commits::UpdateService do
end
it 'tags a commit' do
+ tag_double = double(name: opts[:tag_name])
tag_stub = instance_double(Tags::CreateService)
allow(Tags::CreateService).to receive(:new).and_return(tag_stub)
allow(tag_stub).to receive(:execute)
.with(opts[:tag_name], commit.sha, opts[:tag_message], nil)
- .and_return({ status: :success })
+ .and_return({ status: :success, tag: tag_double })
+
+ expect(SystemNoteService).to receive(:tag_commit).with(commit, project, user, opts[:tag_name])
+
+ service.execute(commit)
+ end
+
+ it 'fails to tag the commit' do
+ tag_stub = instance_double(Tags::CreateService)
+ allow(Tags::CreateService).to receive(:new).and_return(tag_stub)
+ allow(tag_stub).to receive(:execute)
+ .with(opts[:tag_name], commit.sha, opts[:tag_message], nil)
+ .and_return({ status: :error })
+
+ expect(SystemNoteService).not_to receive(:tag_commit)
service.execute(commit)
end
@@ -39,6 +54,7 @@ describe Commits::UpdateService do
it 'does not call the tag create service' do
expect(Tags::CreateService).not_to receive(:new)
+ expect(SystemNoteService).not_to receive(:tag_commit)
service.execute(commit)
end