Commit 3390f8f7 authored by maeda's avatar maeda

Test that Redmine::MimeType.css_class_of, main_mimetype_of and is_type? are...

Test that Redmine::MimeType.css_class_of, main_mimetype_of and is_type? are case-insensitive (#29359).


git-svn-id: https://svn.redmine.org/redmine/trunk@17472 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 234e5190
...@@ -36,6 +36,7 @@ class Redmine::MimeTypeTest < ActiveSupport::TestCase ...@@ -36,6 +36,7 @@ class Redmine::MimeTypeTest < ActiveSupport::TestCase
def test_css_class_of def test_css_class_of
to_test = {'test.txt' => 'text-plain', to_test = {'test.txt' => 'text-plain',
'test.c' => 'text-x-c', 'test.c' => 'text-x-c',
'TEST.JPG' => 'image-jpeg',
} }
to_test.each do |name, expected| to_test.each do |name, expected|
assert_equal expected, Redmine::MimeType.css_class_of(name) assert_equal expected, Redmine::MimeType.css_class_of(name)
...@@ -49,6 +50,7 @@ class Redmine::MimeTypeTest < ActiveSupport::TestCase ...@@ -49,6 +50,7 @@ class Redmine::MimeTypeTest < ActiveSupport::TestCase
def test_main_mimetype_of def test_main_mimetype_of
to_test = {'test.txt' => 'text', to_test = {'test.txt' => 'text',
'test.c' => 'text', 'test.c' => 'text',
'TEST.JPG' => 'image',
} }
to_test.each do |name, expected| to_test.each do |name, expected|
assert_equal expected, Redmine::MimeType.main_mimetype_of(name) assert_equal expected, Redmine::MimeType.main_mimetype_of(name)
...@@ -63,6 +65,7 @@ class Redmine::MimeTypeTest < ActiveSupport::TestCase ...@@ -63,6 +65,7 @@ class Redmine::MimeTypeTest < ActiveSupport::TestCase
to_test = {['text', 'test.unk'] => false, to_test = {['text', 'test.unk'] => false,
['text', 'test.txt'] => true, ['text', 'test.txt'] => true,
['text', 'test.c'] => true, ['text', 'test.c'] => true,
['image', 'TEST.JPG'] => true,
} }
to_test.each do |args, expected| to_test.each do |args, expected|
assert_equal expected, Redmine::MimeType.is_type?(*args) assert_equal expected, Redmine::MimeType.is_type?(*args)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment