diff options
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/mime_type_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/test/controller/mime_type_test.rb b/actionpack/test/controller/mime_type_test.rb index 0425b034c5..1c944697d4 100644 --- a/actionpack/test/controller/mime_type_test.rb +++ b/actionpack/test/controller/mime_type_test.rb @@ -22,6 +22,13 @@ class MimeTypeTest < Test::Unit::TestCase assert_equal expect, Mime::Type.parse(accept) end + # Accept header send with user HTTP_USER_AGENT: Sunrise/0.42j (Windows XP) + def test_parse_crappy_broken_acceptlines + accept = "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/*,,*/*;q=0.5" + expect = [Mime::HTML, Mime::XML, "image/*", Mime::TEXT, Mime::ALL] + assert_equal expect, Mime::Type.parse(accept).collect { |c| c.to_s } + end + def test_custom_type Mime::Type.register("image/gif", :gif) assert_nothing_raised do |