提交 cbd10e27 编写于 作者: M Myron Marston 提交者: Dan Kang

Add missing test for response destructuring.

上级 3c8e0a47
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册