diff options
author | Peter Leitzen <pl@neopoly.de> | 2018-07-21 14:57:52 +0200 |
---|---|---|
committer | Peter Leitzen <pl@neopoly.de> | 2018-08-10 16:45:11 +0200 |
commit | 7a4b288ec96e64bd9eaf1296d319a39401901df4 (patch) | |
tree | e8b488873903d3ec07a5dd0df0cdf006efcde088 /spec/services/commits | |
parent | d6eaf38be4fa1785b6e47eeb76f4ca2cb20a144d (diff) | |
download | gitlab-ce-7a4b288ec96e64bd9eaf1296d319a39401901df4.tar.gz |
Create a system note after tagging a commit
Diffstat (limited to 'spec/services/commits')
-rw-r--r-- | spec/services/commits/update_service_spec.rb | 18 |
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 |