Changeset 9242 for trunk/actionpack/test
- Timestamp:
- 04/08/08 05:05:54 (6 months ago)
- Files:
-
- trunk/actionpack/test/controller/request_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/test/controller/request_test.rb
r9194 r9242 852 852 end 853 853 854 855 854 class XmlParamsParsingTest < Test::Unit::TestCase 855 def test_hash_params 856 person = parse_body("<person><name>David</name></person>")[:person] 857 assert_kind_of Hash, person 858 assert_equal 'David', person['name'] 859 end 860 856 861 def test_single_file 857 862 person = parse_body("<person><name>David</name><avatar type='file' name='me.jpg' content_type='image/jpg'>#{ActiveSupport::Base64.encode64('ABC')}</avatar></person>") … … 900 905 end 901 906 end 907 908 class JsonParamsParsingTest < Test::Unit::TestCase 909 def test_hash_params 910 person = parse_body({:person => {:name => "David"}}.to_json)[:person] 911 assert_kind_of Hash, person 912 assert_equal 'David', person['name'] 913 end 914 915 private 916 def parse_body(body) 917 env = { 'CONTENT_TYPE' => 'application/json', 918 'CONTENT_LENGTH' => body.size.to_s } 919 cgi = ActionController::Integration::Session::StubCGI.new(env, body) 920 ActionController::CgiRequest.new(cgi).request_parameters 921 end 922 end