1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

set the error callback to a nice default in case nobody set an error callback and an error happens

This commit is contained in:
Aaron Patterson 2014-02-28 11:57:15 -08:00
parent a92c707895
commit 9af4258186
2 changed files with 8 additions and 1 deletions

View file

@ -108,7 +108,7 @@ module ActionController
class Buffer < ActionDispatch::Response::Buffer #:nodoc:
def initialize(response)
@error_callback = nil
@error_callback = lambda { true }
super(response, SizedQueue.new(10))
end

View file

@ -313,4 +313,11 @@ module ActionController
assert_equal 304, @response.status.to_i
end
end
class BufferTest < ActionController::TestCase
def test_nil_callback
buf = ActionController::Live::Buffer.new nil
assert buf.call_on_error
end
end
end