diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2011-05-02 19:21:03 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2011-05-02 19:21:03 -0500 |
commit | b359f9fe7cc3f664e145fae7b0d5b5c309587ef8 (patch) | |
tree | 386bac9ca264c2355741ba967334030f518b73fa /actionpack/test/dispatch/request/xml_params_parsing_test.rb | |
parent | b29a905f949dbed5052c55184bd5e0838517ec8d (diff) | |
parent | 35d0d82ae3edf8fe959624999c858a63b2b4ed52 (diff) | |
download | rails-b359f9fe7cc3f664e145fae7b0d5b5c309587ef8.tar.gz rails-b359f9fe7cc3f664e145fae7b0d5b5c309587ef8.tar.bz2 rails-b359f9fe7cc3f664e145fae7b0d5b5c309587ef8.zip |
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'actionpack/test/dispatch/request/xml_params_parsing_test.rb')
-rw-r--r-- | actionpack/test/dispatch/request/xml_params_parsing_test.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request/xml_params_parsing_test.rb b/actionpack/test/dispatch/request/xml_params_parsing_test.rb index ad9de02eb4..38453dfe48 100644 --- a/actionpack/test/dispatch/request/xml_params_parsing_test.rb +++ b/actionpack/test/dispatch/request/xml_params_parsing_test.rb @@ -115,3 +115,41 @@ class LegacyXmlParamsParsingTest < XmlParamsParsingTest {'HTTP_X_POST_DATA_FORMAT' => 'xml'} end end + +class RootLessXmlParamsParsingTest < ActionDispatch::IntegrationTest + class TestController < ActionController::Base + wrap_parameters :person, :format => :xml + + class << self + attr_accessor :last_request_parameters + end + + def parse + self.class.last_request_parameters = request.request_parameters + head :ok + end + end + + def teardown + TestController.last_request_parameters = nil + end + + test "parses hash params" do + with_test_routing do + xml = "<name>David</name>" + post "/parse", xml, {'CONTENT_TYPE' => 'application/xml'} + assert_response :ok + assert_equal({"name" => "David", "person" => {"name" => "David"}}, TestController.last_request_parameters) + end + end + + private + def with_test_routing + with_routing do |set| + set.draw do + match ':action', :to => ::RootLessXmlParamsParsingTest::TestController + end + yield + end + end +end |