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:
authorFelipe Artur <felipefac@gmail.com>2016-09-30 00:11:32 +0300
committerFelipe Artur <felipefac@gmail.com>2016-10-26 20:02:16 +0300
commitc2d6822e942f86422348fe4ebea7142822e5882c (patch)
tree0891efe343661528c89c995eda73c2750f1eca05 /spec/support/jira_service_helper.rb
parentf4bc18d237413ac55e32ce16a23b3d2ab35a6976 (diff)
Finish updates to use JIRA gem
Code improvements, bug fixes, finish documentation and specs
Diffstat (limited to 'spec/support/jira_service_helper.rb')
-rw-r--r--spec/support/jira_service_helper.rb42
1 files changed, 28 insertions, 14 deletions
diff --git a/spec/support/jira_service_helper.rb b/spec/support/jira_service_helper.rb
index f3ea206f387..96e0dad6b55 100644
--- a/spec/support/jira_service_helper.rb
+++ b/spec/support/jira_service_helper.rb
@@ -1,20 +1,17 @@
module JiraServiceHelper
+ JIRA_URL = "http://jira.example.net"
+ JIRA_API = JIRA_URL + "/rest/api/2"
+
def jira_service_settings
properties = {
- "title" => "JIRA tracker",
- "project_url" => "http://jira.example/issues/?jql=project=A",
- "issues_url" => "http://jira.example/browse/JIRA-1",
- "new_issue_url" => "http://jira.example/secure/CreateIssue.jspa",
- "api_url" => "http://jira.example/rest/api/2"
+ title: "JIRA tracker",
+ url: JIRA_URL,
+ project_key: "JIRA"
}
jira_tracker.update_attributes(properties: properties, active: true)
end
- def jira_status_message
- "JiraService SUCCESS 200: Successfully posted to #{jira_api_comment_url}."
- end
-
def jira_issue_comments
"{\"startAt\":0,\"maxResults\":11,\"total\":11,
\"comments\":[{\"self\":\"http://0.0.0.0:4567/rest/api/2/issue/10002/comment/10609\",
@@ -52,15 +49,32 @@ module JiraServiceHelper
]}"
end
- def jira_api_comment_url
- 'http://jira.example/rest/api/2/issue/JIRA-1/comment'
+ def jira_project_url
+ JIRA_API + "/project/#{jira_tracker.project_key}"
+ end
+
+ def jira_api_comment_url(issue_id)
+ JIRA_API + "/issue/#{issue_id}/comment"
end
- def jira_api_transition_url
- 'http://jira.example/rest/api/2/issue/JIRA-1/transitions'
+ def jira_api_transition_url(issue_id)
+ JIRA_API + "/issue/#{issue_id}/transitions"
end
def jira_api_test_url
- 'http://jira.example/rest/api/2/myself'
+ JIRA_API + "/myself"
+ end
+
+ def jira_issue_url(issue_id)
+ JIRA_API + "/issue/#{issue_id}"
+ end
+
+ def stub_jira_urls(issue_id)
+ WebMock.stub_request(:get, jira_project_url)
+ WebMock.stub_request(:get, jira_api_comment_url(issue_id)).to_return(body: jira_issue_comments)
+ WebMock.stub_request(:get, jira_issue_url(issue_id))
+ WebMock.stub_request(:get, jira_api_test_url)
+ WebMock.stub_request(:post, jira_api_comment_url(issue_id))
+ WebMock.stub_request(:post, jira_api_transition_url(issue_id))
end
end