aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-02-10 22:00:13 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2016-02-10 22:05:08 +0100
commitc85b17773e943a227d6b559736aeb40a3b214b71 (patch)
tree7a9c8b528f902bb6cf3a5b82764f566292e11955 /actionpack
parenteee3534b1a5614d824a34e2c761faaeab07c2eb4 (diff)
downloadrails-c85b17773e943a227d6b559736aeb40a3b214b71.tar.gz
rails-c85b17773e943a227d6b559736aeb40a3b214b71.tar.bz2
rails-c85b17773e943a227d6b559736aeb40a3b214b71.zip
Add request encoding and response parsing to changelog.
Forgot to add this in the original pull request. No biggie, just show some examples.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG.md38
1 files changed, 38 insertions, 0 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index 93e598e493..bf964d06e9 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -1,3 +1,41 @@
+* Add request encoding and response parsing to integration tests.
+
+ What previously was:
+
+ ```ruby
+ require 'test_helper'
+
+ class ApiTest < ActionDispatch::IntegrationTest
+ test 'creates articles' do
+ assert_difference -> { Article.count } do
+ post articles_path(format: :json),
+ params: { article: { title: 'Ahoy!' } }.to_json,
+ headers: { 'Content-Type' => 'application/json' }
+ end
+
+ assert_equal({ id: Article.last.id, title: 'Ahoy!' }, JSON.parse(response.body))
+ end
+ end
+ ```
+
+ Can now be written as:
+
+ ```ruby
+ require 'test_helper'
+
+ class ApiTest < ActionDispatch::IntegrationTest
+ test 'creates articles' do
+ assert_difference -> { Article.count } do
+ post articles_path, { article: { title: 'Ahoy!' } }, as: :json
+ end
+
+ assert_equal({ id: Article.last.id, title: 'Ahoy!' }, response.parsed_body)
+ end
+ end
+ ```
+
+ *Kasper Timm Hansen*
+
* Add image/svg+xml as a default mime type.
*DHH*