Permalink
Browse files

Add missing test for response destructuring.

  • Loading branch information...
myronmarston authored and dskang committed Feb 2, 2014
1 parent 3c8e0a4 commit cbd10e27d1fa6e07d39dbb6fb42ce3420c5959db
Showing with 9 additions and 0 deletions.
  1. +9 −0 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

0 comments on commit cbd10e2

Please sign in to comment.