diff options
author | Myron Marston <myron.marston@gmail.com> | 2014-02-02 14:55:35 -0800 |
---|---|---|
committer | Dan Kang <dan@dskang.com> | 2014-02-08 17:40:28 -0800 |
commit | cbd10e27d1fa6e07d39dbb6fb42ce3420c5959db (patch) | |
tree | 3bea0fe91bfe4b47bca5fe6a4f7545cbcd948b3c /actionpack | |
parent | 3c8e0a47f942e435208b69d90a95eb8c6cea8cf9 (diff) | |
download | rails-cbd10e27d1fa6e07d39dbb6fb42ce3420c5959db.tar.gz rails-cbd10e27d1fa6e07d39dbb6fb42ce3420c5959db.tar.bz2 rails-cbd10e27d1fa6e07d39dbb6fb42ce3420c5959db.zip |
Add missing test for response destructuring.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/test/dispatch/response_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb index 4501ea095c..82d29867fe 100644 --- a/actionpack/test/dispatch/response_test.rb +++ b/actionpack/test/dispatch/response_test.rb @@ -217,6 +217,15 @@ class ResponseTest < ActiveSupport::TestCase assert_not @response.respond_to?(:method_missing) assert @response.respond_to?(:method_missing, true) end + + test "can be destructured into status, headers and an enumerable body" do + response = ActionDispatch::Response.new(404, { 'Content-Type' => 'text/plain' }, ['Not Found']) + status, headers, body = response + + assert_equal 404, status + assert_equal({ 'Content-Type' => 'text/plain' }, headers) + assert_equal ['Not Found'], body.each.to_a + end end class ResponseIntegrationTest < ActionDispatch::IntegrationTest |