Commit b36f001397a6baa5f88e271d507db918988af5e2
1 parent
ae04e467
Exists in
master
and in
1 other branch
Refactoring on Unfuddle notification
* Delete the devmen unfuddle account * Improve spec to be more rspec compiliant * Little refactoring on unfuddle notification
Showing
2 changed files
with
10 additions
and
10 deletions
Show diff stats
app/models/issue_trackers/unfuddle_tracker.rb
| ... | ... | @@ -50,7 +50,7 @@ class IssueTrackers::UnfuddleTracker < IssueTracker |
| 50 | 50 | |
| 51 | 51 | issue = unfuddle.project(project_id.to_i).ticket!(issue_options) |
| 52 | 52 | problem.update_attributes( |
| 53 | - :issue_link => "https://#{account}.unfuddle.com/projects/#{project_id}/tickets/#{issue['id']}", | |
| 53 | + :issue_link => File.join("#{url}/tickets/#{issue['id']}"), | |
| 54 | 54 | :issue_type => Label |
| 55 | 55 | ) |
| 56 | 56 | rescue ActiveResource::UnauthorizedAccess |
| ... | ... | @@ -64,6 +64,6 @@ class IssueTrackers::UnfuddleTracker < IssueTracker |
| 64 | 64 | end |
| 65 | 65 | |
| 66 | 66 | def url |
| 67 | - "https://devmen.unfuddle.com/projects/#{project_id}" | |
| 67 | + "https://#{account}.unfuddle.com/projects/#{project_id}" | |
| 68 | 68 | end |
| 69 | 69 | end | ... | ... |
spec/models/issue_trackers/unfuddle_issues_tracker_spec.rb
| 1 | 1 | require 'spec_helper' |
| 2 | 2 | |
| 3 | 3 | describe IssueTrackers::UnfuddleTracker do |
| 4 | - it "should create an issue on Unfuddle Issues with problem params, and set issue link for problem" do | |
| 5 | - repo = "test_user/test_repo" | |
| 6 | - notice = Fabricate :notice | |
| 7 | - tracker = Fabricate :unfuddle_issues_tracker, :app => notice.app | |
| 8 | - problem = notice.problem | |
| 9 | 4 | |
| 10 | - number = 123 | |
| 11 | - @issue_link = "https://test.unfuddle.com/projects/15/tickets/2436" | |
| 5 | + let(:issue_link) { "https://test.unfuddle.com/projects/15/tickets/2436" } | |
| 6 | + let(:notice) { Fabricate :notice } | |
| 7 | + let(:tracker) { Fabricate :unfuddle_issues_tracker, :app => notice.app } | |
| 8 | + let(:problem) { notice.problem } | |
| 12 | 9 | |
| 10 | + it "should create an issue on Unfuddle Issues with problem params, and set issue link for problem" do | |
| 13 | 11 | project_xml = <<EOF |
| 14 | 12 | <?xml version="1.0" encoding="UTF-8"?> |
| 15 | 13 | <project> |
| ... | ... | @@ -73,6 +71,7 @@ EOF |
| 73 | 71 | <updated-at>2013-03-07T16:04:05Z</updated-at> |
| 74 | 72 | </ticket> |
| 75 | 73 | EOF |
| 74 | + | |
| 76 | 75 | stub_request(:get, "https://#{tracker.username}:#{tracker.password}@test.unfuddle.com/api/v1/projects/#{tracker.project_id}.xml"). |
| 77 | 76 | with(:headers => {'Accept'=>'application/xml', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}). |
| 78 | 77 | to_return(:status => 200, :body => project_xml, :headers => {}) |
| ... | ... | @@ -88,6 +87,7 @@ EOF |
| 88 | 87 | WebMock.should requested.with(:title => /[production][foo#bar] FooError: Too Much Bar/) |
| 89 | 88 | WebMock.should requested.with(:content => /See this exception on Errbit/) |
| 90 | 89 | |
| 91 | - problem.issue_link.should == @issue_link | |
| 90 | + problem.issue_link.should == issue_link | |
| 91 | + problem.issue_type.should == IssueTrackers::UnfuddleTracker::Label | |
| 92 | 92 | end |
| 93 | 93 | end | ... | ... |