Add find lexer by mimetype

This commit is contained in:
Joshua Peek
2011-06-18 20:09:11 -05:00
parent c35519c893
commit e8c09e91d5
2 changed files with 40 additions and 3 deletions

View File

@@ -32,6 +32,19 @@ class TestLexer < Test::Unit::TestCase
end
end
def test_find_by_mimetype
assert_equal Lexer['Ruby'], Lexer.find_by_mimetype('text/x-ruby')
assert_equal Lexer['Ruby'], Lexer.find_by_mimetype('application/x-ruby')
end
def test_find_all_by_mimetype
Lexer.all.each do |lexer|
lexer.mimetypes.each do |type|
assert_equal lexer, Lexer.find_by_mimetype(type)
end
end
end
def test_name
assert_equal 'Ruby', Lexer['Ruby'].name
assert_equal 'Python', Lexer['Python'].name