diff options
Diffstat (limited to 'actionpack/CHANGELOG.md')
-rw-r--r-- | actionpack/CHANGELOG.md | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index bf964d06e9..d473ab427d 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -1,3 +1,7 @@ +* Add application/gzip as a default mime type. + + *Mehmet Emin İNAÇ* + * Add request encoding and response parsing to integration tests. What previously was: @@ -13,7 +17,7 @@ headers: { 'Content-Type' => 'application/json' } end - assert_equal({ id: Article.last.id, title: 'Ahoy!' }, JSON.parse(response.body)) + assert_equal({ 'id' => Article.last.id, 'title' => 'Ahoy!' }, JSON.parse(response.body)) end end ``` @@ -26,13 +30,22 @@ 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) + assert_equal({ 'id' => Article.last.id, 'title' => 'Ahoy!' }, response.parsed_body) end end ``` + + Passing `as: :json` to integration test request helpers will set the format, + content type and encode the parameters as JSON. + + Then on the response side, `parsed_body` will parse the body according to the + content type the response has. + + Currently JSON is the only supported MIME type. Add your own with + `ActionDispatch::IntegrationTest.register_encoder`. *Kasper Timm Hansen* @@ -42,11 +55,10 @@ ## Rails 5.0.0.beta2 (February 01, 2016) ## -* Add `-g` and `-c` (short for _grep_ and _controller_ respectively) options - to `bin/rake routes`. These options return the url `name`, `verb` and +* Add `-g` and `-c` options to `bin/rails routes`. These options return the url `name`, `verb` and `path` field that match the pattern or match a specific controller. - Deprecate `CONTROLLER` env variable in `bin/rake routes`. + Deprecate `CONTROLLER` env variable in `bin/rails routes`. See #18902. |