2016-08-06 12:50:17 -04:00
|
|
|
require "abstract_unit"
|
2014-02-18 14:12:51 -05:00
|
|
|
|
|
|
|
class HTMLTest < ActiveSupport::TestCase
|
2016-08-06 12:50:17 -04:00
|
|
|
test "formats returns symbol for recognized MIME type" do
|
|
|
|
assert_equal [:html], ActionView::Template::HTML.new("", :html).formats
|
2014-02-18 14:12:51 -05:00
|
|
|
end
|
|
|
|
|
2016-08-06 12:50:17 -04:00
|
|
|
test "formats returns string for recognized MIME type when MIME does not have symbol" do
|
2014-02-18 14:12:51 -05:00
|
|
|
foo = Mime::Type.lookup("foo")
|
|
|
|
assert_nil foo.to_sym
|
2016-08-06 12:50:17 -04:00
|
|
|
assert_equal ["foo"], ActionView::Template::HTML.new("", foo).formats
|
2014-02-18 14:12:51 -05:00
|
|
|
end
|
|
|
|
|
2016-08-06 12:50:17 -04:00
|
|
|
test "formats returns string for unknown MIME type" do
|
|
|
|
assert_equal ["foo"], ActionView::Template::HTML.new("", "foo").formats
|
2014-02-18 14:12:51 -05:00
|
|
|
end
|
|
|
|
end
|