Commit c02adfd8e3c7ce4ad88232f34fb3b9e0697c5ee6
1 parent
b6b44d59
Exists in
master
and in
1 other branch
request inside before don't have effect, using :format => :xml (thanks @martinciu)
Showing
1 changed file
with
3 additions
and
6 deletions
Show diff stats
spec/controllers/notices_controller_spec.rb
@@ -11,15 +11,12 @@ describe NoticesController do | @@ -11,15 +11,12 @@ describe NoticesController do | ||
11 | @app = Fabricate(:app_with_watcher) | 11 | @app = Fabricate(:app_with_watcher) |
12 | App.stub(:find_by_api_key!).and_return(@app) | 12 | App.stub(:find_by_api_key!).and_return(@app) |
13 | @notice = App.report_error!(@xml) | 13 | @notice = App.report_error!(@xml) |
14 | - | ||
15 | - request.env['Content-type'] = 'text/xml' | ||
16 | - request.env['Accept'] = 'text/xml, application/xml' | ||
17 | end | 14 | end |
18 | 15 | ||
19 | it "generates a notice from xml [POST]" do | 16 | it "generates a notice from xml [POST]" do |
20 | App.should_receive(:report_error!).with(@xml).and_return(@notice) | 17 | App.should_receive(:report_error!).with(@xml).and_return(@notice) |
21 | request.should_receive(:raw_post).and_return(@xml) | 18 | request.should_receive(:raw_post).and_return(@xml) |
22 | - post :create | 19 | + post :create, :format => :xml |
23 | response.should be_success | 20 | response.should be_success |
24 | # Same RegExp from Airbrake::Sender#send_to_airbrake (https://github.com/airbrake/airbrake/blob/master/lib/airbrake/sender.rb#L53) | 21 | # Same RegExp from Airbrake::Sender#send_to_airbrake (https://github.com/airbrake/airbrake/blob/master/lib/airbrake/sender.rb#L53) |
25 | # Inspired by https://github.com/airbrake/airbrake/blob/master/test/sender_test.rb | 22 | # Inspired by https://github.com/airbrake/airbrake/blob/master/test/sender_test.rb |
@@ -28,7 +25,7 @@ describe NoticesController do | @@ -28,7 +25,7 @@ describe NoticesController do | ||
28 | 25 | ||
29 | it "generates a notice from xml [GET]" do | 26 | it "generates a notice from xml [GET]" do |
30 | App.should_receive(:report_error!).with(@xml).and_return(@notice) | 27 | App.should_receive(:report_error!).with(@xml).and_return(@notice) |
31 | - get :create, {:data => @xml} | 28 | + get :create, :data => @xml, :format => :xml |
32 | response.should be_success | 29 | response.should be_success |
33 | response.body.should match(%r{<id[^>]*>#{@notice.id}</id>}) | 30 | response.body.should match(%r{<id[^>]*>#{@notice.id}</id>}) |
34 | end | 31 | end |
@@ -36,7 +33,7 @@ describe NoticesController do | @@ -36,7 +33,7 @@ describe NoticesController do | ||
36 | it "sends a notification email" do | 33 | it "sends a notification email" do |
37 | App.should_receive(:report_error!).with(@xml).and_return(@notice) | 34 | App.should_receive(:report_error!).with(@xml).and_return(@notice) |
38 | request.should_receive(:raw_post).and_return(@xml) | 35 | request.should_receive(:raw_post).and_return(@xml) |
39 | - post :create | 36 | + post :create, :format => :xml |
40 | response.should be_success | 37 | response.should be_success |
41 | response.body.should match(%r{<id[^>]*>#{@notice.id}</id>}) | 38 | response.body.should match(%r{<id[^>]*>#{@notice.id}</id>}) |
42 | email = ActionMailer::Base.deliveries.last | 39 | email = ActionMailer::Base.deliveries.last |