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 | 11 | @app = Fabricate(:app_with_watcher) |
12 | 12 | App.stub(:find_by_api_key!).and_return(@app) |
13 | 13 | @notice = App.report_error!(@xml) |
14 | - | |
15 | - request.env['Content-type'] = 'text/xml' | |
16 | - request.env['Accept'] = 'text/xml, application/xml' | |
17 | 14 | end |
18 | 15 | |
19 | 16 | it "generates a notice from xml [POST]" do |
20 | 17 | App.should_receive(:report_error!).with(@xml).and_return(@notice) |
21 | 18 | request.should_receive(:raw_post).and_return(@xml) |
22 | - post :create | |
19 | + post :create, :format => :xml | |
23 | 20 | response.should be_success |
24 | 21 | # Same RegExp from Airbrake::Sender#send_to_airbrake (https://github.com/airbrake/airbrake/blob/master/lib/airbrake/sender.rb#L53) |
25 | 22 | # Inspired by https://github.com/airbrake/airbrake/blob/master/test/sender_test.rb |
... | ... | @@ -28,7 +25,7 @@ describe NoticesController do |
28 | 25 | |
29 | 26 | it "generates a notice from xml [GET]" do |
30 | 27 | App.should_receive(:report_error!).with(@xml).and_return(@notice) |
31 | - get :create, {:data => @xml} | |
28 | + get :create, :data => @xml, :format => :xml | |
32 | 29 | response.should be_success |
33 | 30 | response.body.should match(%r{<id[^>]*>#{@notice.id}</id>}) |
34 | 31 | end |
... | ... | @@ -36,7 +33,7 @@ describe NoticesController do |
36 | 33 | it "sends a notification email" do |
37 | 34 | App.should_receive(:report_error!).with(@xml).and_return(@notice) |
38 | 35 | request.should_receive(:raw_post).and_return(@xml) |
39 | - post :create | |
36 | + post :create, :format => :xml | |
40 | 37 | response.should be_success |
41 | 38 | response.body.should match(%r{<id[^>]*>#{@notice.id}</id>}) |
42 | 39 | email = ActionMailer::Base.deliveries.last | ... | ... |