Permalink
Browse files

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

…callback and an error happens
  • Loading branch information...
1 parent a92c707 commit 9af4258186027e5a80bd5a0c821862378e1492ad @tenderlove tenderlove committed Feb 28, 2014
@@ -108,7 +108,7 @@ def perform_write(json, options)
class Buffer < ActionDispatch::Response::Buffer #:nodoc:
def initialize(response)
- @error_callback = nil
+ @error_callback = lambda { true }
super(response, SizedQueue.new(10))
end
@@ -313,4 +313,11 @@ def test_stale_with_etag
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

0 comments on commit 9af4258

Please sign in to comment.