Commit cda23ec8ae7e71a60f01ce8e398dcc9092e499cc
1 parent
93b6d0a5
Exists in
master
and in
1 other branch
Failing specs for redmine issues tracker.
Showing
2 changed files
with
37 additions
and
0 deletions
Show diff stats
spec/controllers/errs_controller_spec.rb
... | ... | @@ -253,6 +253,38 @@ describe ErrsController do |
253 | 253 | err.issue_link.should == @issue_link.sub(/\.xml$/, '') |
254 | 254 | end |
255 | 255 | end |
256 | + | |
257 | + context "redmine tracker" do | |
258 | + let(:notice) { Factory :notice } | |
259 | + let(:tracker) { Factory :redmine_tracker, :app => notice.err.app } | |
260 | + let(:err) { notice.err } | |
261 | + | |
262 | + before(:each) do | |
263 | + number = 5 | |
264 | + @issue_link = "#{tracker.account}/projects/#{tracker.project_id}/issues/#{number}.xml" | |
265 | + body = "<issue></issue>" | |
266 | + stub_request(:post, "#{tracker.account}/projects/#{tracker.project_id}/issues.xml").to_return(:status => 201, :headers => {'Location' => @issue_link}, :body => body ) | |
267 | + | |
268 | + post :create_issue, :app_id => err.app.id, :id => err.id | |
269 | + err.reload | |
270 | + end | |
271 | + | |
272 | + it "should make request to Lighthouseapp with err params" do | |
273 | + requested = have_requested(:post, "http://#{tracker.account}.lighthouseapp.com/projects/#{tracker.project_id}/tickets.xml") | |
274 | + WebMock.should requested.with(:headers => {'X-Lighthousetoken' => tracker.api_token}) | |
275 | + WebMock.should requested.with(:body => /<tag>errbit<\/tag>/) | |
276 | + WebMock.should requested.with(:body => /<title>\[#{ err.environment }\]\[#{err.where}\] #{err.message.to_s.truncate(100)}<\/title>/) | |
277 | + WebMock.should requested.with(:body => /<body>.+<\/body>/m) | |
278 | + end | |
279 | + | |
280 | + it "should redirect to err page" do | |
281 | + response.should redirect_to( app_err_path(err.app, err) ) | |
282 | + end | |
283 | + | |
284 | + it "should create issue link for err" do | |
285 | + err.issue_link.should == @issue_link.sub(/\.xml$/, '') | |
286 | + end | |
287 | + end | |
256 | 288 | end |
257 | 289 | |
258 | 290 | context "absent issue tracker" do | ... | ... |
spec/factories/issue_tracker_factories.rb
... | ... | @@ -4,4 +4,9 @@ Factory.define :lighthouseapp_tracker, :class => IssueTracker do |e| |
4 | 4 | e.api_token { Factory.next :word } |
5 | 5 | e.project_id { Factory.next :word } |
6 | 6 | e.association :app, :factory => :app |
7 | +end | |
8 | + | |
9 | +Factory.define :redmine_tracker, :parent => :lighthouseapp_tracker do |e| | |
10 | + e.issue_tracker_type 'redmine' | |
11 | + e.account { "http://#{Factory.next(:word)}.com" } | |
7 | 12 | end |
8 | 13 | \ No newline at end of file | ... | ... |