mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-15 07:36:41 +10:00
Fix JIRA mention spec
This commit is contained in:
@@ -933,6 +933,3 @@ DEPENDENCIES
|
||||
virtus (~> 1.0.1)
|
||||
webmock (~> 1.21.0)
|
||||
wikicloth (= 0.8.1)
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.6
|
||||
|
||||
@@ -96,7 +96,7 @@ class GitPushService
|
||||
Issues::CloseService.new(project, authors[commit], {}).execute(issue, commit)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
commit.create_cross_references!(authors[commit], closed_issues)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -274,7 +274,7 @@ describe GitPushService do
|
||||
|
||||
allow(closing_commit).to receive_messages({
|
||||
issue_closing_regex: Regexp.new(Gitlab.config.gitlab.issue_closing_pattern),
|
||||
safe_message: "this is some work.\n\ncloses JIRA-1",
|
||||
safe_message: message,
|
||||
author_name: commit_author.name,
|
||||
author_email: commit_author.email
|
||||
})
|
||||
@@ -286,33 +286,40 @@ describe GitPushService do
|
||||
jira_tracker.destroy!
|
||||
end
|
||||
|
||||
it "should initiate one api call to jira server to close the issue" do
|
||||
message = {
|
||||
update: {
|
||||
comment: [{
|
||||
add: {
|
||||
body: "Issue solved with [#{closing_commit.id}|http://localhost/#{project.path_with_namespace}/commit/#{closing_commit.id}]."
|
||||
}
|
||||
}]
|
||||
},
|
||||
transition: {
|
||||
id: '2'
|
||||
}
|
||||
}.to_json
|
||||
context "mentioning an issue" do
|
||||
let(:message) { "this is some work.\n\nrelated to JIRA-1" }
|
||||
|
||||
service.execute(project, user, @oldrev, @newrev, @ref)
|
||||
expect(WebMock).to have_requested(:post, jira_api_transition_url).with(
|
||||
body: message
|
||||
).once
|
||||
it "should initiate one api call to jira server to mention the issue" do
|
||||
service.execute(project, user, @oldrev, @newrev, @ref)
|
||||
|
||||
expect(WebMock).to have_requested(:post, jira_api_comment_url).with(
|
||||
body: /mentioned this issue in/
|
||||
).once
|
||||
end
|
||||
end
|
||||
|
||||
it "should initiate one api call to jira server to mention the issue" do
|
||||
skip "This spec was broken during the CE-to-EE merge and needs to be fixed. See https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/34"
|
||||
service.execute(project, user, @oldrev, @newrev, @ref)
|
||||
context "closing an issue" do
|
||||
let(:message) { "this is some work.\n\ncloses JIRA-1" }
|
||||
|
||||
expect(WebMock).to have_requested(:post, jira_api_comment_url).with(
|
||||
body: /mentioned this issue in/
|
||||
).once
|
||||
it "should initiate one api call to jira server to close the issue" do
|
||||
body = {
|
||||
update: {
|
||||
comment: [{
|
||||
add: {
|
||||
body: "Issue solved with [#{closing_commit.id}|http://localhost/#{project.path_with_namespace}/commit/#{closing_commit.id}]."
|
||||
}
|
||||
}]
|
||||
},
|
||||
transition: {
|
||||
id: '2'
|
||||
}
|
||||
}.to_json
|
||||
|
||||
service.execute(project, user, @oldrev, @newrev, @ref)
|
||||
expect(WebMock).to have_requested(:post, jira_api_transition_url).with(
|
||||
body: body
|
||||
).once
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user