Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Leitzen <pl@neopoly.de>2018-07-21 15:57:52 +0300
committerPeter Leitzen <pl@neopoly.de>2018-08-10 17:45:11 +0300
commit7a4b288ec96e64bd9eaf1296d319a39401901df4 (patch)
treee8b488873903d3ec07a5dd0df0cdf006efcde088 /spec/services/commits
parentd6eaf38be4fa1785b6e47eeb76f4ca2cb20a144d (diff)
Create a system note after tagging a commit
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