test/filemagic_test.rb in ruby-filemagic-0.2.1 vs test/filemagic_test.rb in ruby-filemagic-0.2.2
- old
+ new
@@ -24,11 +24,11 @@
fm.close
fm = FileMagic.new(FileMagic::MAGIC_SYMLINK | FileMagic::MAGIC_MIME)
res = fm.file(path_to('pylink'))
- assert_equal('text/plain; charset=us-ascii', res)
+ assert_equal('text/plain', res)
fm.close
fm = FileMagic.new(FileMagic::MAGIC_COMPRESS)
res = fm.file(path_to('pyfile-compressed.gz'))
@@ -93,11 +93,11 @@
end
def test_mahoro_mime_file
fm = FileMagic.new
fm.flags = FileMagic::MAGIC_MIME
- assert_equal('text/x-c; charset=us-ascii', fm.file(path_to('mahoro.c')))
+ assert_equal('text/x-c', fm.file(path_to('mahoro.c')))
end
def test_mahoro_buffer
fm = FileMagic.new
fm.flags = FileMagic::MAGIC_NONE
@@ -105,15 +105,22 @@
end
def test_mahoro_mime_buffer
fm = FileMagic.new
fm.flags = FileMagic::MAGIC_MIME
- assert_equal('text/x-c; charset=us-ascii', fm.buffer(File.read(path_to('mahoro.c'))))
+ assert_equal('text/x-c', fm.buffer(File.read(path_to('mahoro.c'))))
end
def test_mahoro_valid
fm = FileMagic.new
assert(fm.valid?, 'Default database was not valid.')
+ end
+
+ # test abbreviating mime types
+
+ def test_abbrev_mime_type
+ fm = FileMagic.mime
+ assert_match(/\Aapplication\/vnd.ms-/, fm.file(path_to('excel-example.xls')))
end
# utility methods:
def path_to(file, dir = File.dirname(__FILE__))