diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-07-13 21:22:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-13 21:22:19 +0200 |
commit | 85925931fb3b5dddc8163a5c7c98a752b962beb5 (patch) | |
tree | 1eb24a3e8d4a3259fec33d37edccb304a3c250c4 /actionpack/test/dispatch | |
parent | 2bf36970a015f0a4a14ed49ba0be1fd955ddee5d (diff) | |
parent | 333670ceb96e74399645fca3201969e63c3c403b (diff) | |
download | rails-85925931fb3b5dddc8163a5c7c98a752b962beb5.tar.gz rails-85925931fb3b5dddc8163a5c7c98a752b962beb5.tar.bz2 rails-85925931fb3b5dddc8163a5c7c98a752b962beb5.zip |
Merge pull request #25771 from kaspth/make-test-response-assign-response-parser
Let TestResponse assign a parser.
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/test_response_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/test_response_test.rb b/actionpack/test/dispatch/test_response_test.rb index a4f9d56a6a..72e06b4590 100644 --- a/actionpack/test/dispatch/test_response_test.rb +++ b/actionpack/test/dispatch/test_response_test.rb @@ -17,4 +17,12 @@ class TestResponseTest < ActiveSupport::TestCase assert_response_code_range 500..599, :server_error? assert_response_code_range 400..499, :client_error? end + + test "response parsing" do + response = ActionDispatch::TestResponse.create(200, {}, '') + assert_equal response.body, response.parsed_body + + response = ActionDispatch::TestResponse.create(200, { 'Content-Type' => 'application/json' }, '{ "foo": "fighters" }') + assert_equal({ 'foo' => 'fighters' }, response.parsed_body) + end end |