Permalink
Browse files

Test the middleware - notifications are not sent when the exceptions …

…is to be ignored
  • Loading branch information...
1 parent d25f24e commit f705c0f199fc00ee4a5b7ff8b565dd4b8d15be11 Mikko Nylén committed Nov 5, 2010
Showing with 13 additions and 1 deletion.
  1. +13 −1 spec/fail_middleware_spec.rb
@@ -2,7 +2,10 @@
describe Failurous::Rails::FailMiddleware do
before(:all) do
- Failurous::Rails.configure(false) { }
+ Failurous::Rails.configure(false) do |config|
+ config.ignore_exceptions << ArgumentError
+ end
+
@app = MockApp.new
@middleware = Failurous::Rails::FailMiddleware.new(@app)
end
@@ -16,6 +19,15 @@
Failurous.should_receive(:notify).with(error, kontroller)
lambda { @middleware.call(env) }.should raise_error(StandardError)
end
+
+ it "should not notify of ignored errors, but raise them to upper levels" do
+ error = ArgumentError.new
+ kontroller = mock()
+ @app.should_receive(:call).once().and_raise(error)
+
+ Failurous.should_not_receive(:notify)
+ lambda { @middleware.call({}) }.should raise_error(ArgumentError)
+ end
end
class MockApp

0 comments on commit f705c0f

Please sign in to comment.