diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2018-12-17 16:01:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-17 16:01:31 +0100 |
commit | 048e3172f51db1fddd03b89f676d96a443539a13 (patch) | |
tree | aa4d9d058ca51c746d1d7cd5839c40ff193efded /actionpack/lib/action_dispatch/testing/test_response.rb | |
parent | fdb27193087c23ea2e7a0e8f6f035c47f274dbf7 (diff) | |
parent | 8246a8139c78aca29f988274be9732b1e9f4f51d (diff) | |
download | rails-048e3172f51db1fddd03b89f676d96a443539a13.tar.gz rails-048e3172f51db1fddd03b89f676d96a443539a13.tar.bz2 rails-048e3172f51db1fddd03b89f676d96a443539a13.zip |
Merge pull request #34717 from tbuehlmann/controller-test-parsed-body
Allow using parsed_body in ActionController::TestCase
Diffstat (limited to 'actionpack/lib/action_dispatch/testing/test_response.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/testing/test_response.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/testing/test_response.rb b/actionpack/lib/action_dispatch/testing/test_response.rb index 1e6b21f235..7c1202dc0e 100644 --- a/actionpack/lib/action_dispatch/testing/test_response.rb +++ b/actionpack/lib/action_dispatch/testing/test_response.rb @@ -14,11 +14,6 @@ module ActionDispatch new response.status, response.headers, response.body end - def initialize(*) # :nodoc: - super - @response_parser = RequestEncoder.parser(content_type) - end - # Was the response successful? def success? ActiveSupport::Deprecation.warn(<<-MSG.squish) @@ -47,7 +42,11 @@ module ActionDispatch end def parsed_body - @parsed_body ||= @response_parser.call(body) + @parsed_body ||= response_parser.call(body) + end + + def response_parser + @response_parser ||= RequestEncoder.parser(content_type) end end end |