aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-07-29 17:55:39 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-07-29 21:43:05 -0700
commit06c9e176ca1b74e99bc258295bfbd8d2f2f33563 (patch)
tree91e30b7d53d158e43a0f444bf52cd8688d85516d /actionpack/test
parent01b812672a3ef6f1032bfff5e818f1ad8957e378 (diff)
downloadrails-06c9e176ca1b74e99bc258295bfbd8d2f2f33563.tar.gz
rails-06c9e176ca1b74e99bc258295bfbd8d2f2f33563.tar.bz2
rails-06c9e176ca1b74e99bc258295bfbd8d2f2f33563.zip
raise exceptions on header set after response committed
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/live_response_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/live_response_test.rb b/actionpack/test/dispatch/live_response_test.rb
index 70dd7524aa..d17d516a0b 100644
--- a/actionpack/test/dispatch/live_response_test.rb
+++ b/actionpack/test/dispatch/live_response_test.rb
@@ -40,6 +40,25 @@ module ActionController
@response.stream.write 'omg'
assert_nil @response.headers['Content-Length']
end
+
+ def test_headers_cannot_be_written_after_write
+ @response.stream.write 'omg'
+
+ e = assert_raises(ActionDispatch::IllegalStateError) do
+ @response.headers['Content-Length'] = "zomg"
+ end
+
+ assert_equal 'header already sent', e.message
+ end
+
+ def test_headers_cannot_be_written_after_close
+ @response.stream.close
+
+ e = assert_raises(ActionDispatch::IllegalStateError) do
+ @response.headers['Content-Length'] = "zomg"
+ end
+ assert_equal 'header already sent', e.message
+ end
end
end
end