spec/notification_spec.rb in bugsnag-1.3.8 vs spec/notification_spec.rb in bugsnag-1.4.0

- old
+ new

@@ -366,10 +366,22 @@ Bugsnag.configuration.params_filters << "other_data" Bugsnag.notify(BugsnagTestException.new("It crashed"), {:request => {:params => {:password => "1234", :other_password => "123456", :other_data => "123456"}}}) end + it "should not filter params from payload hashes if their values are nil" do + Bugsnag::Notification.should_receive(:deliver_exception_payload) do |endpoint, payload| + event = get_event_from_payload(payload) + event[:metaData].should_not be_nil + event[:metaData][:request].should_not be_nil + event[:metaData][:request][:params].should_not be_nil + event[:metaData][:request][:params].should have_key(:nil_param) + end + + Bugsnag.notify(BugsnagTestException.new("It crashed"), {:request => {:params => {:nil_param => nil}}}) + end + it "should not notify if the exception class is in the default ignore_classes list" do Bugsnag::Notification.should_not_receive(:deliver_exception_payload) Bugsnag.notify_or_ignore(ActiveRecord::RecordNotFound.new("It crashed")) end @@ -384,9 +396,19 @@ it "should not notify if the exception is matched by an ignore_classes lambda function" do Bugsnag.configuration.ignore_classes << lambda {|e| e.message =~ /crashed/} Bugsnag::Notification.should_not_receive(:deliver_exception_payload) + + Bugsnag.notify_or_ignore(BugsnagTestException.new("It crashed")) + end + + it "should not notify if the user agent is present and matches a regex in ignore_user_agents" do + Bugsnag.configuration.ignore_user_agents << %r{BugsnagUserAgent} + + Bugsnag::Notification.should_not_receive(:deliver_exception_payload) + + ((Thread.current["bugsnag_req_data"] ||= {})[:rack_env] ||= {})["HTTP_USER_AGENT"] = "BugsnagUserAgent" Bugsnag.notify_or_ignore(BugsnagTestException.new("It crashed")) end it "should not unwrap the same exception twice" do