Add special mime type overrides

This commit is contained in:
Joshua Peek
2011-05-11 16:14:43 -05:00
parent 8e7274e07a
commit aac2ed2d20
5 changed files with 108 additions and 7 deletions

20
test/test_mime.rb Normal file
View File

@@ -0,0 +1,20 @@
require 'linguist/mime'
require 'test/unit'
class TestMime < Test::Unit::TestCase
include Linguist
def test_lookup
assert_equal 'application/ruby', Mime.lookup(".rb")
assert_equal 'application/javascript', Mime.lookup(".js")
assert_equal 'application/python', Mime.lookup(".py")
assert_equal 'text/plain; charset=utf-8', Mime.lookup(".kt")
assert_equal 'text/plain; charset=utf-8', Mime.lookup(".html")
assert_equal 'text/plain; charset=utf-8', Mime.lookup(".sh")
assert_equal 'text/plain; charset=utf-8', Mime.lookup(".latex")
assert_equal 'application/octet-stream', Mime.lookup(".dmg")
end
end

View File

@@ -55,7 +55,6 @@ class TestPathname < Test::Unit::TestCase
assert_equal 'application/ruby', Pathname.new("file.rb").mime_type
assert_equal 'application/javascript', Pathname.new("file.js").mime_type
assert_equal 'application/python', Pathname.new("itty.py").mime_type
assert_equal 'text/plain', Pathname.new("itty.nu").mime_type
assert_equal 'text/plain', Pathname.new("defun.kt").mime_type
assert_equal 'text/plain; charset=utf-8', Pathname.new("defun.kt").mime_type
end
end