aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorAditya Sanghi <asanghi@me.com>2012-02-17 15:10:52 +0530
committerAditya Sanghi <asanghi@me.com>2012-02-17 15:10:52 +0530
commitdffd85a1922d4169311f98d7560564d4356f8631 (patch)
tree4f55603eef3da63cd2d257a794da31b5a91fdcbf /actionpack/test
parenta1b9acb72ec4b3a3d11f77efe64effb79e58b45d (diff)
downloadrails-dffd85a1922d4169311f98d7560564d4356f8631.tar.gz
rails-dffd85a1922d4169311f98d7560564d4356f8631.tar.bz2
rails-dffd85a1922d4169311f98d7560564d4356f8631.zip
backporting #4918 to 3.2 stable; adding extra test for accept header given by googlebot
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/mime_type_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/mime_type_test.rb b/actionpack/test/dispatch/mime_type_test.rb
index db21080c42..a1a7ceff03 100644
--- a/actionpack/test/dispatch/mime_type_test.rb
+++ b/actionpack/test/dispatch/mime_type_test.rb
@@ -69,6 +69,18 @@ class MimeTypeTest < ActiveSupport::TestCase
assert_equal expect, Mime::Type.parse(accept)
end
+ test "parse single media range with q" do
+ accept = "text/html;q=0.9"
+ expect = [Mime::HTML]
+ assert_equal expect, Mime::Type.parse(accept)
+ end
+
+ test "parse any media range with q" do
+ accept = "*/*;q=0.9"
+ expect = [Mime::ALL]
+ assert_equal expect, Mime::Type.parse(accept)
+ end
+
# Accept header send with user HTTP_USER_AGENT: Sunrise/0.42j (Windows XP)
test "parse broken acceptlines" do
accept = "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/*,,*/*;q=0.5"