Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

New test: setting response_body to a Proc should be supported.

  • Loading branch information...
commit 2ab42dcc3ed0d37e64da10063b4162bd8e8cb4bf 1 parent 030e1d0
Daniel Stutzman authored
Showing with 38 additions and 0 deletions.
  1. +38 −0 actionpack/test/dispatch/response_body_is_proc_test.rb
38 actionpack/test/dispatch/response_body_is_proc_test.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.