1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Test xml renderer

This commit is contained in:
Takashi Kokubun 2016-10-15 15:00:18 +09:00
parent 7bd1717865
commit 94e271bdaf

View file

@ -158,4 +158,18 @@ describe Hamlit::RailsTemplate do
Hamlit::RailsTemplate.set_options(use_html_safe: original)
end
end
specify 'xml mime_type' do
base = ActionView::Base.new(__dir__, {})
handler = Hamlit::RailsTemplate.new
html_template = ActionView::Template.new('%link', 'test.html.haml', handler, {
format: Mime::Type.new('text/html', :html, ['application/xhtml+xml']),
})
xml_template = ActionView::Template.new('%link', 'test.xml.haml', handler, {
format: Mime::Type.new('application/xml', :xml, ['text/xml', 'application/x-xml']),
})
assert_equal %Q|<link>\n|, base.render(template: html_template)
assert_equal %Q|<link />\n|, base.render(template: xml_template)
end
end