提交 e312cc32 编写于 作者: R Rick Olson

remove Mime::PLAIN from tests so its not confused with the default Mime::TEXT mime type

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6153 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 5d54b8f0
......@@ -2,7 +2,7 @@
class MimeTypeTest < Test::Unit::TestCase
Mime::Type.register "image/png", :png
Mime::Type.register "text/plain", :plain
Mime::Type.register "application/pdf", :pdf
def test_parse_single
Mime::LOOKUP.keys.each do |mime_type|
......@@ -11,14 +11,14 @@ def test_parse_single
end
def test_parse_without_q
accept = "text/xml,application/xhtml+xml,text/yaml,application/xml,text/html,image/png,text/plain,*/*"
expect = [Mime::HTML, Mime::XML, Mime::YAML, Mime::PNG, Mime::PLAIN, Mime::ALL]
accept = "text/xml,application/xhtml+xml,text/yaml,application/xml,text/html,image/png,text/plain,application/pdf,*/*"
expect = [Mime::HTML, Mime::XML, Mime::YAML, Mime::PNG, Mime::TEXT, Mime::PDF, Mime::ALL]
assert_equal expect, Mime::Type.parse(accept)
end
def test_parse_with_q
accept = "text/xml,application/xhtml+xml,text/yaml; q=0.3,application/xml,text/html; q=0.8,image/png,text/plain; q=0.5,*/*; q=0.2"
expect = [Mime::HTML, Mime::XML, Mime::PNG, Mime::PLAIN, Mime::YAML, Mime::ALL]
accept = "text/xml,application/xhtml+xml,text/yaml; q=0.3,application/xml,text/html; q=0.8,image/png,text/plain; q=0.5,application/pdf,*/*; q=0.2"
expect = [Mime::HTML, Mime::XML, Mime::PNG, Mime::PDF, Mime::TEXT, Mime::YAML, Mime::ALL]
assert_equal expect, Mime::Type.parse(accept)
end
......@@ -32,7 +32,7 @@ def test_custom_type
end
def test_type_convenience_methods
types = [:html, :xml, :png, :plain, :yaml]
types = [:html, :xml, :png, :pdf, :yaml]
types.each do |type|
mime = Mime.const_get(type.to_s.upcase)
assert mime.send("#{type}?"), "Mime::#{type.to_s.upcase} is not #{type}?"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册