2017-07-23 11:36:41 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
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
|
2019-02-25 16:18:44 -05:00
|
|
|
assert_equal :html, ActionView::Template::HTML.new("", :html).format
|
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
|
2019-03-06 02:38:59 -05:00
|
|
|
foo = Mime::Type.lookup("text/foo")
|
2014-02-18 14:12:51 -05:00
|
|
|
assert_nil foo.to_sym
|
2019-03-06 02:38:59 -05:00
|
|
|
assert_equal "text/foo", ActionView::Template::HTML.new("", foo).format
|
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
|
2019-02-25 16:18:44 -05:00
|
|
|
assert_equal "foo", ActionView::Template::HTML.new("", "foo").format
|
2014-02-18 14:12:51 -05:00
|
|
|
end
|
|
|
|
end
|