Skip to content

Commit

Permalink
Test the middleware - notifications are not sent when the exceptions …
Browse files Browse the repository at this point in the history
…is to be ignored
  • Loading branch information
Mikko Nylén committed Nov 5, 2010
1 parent d25f24e commit f705c0f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion spec/fail_middleware_spec.rb
Expand Up @@ -2,7 +2,10 @@


describe Failurous::Rails::FailMiddleware do describe Failurous::Rails::FailMiddleware do
before(:all) do before(:all) do
Failurous::Rails.configure(false) { } Failurous::Rails.configure(false) do |config|
config.ignore_exceptions << ArgumentError
end

@app = MockApp.new @app = MockApp.new
@middleware = Failurous::Rails::FailMiddleware.new(@app) @middleware = Failurous::Rails::FailMiddleware.new(@app)
end end
Expand All @@ -16,6 +19,15 @@
Failurous.should_receive(:notify).with(error, kontroller) Failurous.should_receive(:notify).with(error, kontroller)
lambda { @middleware.call(env) }.should raise_error(StandardError) lambda { @middleware.call(env) }.should raise_error(StandardError)
end 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 end


class MockApp class MockApp
Expand Down

0 comments on commit f705c0f

Please sign in to comment.