From de37f7df4f6bfe369598b2f92b07ce9c2c212e76 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 12 Mar 2006 16:03:44 +0000 Subject: Mime types are separated by a comma, not semicolon, in the Accept header. Also switch all internal configuration of mime types away from strings and over to Mime::Type [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3847 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/mime_responds_test.rb | 4 ++-- actionpack/test/controller/webservice_test.rb | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'actionpack/test/controller') diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index 1470fa9899..159d57f1c3 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -111,7 +111,7 @@ class MimeControllerTest < Test::Unit::TestCase end def test_js_or_html - @request.env["HTTP_ACCEPT"] = "text/javascript; text/html" + @request.env["HTTP_ACCEPT"] = "text/javascript, text/html" get :js_or_html assert_equal 'JS', @response.body @@ -123,7 +123,7 @@ class MimeControllerTest < Test::Unit::TestCase end def test_js_or_anything - @request.env["HTTP_ACCEPT"] = "text/javascript; */*" + @request.env["HTTP_ACCEPT"] = "text/javascript, */*" get :js_or_html assert_equal 'JS', @response.body diff --git a/actionpack/test/controller/webservice_test.rb b/actionpack/test/controller/webservice_test.rb index 2243397d87..c99abeaa9e 100644 --- a/actionpack/test/controller/webservice_test.rb +++ b/actionpack/test/controller/webservice_test.rb @@ -28,7 +28,7 @@ class WebServiceTest < Test::Unit::TestCase def setup @controller = TestController.new ActionController::Base.param_parsers.clear - ActionController::Base.param_parsers['application/xml'] = :xml_node + ActionController::Base.param_parsers[Mime::XML] = :xml_node end def test_check_parameters @@ -55,7 +55,7 @@ class WebServiceTest < Test::Unit::TestCase end def test_register_and_use_yaml - ActionController::Base.param_parsers['application/x-yaml'] = Proc.new { |d| YAML.load(d) } + ActionController::Base.param_parsers[Mime::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) @@ -63,7 +63,7 @@ class WebServiceTest < Test::Unit::TestCase end def test_register_and_use_yaml_as_symbol - ActionController::Base.param_parsers['application/x-yaml'] = :yaml + ActionController::Base.param_parsers[Mime::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) @@ -71,7 +71,7 @@ class WebServiceTest < Test::Unit::TestCase end def test_register_and_use_xml_simple - ActionController::Base.param_parsers['application/xml'] = Proc.new { |data| XmlSimple.xml_in(data, 'ForceArray' => false) } + ActionController::Base.param_parsers[Mime::XML] = Proc.new { |data| XmlSimple.xml_in(data, 'ForceArray' => false) } process('POST', 'application/xml', 'content...SimpleXml' ) assert_equal 'summary, title', @controller.response.body assert @controller.params.has_key?(:summary) @@ -82,7 +82,7 @@ class WebServiceTest < Test::Unit::TestCase def test_deprecated_request_methods process('POST', 'application/x-yaml') - assert_equal 'application/x-yaml', @controller.request.content_type + assert_equal Mime::YAML, @controller.request.content_type assert_equal true, @controller.request.post? assert_equal :yaml, @controller.request.post_format assert_equal true, @controller.request.yaml_post? -- cgit v1.2.3