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

⚠️ ActionView::Base instances should be constructed with a lookup context, assignments, and a controller

This commit is contained in:
Akira Matsuda 2019-05-17 18:30:44 +09:00
parent eaf539e248
commit e74c81835a
2 changed files with 4 additions and 4 deletions

View file

@ -57,14 +57,14 @@ HAML
proper_behavior = false
begin
ActionView::Base.new.render(:inline => "<%= flatten('Foo\\nBar') %>")
ActionView::Base.new(ActionView::LookupContext.new('')).render(inline: "<%= flatten('Foo\\nBar') %>")
rescue NoMethodError, ActionView::Template::Error
proper_behavior = true
end
assert(proper_behavior)
begin
ActionView::Base.new.render(:inline => "<%= concat('foo') %>")
ActionView::Base.new(ActionView::LookupContext.new('')).render(inline: "<%= concat('foo') %>")
rescue ArgumentError, NameError
proper_behavior = true
end
@ -262,7 +262,7 @@ HAML
end
def test_is_haml
assert(!ActionView::Base.new.is_haml?)
assert(!ActionView::Base.new(ActionView::LookupContext.new('')).is_haml?)
assert_equal("true\n", render("= is_haml?"))
end

View file

@ -169,7 +169,7 @@ HAML
end
def test_is_haml
assert(!ActionView::Base.new.is_haml?)
assert(!ActionView::Base.new(ActionView::LookupContext.new('')).is_haml?)
assert_equal("true\n", render("= is_haml?", :action_view))
assert_equal("false", @base.render(:inline => '<%= is_haml? %>'))
assert_equal("false\n", render("= render :inline => '<%= is_haml? %>'", :action_view))