diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-02-11 22:44:46 +0100 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2016-02-11 22:47:18 +0100 |
commit | 036a7a03cf4334c79f397d2a81b3df41047daf94 (patch) | |
tree | 2f17fe8d1224558b5f2295de24a2ca0e81254efb /actionpack/lib/action_dispatch | |
parent | 5007df5ea53efaf7d8f14994bea6bc3e0adc67f6 (diff) | |
download | rails-036a7a03cf4334c79f397d2a81b3df41047daf94.tar.gz rails-036a7a03cf4334c79f397d2a81b3df41047daf94.tar.bz2 rails-036a7a03cf4334c79f397d2a81b3df41047daf94.zip |
Memoize `parsed_body`.
It's common to use several assertions on the parsed response. The response
bodies aren't meant to be mutated. People should make new test requests
instead.
Thus, it should be safe to memoize the parsing.
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/testing/test_response.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/testing/test_response.rb b/actionpack/lib/action_dispatch/testing/test_response.rb index 9d4b73a43d..4f289ad4b5 100644 --- a/actionpack/lib/action_dispatch/testing/test_response.rb +++ b/actionpack/lib/action_dispatch/testing/test_response.rb @@ -22,7 +22,7 @@ module ActionDispatch attr_writer :response_parser # :nodoc: def parsed_body - @parsed_body ||= @response_parser.call(body) + @response_parser.call(body) end end end |