aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-03-12 16:03:44 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-03-12 16:03:44 +0000
commitde37f7df4f6bfe369598b2f92b07ce9c2c212e76 (patch)
treec1a4b5833b843580eb87db1221befba0e6ee8e24 /actionpack/test/controller
parent3a90c31a566ec3a818e5cc8f0c2dca58ad305c27 (diff)
downloadrails-de37f7df4f6bfe369598b2f92b07ce9c2c212e76.tar.gz
rails-de37f7df4f6bfe369598b2f92b07ce9c2c212e76.tar.bz2
rails-de37f7df4f6bfe369598b2f92b07ce9c2c212e76.zip
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
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/mime_responds_test.rb4
-rw-r--r--actionpack/test/controller/webservice_test.rb10
2 files changed, 7 insertions, 7 deletions
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', '<request><summary>content...</summary><title>SimpleXml</title></request>' )
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?