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:
parent
3c8e0a47f9
commit
cbd10e27d1
1 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue