Commit c406fc5acd56b7675293ebd4377c902e3d68469f
1 parent
51aa0c13
Exists in
master
and in
1 other branch
Fixed Redmine specs
Showing
1 changed file
with
6 additions
and
3 deletions
Show diff stats
spec/models/issue_trackers/redmine_tracker_spec.rb
... | ... | @@ -8,13 +8,17 @@ describe IssueTrackers::RedmineTracker do |
8 | 8 | number = 5 |
9 | 9 | @issue_link = "#{tracker.account}/issues/#{number}.xml?project_id=#{tracker.project_id}" |
10 | 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 | 16 | to_return(:status => 201, :headers => {'Location' => @issue_link}, :body => body ) |
13 | 17 | |
14 | 18 | problem.app.issue_tracker.create_issue(problem) |
15 | 19 | problem.reload |
16 | 20 | |
17 | - requested = have_requested(:post, "#{tracker.account}/issues.xml") | |
21 | + requested = have_requested(:post, "#{base_url}/issues.xml") | |
18 | 22 | WebMock.should requested.with(:headers => {'X-Redmine-API-Key' => tracker.api_token}) |
19 | 23 | WebMock.should requested.with(:body => /<project-id>#{tracker.project_id}<\/project-id>/) |
20 | 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 | 43 | 'http://redmine.example.com/projects/actual_project/repository/annotate/example/file#L25' |
40 | 44 | end |
41 | 45 | end |
42 | - | ... | ... |