From cbd10e27d1fa6e07d39dbb6fb42ce3420c5959db Mon Sep 17 00:00:00 2001 From: Myron Marston Date: Sun, 2 Feb 2014 14:55:35 -0800 Subject: [PATCH] Add missing test for response destructuring. --- actionpack/test/dispatch/response_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) 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 @@ def test_response_body_encoding 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 -- GitLab