Test xml renderer

This commit is contained in:
Takashi Kokubun 2016-10-15 15:00:18 +09:00
parent 7bd1717865
commit 94e271bdaf
1 changed files with 14 additions and 0 deletions

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