diff options
author | Tobias Lütke <tobias.luetke@gmail.com> | 2006-03-05 19:16:55 +0000 |
---|---|---|
committer | Tobias Lütke <tobias.luetke@gmail.com> | 2006-03-05 19:16:55 +0000 |
commit | 0635f633ccfdef719e805de20b3b5b385bf72b57 (patch) | |
tree | 8ee1664aa17a70d9628108e45f214ecc57dd21a7 /actionpack/test | |
parent | 03d37a2d68c1940f65d5a65a51ae747955a5b075 (diff) | |
download | rails-0635f633ccfdef719e805de20b3b5b385bf72b57.tar.gz rails-0635f633ccfdef719e805de20b3b5b385bf72b57.tar.bz2 rails-0635f633ccfdef719e805de20b3b5b385bf72b57.zip |
ActionController::Base.param_parsers now accept symbols. currently supported are :xml_node, :xml_simple and :yaml
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3778 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/webservice_test.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/actionpack/test/controller/webservice_test.rb b/actionpack/test/controller/webservice_test.rb index 844ac723ba..6275cfb6d0 100644 --- a/actionpack/test/controller/webservice_test.rb +++ b/actionpack/test/controller/webservice_test.rb @@ -27,6 +27,8 @@ class WebServiceTest < Test::Unit::TestCase def setup @controller = TestController.new + ActionController::Base.param_parsers.clear + ActionController::Base.param_parsers['application/xml'] = :xml_node end def test_check_parameters @@ -55,12 +57,28 @@ class WebServiceTest < Test::Unit::TestCase def test_register_and_use_yaml ActionController::Base.param_parsers['application/x-yaml'] = Proc.new { |d| YAML.load(d) } process('POST', 'application/x-yaml', {"entry" => "loaded from yaml"}.to_yaml) + assert_equal 'entry', @controller.response.body assert @controller.params.has_key?(:entry) assert_equal 'loaded from yaml', @controller.params["entry"] - ensure - ActionController::Base.param_parsers['application/x-yaml'] = nil end + def test_register_and_use_yaml_as_symbol + ActionController::Base.param_parsers['application/x-yaml'] = :yaml + process('POST', 'application/x-yaml', {"entry" => "loaded from yaml"}.to_yaml) + assert_equal 'entry', @controller.response.body + assert @controller.params.has_key?(:entry) + assert_equal 'loaded from yaml', @controller.params["entry"] + end + + def test_register_and_use_xml_simple + ActionController::Base.param_parsers['application/xml'] = :xml_simple + process('POST', 'application/xml', '<request><summary>content...</summary><title>SimpleXml</title></request>' ) + assert_equal 'summary, title', @controller.response.body + assert @controller.params.has_key?(:summary) + assert @controller.params.has_key?(:title) + assert_equal 'content...', @controller.params["summary"] + assert_equal 'SimpleXml', @controller.params["title"] + end def test_deprecated_request_methods process('POST', 'application/x-yaml') |