diff --git a/spec/controllers/notices_controller_spec.rb b/spec/controllers/notices_controller_spec.rb index fb0d589..be32eb1 100644 --- a/spec/controllers/notices_controller_spec.rb +++ b/spec/controllers/notices_controller_spec.rb @@ -13,7 +13,7 @@ describe NoticesController do @notice = App.report_error!(@xml) end - it "generates a notice from xml [POST]" do + it "generates a notice from raw xml [POST]" do App.should_receive(:report_error!).with(@xml).and_return(@notice) request.should_receive(:raw_post).and_return(@xml) post :create, :format => :xml @@ -24,6 +24,16 @@ describe NoticesController do response.body.should match(%r{]*>(.+)#{locate_path(@notice.id)}}) end + it "generates a notice from xml in a data param [POST]" do + App.should_receive(:report_error!).with(@xml).and_return(@notice) + post :create, :data => @xml, :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 + response.body.should match(%r{]*>#{@notice.id}}) + response.body.should match(%r{]*>(.+)#{locate_path(@notice.id)}}) + end + it "generates a notice from xml [GET]" do App.should_receive(:report_error!).with(@xml).and_return(@notice) get :create, :data => @xml, :format => :xml -- libgit2 0.21.2