diff options
author | Carlhuda <carlhuda@engineyard.com> | 2010-03-18 17:32:53 -0700 |
---|---|---|
committer | Carlhuda <carlhuda@engineyard.com> | 2010-03-18 17:32:53 -0700 |
commit | 1dacc19702f88a18a57615d1a5eeab3d0f5f9007 (patch) | |
tree | 1ba168d616d1a6fd4086919d59cb2266a1667dd7 /actionpack/test | |
parent | edb5991a14e0dfb65d2b8802d61b44fc47004921 (diff) | |
download | rails-1dacc19702f88a18a57615d1a5eeab3d0f5f9007.tar.gz rails-1dacc19702f88a18a57615d1a5eeab3d0f5f9007.tar.bz2 rails-1dacc19702f88a18a57615d1a5eeab3d0f5f9007.zip |
Return a valid Rack response from bare ActionController::Metal
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/new_base/bare_metal_test.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/actionpack/test/controller/new_base/bare_metal_test.rb b/actionpack/test/controller/new_base/bare_metal_test.rb new file mode 100644 index 0000000000..df4b39a103 --- /dev/null +++ b/actionpack/test/controller/new_base/bare_metal_test.rb @@ -0,0 +1,27 @@ +require "abstract_unit" + +module BareMetalTest + class BareController < ActionController::Metal + def index + self.response_body = "Hello world" + end + end + + class BareTest < ActiveSupport::TestCase + test "response body is a Rack-compatible response" do + status, headers, body = BareController.action(:index).call(Rack::MockRequest.env_for("/")) + assert_equal 200, status + string = "" + + body.each do |part| + assert part.is_a?(String), "Each part of the body must be a String" + string << part + end + + assert headers.is_a?(Hash), "Headers must be a Hash" + assert headers["Content-Type"], "Content-Type must exist" + + assert_equal "Hello world", string + end + end +end
\ No newline at end of file |