Commit c406fc5acd56b7675293ebd4377c902e3d68469f

Authored by Nathan Broadbent
1 parent 51aa0c13
Exists in master and in 1 other branch production

Fixed Redmine specs

spec/models/issue_trackers/redmine_tracker_spec.rb
@@ -8,13 +8,17 @@ describe IssueTrackers::RedmineTracker do @@ -8,13 +8,17 @@ describe IssueTrackers::RedmineTracker do
8 number = 5 8 number = 5
9 @issue_link = "#{tracker.account}/issues/#{number}.xml?project_id=#{tracker.project_id}" 9 @issue_link = "#{tracker.account}/issues/#{number}.xml?project_id=#{tracker.project_id}"
10 body = "<issue><subject>my subject</subject><id>#{number}</id></issue>" 10 body = "<issue><subject>my subject</subject><id>#{number}</id></issue>"
11 - stub_request(:post, "#{tracker.account}/issues.xml"). 11 +
  12 + # Build base url with account URL, and username/password basic auth
  13 + base_url = tracker.account.gsub /http:\/\//, "http://#{tracker.username}:#{tracker.password}@"
  14 +
  15 + stub_request(:post, "#{base_url}/issues.xml").
12 to_return(:status => 201, :headers => {'Location' => @issue_link}, :body => body ) 16 to_return(:status => 201, :headers => {'Location' => @issue_link}, :body => body )
13 17
14 problem.app.issue_tracker.create_issue(problem) 18 problem.app.issue_tracker.create_issue(problem)
15 problem.reload 19 problem.reload
16 20
17 - requested = have_requested(:post, "#{tracker.account}/issues.xml") 21 + requested = have_requested(:post, "#{base_url}/issues.xml")
18 WebMock.should requested.with(:headers => {'X-Redmine-API-Key' => tracker.api_token}) 22 WebMock.should requested.with(:headers => {'X-Redmine-API-Key' => tracker.api_token})
19 WebMock.should requested.with(:body => /<project-id>#{tracker.project_id}<\/project-id>/) 23 WebMock.should requested.with(:body => /<project-id>#{tracker.project_id}<\/project-id>/)
20 WebMock.should requested.with(:body => /<subject>\[#{ problem.environment }\]\[#{problem.where}\] #{problem.message.to_s.truncate(100)}<\/subject>/) 24 WebMock.should requested.with(:body => /<subject>\[#{ problem.environment }\]\[#{problem.where}\] #{problem.message.to_s.truncate(100)}<\/subject>/)
@@ -39,4 +43,3 @@ describe IssueTrackers::RedmineTracker do @@ -39,4 +43,3 @@ describe IssueTrackers::RedmineTracker do
39 'http://redmine.example.com/projects/actual_project/repository/annotate/example/file#L25' 43 'http://redmine.example.com/projects/actual_project/repository/annotate/example/file#L25'
40 end 44 end
41 end 45 end
42 -