aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/webservice_test.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-09-18 14:35:48 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-09-18 14:35:48 -0700
commita9334616120cffb560017e6a563ad401e425602b (patch)
tree0b2817c02e95a7966c82c261264cbdf1f946f2a6 /actionpack/test/controller/webservice_test.rb
parent77370f27db8b70f67756e6948a4bd4a102cdbb7a (diff)
parent58dba19a0b0e4f71927b3262970f0d5dcb8990ea (diff)
downloadrails-a9334616120cffb560017e6a563ad401e425602b.tar.gz
rails-a9334616120cffb560017e6a563ad401e425602b.tar.bz2
rails-a9334616120cffb560017e6a563ad401e425602b.zip
Merge branch 'pp'
* pp: remove outdated comment all parameter parsing is done through the request object now. let the request object handle parsing XML posts remove setting request parameters for JSON requests remove the request parameter from `parse_formatted_parameters` do not instantiate a param parser middleware push the parameter parsers on to the class stop eagerly parsing parameters only wrap the strategy with exception handling pull `normalize_encode_params` up remove the `default` parameter from the parser method move parameter parsing to the request object
Diffstat (limited to 'actionpack/test/controller/webservice_test.rb')
-rw-r--r--actionpack/test/controller/webservice_test.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/actionpack/test/controller/webservice_test.rb b/actionpack/test/controller/webservice_test.rb
index b26f037c36..8b37c9599e 100644
--- a/actionpack/test/controller/webservice_test.rb
+++ b/actionpack/test/controller/webservice_test.rb
@@ -97,24 +97,28 @@ class WebServiceTest < ActionDispatch::IntegrationTest
end
def test_parsing_json_doesnot_rescue_exception
- with_test_route_set do
- with_params_parsers Mime::JSON => Proc.new { |data| raise Interrupt } do
- assert_raises(Interrupt) do
- post "/",
- params: '{"title":"JSON"}}',
- headers: { 'CONTENT_TYPE' => 'application/json' }
- end
+ req = Class.new(ActionDispatch::Request) do
+ def params_parsers
+ { Mime::JSON => Proc.new { |data| raise Interrupt } }
end
+
+ def content_length; get_header('rack.input').length; end
+ end.new({ 'rack.input' => StringIO.new('{"title":"JSON"}}'), 'CONTENT_TYPE' => 'application/json' })
+
+ assert_raises(Interrupt) do
+ req.request_parameters
end
end
private
def with_params_parsers(parsers = {})
old_session = @integration_session
- @app = ActionDispatch::ParamsParser.new(app.routes, parsers)
+ original_parsers = ActionDispatch::Request.parameter_parsers
+ ActionDispatch::Request.parameter_parsers = original_parsers.merge parsers
reset!
yield
ensure
+ ActionDispatch::Request.parameter_parsers = original_parsers
@integration_session = old_session
end