aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorKir Shatrov <shatrov@me.com>2016-09-21 13:16:59 -0400
committerKir Shatrov <shatrov@me.com>2016-09-21 13:16:59 -0400
commitaa7c4179ff3b0dba6c14e45cecaf853ac9446d41 (patch)
tree6242a8d2b1aa395d83065857fabaf7124500d512 /actionpack/lib/action_controller
parentcf5f55cd30aef0f90300c7c8f333060fe258cd8a (diff)
downloadrails-aa7c4179ff3b0dba6c14e45cecaf853ac9446d41.tar.gz
rails-aa7c4179ff3b0dba6c14e45cecaf853ac9446d41.tar.bz2
rails-aa7c4179ff3b0dba6c14e45cecaf853ac9446d41.zip
Make :as option also set request format (AC::TestCase)
right now you'd have to specify both :as and :format: ``` post :create, params: { foo: "bar" } as: :json, format: :json ```
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/test_case.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index 16ddd3b304..513d3afd16 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -498,10 +498,6 @@ module ActionController
parameters ||= {}
- if format
- parameters[:format] = format
- end
-
@html_document = nil
cookies.update(@request.cookies)
@@ -521,6 +517,10 @@ module ActionController
format ||= as
end
+ if format
+ parameters[:format] = format
+ end
+
parameters = parameters.symbolize_keys
generated_extras = @routes.generate_extras(parameters.merge(controller: controller_class_name, action: action.to_s))