From c02adfd8e3c7ce4ad88232f34fb3b9e0697c5ee6 Mon Sep 17 00:00:00 2001 From: Julio Monteiro Date: Wed, 22 Aug 2012 15:30:47 -0300 Subject: [PATCH] request inside before don't have effect, using :format => :xml (thanks @martinciu) --- spec/controllers/notices_controller_spec.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/spec/controllers/notices_controller_spec.rb b/spec/controllers/notices_controller_spec.rb index b0beb4a..b9a6a41 100644 --- a/spec/controllers/notices_controller_spec.rb +++ b/spec/controllers/notices_controller_spec.rb @@ -11,15 +11,12 @@ describe NoticesController do @app = Fabricate(:app_with_watcher) App.stub(:find_by_api_key!).and_return(@app) @notice = App.report_error!(@xml) - - request.env['Content-type'] = 'text/xml' - request.env['Accept'] = 'text/xml, application/xml' end it "generates a notice from xml [POST]" do App.should_receive(:report_error!).with(@xml).and_return(@notice) request.should_receive(:raw_post).and_return(@xml) - post :create + post :create, :format => :xml response.should be_success # Same RegExp from Airbrake::Sender#send_to_airbrake (https://github.com/airbrake/airbrake/blob/master/lib/airbrake/sender.rb#L53) # Inspired by https://github.com/airbrake/airbrake/blob/master/test/sender_test.rb @@ -28,7 +25,7 @@ describe NoticesController do it "generates a notice from xml [GET]" do App.should_receive(:report_error!).with(@xml).and_return(@notice) - get :create, {:data => @xml} + get :create, :data => @xml, :format => :xml response.should be_success response.body.should match(%r{]*>#{@notice.id}}) end @@ -36,7 +33,7 @@ describe NoticesController do it "sends a notification email" do App.should_receive(:report_error!).with(@xml).and_return(@notice) request.should_receive(:raw_post).and_return(@xml) - post :create + post :create, :format => :xml response.should be_success response.body.should match(%r{]*>#{@notice.id}}) email = ActionMailer::Base.deliveries.last -- libgit2 0.21.2