Commit 4e7477d108492b41b5d3198315825af91fb3c35c
1 parent
e3ddfc19
Exists in
master
and in
1 other branch
Added specs for fogbugz
Showing
1 changed file
with
30 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
1 | +# encoding: utf-8 | ||
2 | +require 'spec_helper' | ||
3 | + | ||
4 | +describe FogbugzTracker do | ||
5 | + let(:notice) { Factory :notice } | ||
6 | + let(:tracker) { Factory :fogbugz_tracker, :password => "password", :app => notice.err.app } | ||
7 | + let(:err) { notice.err } | ||
8 | + | ||
9 | + before do | ||
10 | + number = 123 | ||
11 | + @issue_link = "https://#{tracker.account}.fogbugz.com/default.asp?#{number}" | ||
12 | + auth_response = "<response><token>12345</token></response>" | ||
13 | + command_response = "<response><case><ixBug>123</ixBug></case></response>" | ||
14 | + http_mock = mock() | ||
15 | + http_mock.should_receive(:new).and_return(http_mock) | ||
16 | + http_mock.should_receive(:request).with(:logon, {:params=>{:email=>"test@example.com", :password=>"password"}}). | ||
17 | + and_return(auth_response) | ||
18 | + http_mock.should_receive(:request). | ||
19 | + and_return(command_response) | ||
20 | + Fogbugz.adapter[:http] = http_mock | ||
21 | + end | ||
22 | + | ||
23 | + it "should create an issue on Fogbugz with err params, and set issue link for err" do | ||
24 | + err.app.issue_tracker.create_issue(err) | ||
25 | + err.reload | ||
26 | + | ||
27 | + err.issue_link.should == @issue_link | ||
28 | + end | ||
29 | +end | ||
30 | + |