summaryrefslogtreecommitdiff
path: root/spec/services/git_push_service_spec.rb
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-11-09 19:55:21 -0200
committerFelipe Artur <felipefac@gmail.com>2016-11-17 16:35:50 -0200
commitad1fa68b8419537f5e3fa8d9d04e71accde72be8 (patch)
tree7ae6d6e8741335d0381ea781149a6404dcd756dc /spec/services/git_push_service_spec.rb
parent18f96e2612b47fbfa0ee9a84614c999b9d24ad54 (diff)
downloadgitlab-ce-issue_13232.tar.gz
Add JIRA remotelinks and prevent duplicated closing messagesissue_13232
Diffstat (limited to 'spec/services/git_push_service_spec.rb')
-rw-r--r--spec/services/git_push_service_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb
index cea7e6429f9..35ab6d0c087 100644
--- a/spec/services/git_push_service_spec.rb
+++ b/spec/services/git_push_service_spec.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Style/HashSyntax
require 'spec_helper'
describe GitPushService, services: true do
@@ -492,6 +493,16 @@ describe GitPushService, services: true do
let(:message) { "this is some work.\n\ncloses JIRA-1" }
let(:comment_body) { { body: "Issue solved with [#{closing_commit.id}|http://localhost/#{project.path_with_namespace}/commit/#{closing_commit.id}]." }.to_json }
+ before do
+ open_issue = JIRA::Resource::Issue.new(jira_tracker.client, :attrs => { "id" => "JIRA-1" })
+ closed_issue = open_issue.dup
+ allow(open_issue).to receive(:resolution).and_return(false)
+ allow(closed_issue).to receive(:resolution).and_return(true)
+ allow(JIRA::Resource::Issue).to receive(:find).and_return(open_issue, closed_issue)
+
+ allow_any_instance_of(JIRA::Resource::Issue).to receive(:key).and_return("JIRA-1")
+ end
+
context "using right markdown" do
it "initiates one api call to jira server to close the issue" do
execute_service(project, commit_author, @oldrev, @newrev, @ref )