aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-09-27 10:14:41 -0300
committerGitHub <noreply@github.com>2016-09-27 10:14:41 -0300
commitebcd9650153ae693939550a6e08898345b986023 (patch)
treed0892f90a630c1ef24a056520a4a990917f8280b /actionpack/test
parentf2f6a39ccae1508c69874c6952f7d12270b876af (diff)
parentaa7c4179ff3b0dba6c14e45cecaf853ac9446d41 (diff)
downloadrails-ebcd9650153ae693939550a6e08898345b986023.tar.gz
rails-ebcd9650153ae693939550a6e08898345b986023.tar.bz2
rails-ebcd9650153ae693939550a6e08898345b986023.zip
Merge pull request #26573 from kirs/action-controller-as-format
Make :as option also set request format (AC::TestCase)
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/test_case_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb
index 738d8bab6d..d929885aea 100644
--- a/actionpack/test/controller/test_case_test.rb
+++ b/actionpack/test/controller/test_case_test.rb
@@ -646,6 +646,11 @@ XML
assert_equal 2, @request.request_parameters[:num_value]
end
+ def test_using_as_json_sets_format_json
+ post :render_body, params: { bool_value: true, str_value: "string", num_value: 2 }, as: :json
+ assert_equal "json", @request.format
+ end
+
def test_mutating_content_type_headers_for_plain_text_files_sets_the_header
@request.headers["Content-Type"] = "text/plain"
post :render_body, params: { name: "foo.txt" }