mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Add Hamlit's ActionView test suite
This commit is contained in:
parent
a33a8ff5c3
commit
dec5019fee
1 changed files with 25 additions and 0 deletions
25
test/hamlit/rails_template_test.rb
Normal file
25
test/hamlit/rails_template_test.rb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
require 'haml'
|
||||||
|
require 'haml/template/plugin'
|
||||||
|
require 'hamlit/rails_template'
|
||||||
|
|
||||||
|
describe Hamlit::RailsTemplate do
|
||||||
|
def render(haml, with: :hamlit)
|
||||||
|
case with
|
||||||
|
when :hamlit
|
||||||
|
ActionView::Template.register_template_handler :haml, Hamlit::RailsTemplate.new
|
||||||
|
else
|
||||||
|
ActionView::Template.register_template_handler :haml, Haml::Plugin
|
||||||
|
end
|
||||||
|
|
||||||
|
base = ActionView::Base.new(__dir__, {})
|
||||||
|
base.render(inline: haml, type: :haml)
|
||||||
|
end
|
||||||
|
|
||||||
|
def assert_render(haml)
|
||||||
|
assert_equal render(haml, with: :haml), render(haml, with: :hamlit)
|
||||||
|
end
|
||||||
|
|
||||||
|
specify 'rails rendering' do
|
||||||
|
assert_render(%q|= link_to 'foo', '#', class: 'bar'|)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue