1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add missing test for response destructuring.

This commit is contained in:
Myron Marston 2014-02-02 14:55:35 -08:00 committed by Dan Kang
parent 3c8e0a47f9
commit cbd10e27d1

View file

@ -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