From 1cada7b6b79001346d3deb0d1f97e5917d49bb36 Mon Sep 17 00:00:00 2001 From: Robert Lail Date: Wed, 29 Aug 2012 20:05:51 -0500 Subject: [PATCH] added a spec to ensure that you can post a notice with the XML in a data param --- spec/controllers/notices_controller_spec.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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