diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-10 07:38:43 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-10 07:38:43 -0700 |
commit | 4d5ce4738b6f8c1d1abcd128349d3eaac1fffcde (patch) | |
tree | e62b66b1a4f159a0f278cc7a2ac6bb8ff50eb25c /actionpack/test/dispatch | |
parent | fa8b0f44bd7e0004de1b85f3eb35ad5c8e477c52 (diff) | |
parent | 2ab42dcc3ed0d37e64da10063b4162bd8e8cb4bf (diff) | |
download | rails-4d5ce4738b6f8c1d1abcd128349d3eaac1fffcde.tar.gz rails-4d5ce4738b6f8c1d1abcd128349d3eaac1fffcde.tar.bz2 rails-4d5ce4738b6f8c1d1abcd128349d3eaac1fffcde.zip |
Merge pull request #446 from danielstutzman/response_body_is_proc
New test: setting response_body to a Proc should be supported.
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/response_body_is_proc_test.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/response_body_is_proc_test.rb b/actionpack/test/dispatch/response_body_is_proc_test.rb new file mode 100644 index 0000000000..86d788b845 --- /dev/null +++ b/actionpack/test/dispatch/response_body_is_proc_test.rb @@ -0,0 +1,38 @@ +require 'abstract_unit' + +class ResponseBodyIsProcTest < ActionDispatch::IntegrationTest + class TestController < ActionController::Base + def test + request.session_options[:renew] = true + self.response_body = proc { |response, output| + puts caller + output.write 'Hello' + } + end + + def rescue_action(e) raise end + end + + def test_simple_get + with_test_route_set do + get '/test' + assert_response :success + assert_equal 'Hello', response.body + end + end + + private + def with_test_route_set(options = {}) + with_routing do |set| + set.draw do + match ':action', :to => ::ResponseBodyIsProcTest::TestController + end + + @app = self.class.build_app(set) do |middleware| + middleware.delete "ActionDispatch::ShowExceptions" + end + + yield + end + end +end |