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

remove Haml::Util.av_template_class

This method previously existed to hide the complexity of different
ActionView Template base classes in different rails versions. Since
that is no longer the case, it is simpler to remove it and use
ActionView::Template::Error.
This commit is contained in:
Tee Parham 2013-12-26 14:46:56 -07:00
parent e228d0a90e
commit 45dfa69712
3 changed files with 2 additions and 11 deletions

View file

@ -56,15 +56,6 @@ module Haml
$stderr = the_real_stderr
end
# Returns an ActionView::Template::* class.
# These classes are of the form `ActionView::Template::Foo`.
#
# @param name [#to_s] The name of the class to get.
# For example, `:Error` will return `ActionView::Template::Error`.
def av_template_class(name)
ActionView::Template.const_get(name.to_s)
end
## Rails XSS Safety
# Whether or not ActionView's XSS protection is available and enabled,

View file

@ -95,7 +95,7 @@ HAML
begin
ActionView::Base.new.render(:inline => "<%= flatten('Foo\\nBar') %>")
rescue NoMethodError, Haml::Util.av_template_class(:Error)
rescue NoMethodError, ActionView::Template::Error
proper_behavior = true
end
assert(proper_behavior)

View file

@ -91,7 +91,7 @@ class TemplateTest < MiniTest::Unit::TestCase
assert_equal(pair.first, pair.last, message)
end
end
rescue Haml::Util.av_template_class(:Error) => e
rescue ActionView::Template::Error => e
if e.message =~ /Can't run [\w:]+ filter; required (one of|file) ((?:'\w+'(?: or )?)+)(, but none were found| not found)/
puts "\nCouldn't require #{$2}; skipping a test."
else