aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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