aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-02-12 20:07:01 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2016-02-12 20:13:48 +0100
commitda1fbb9a00e330331d00f27c8a40ea62d0d1d224 (patch)
treec806f0c7e34cbc0f1afb71070d83f1e80a0175fd /actionpack
parent354fb73ff26452be52656c793502431f03a05563 (diff)
downloadrails-da1fbb9a00e330331d00f27c8a40ea62d0d1d224.tar.gz
rails-da1fbb9a00e330331d00f27c8a40ea62d0d1d224.tar.bz2
rails-da1fbb9a00e330331d00f27c8a40ea62d0d1d224.zip
Add fixes accidentally removed.
Yesterday, when improving how `parsed_body` extracted a parser I wrote 77bbf1e. Then I thought that was too many changes in one commit and broke it up locally... or so I thought. When pushed the extra commits removed the changes! Wups! In shame, lob those changes together here: * 3b94c38 which meant to fix the CHANGELOG syntax error. * 5007df5 which meant to mention `parsed_body` in the docs. * 036a7a0 which meant to memoize the `parsed_body`.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG.md2
-rw-r--r--actionpack/lib/action_dispatch/testing/integration.rb3
-rw-r--r--actionpack/lib/action_dispatch/testing/test_response.rb2
3 files changed, 4 insertions, 3 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index b3283c1974..931313612c 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -26,7 +26,7 @@
class ApiTest < ActionDispatch::IntegrationTest
test 'creates articles' do
assert_difference -> { Article.count } do
- post articles_path, { article: { title: 'Ahoy!' } }, as: :json
+ post articles_path, params: { article: { title: 'Ahoy!' } }, as: :json
end
assert_equal({ 'id' => Article.last.id, 'title' => 'Ahoy!' }, response.parsed_body)
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb
index 8a8e22053a..f4534b4173 100644
--- a/actionpack/lib/action_dispatch/testing/integration.rb
+++ b/actionpack/lib/action_dispatch/testing/integration.rb
@@ -729,7 +729,8 @@ module ActionDispatch
# response_parser: -> body { body }
#
# Where `param_encoder` defines how the params should be encoded and
- # `response_parser` defines how the response body should be parsed.
+ # `response_parser` defines how the response body should be parsed through
+ # `parsed_body`.
#
# Consult the Rails Testing Guide for more.
diff --git a/actionpack/lib/action_dispatch/testing/test_response.rb b/actionpack/lib/action_dispatch/testing/test_response.rb
index 4f289ad4b5..9d4b73a43d 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
- @response_parser.call(body)
+ @parsed_body ||= @response_parser.call(body)
end
end
end