From 45dfa6971246fa1fbaa5a7c9b9b5084a139952f3 Mon Sep 17 00:00:00 2001 From: Tee Parham Date: Thu, 26 Dec 2013 14:46:56 -0700 Subject: [PATCH] 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. --- lib/haml/util.rb | 9 --------- test/helper_test.rb | 2 +- test/template_test.rb | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/haml/util.rb b/lib/haml/util.rb index 083e5c03..f30535c3 100644 --- a/lib/haml/util.rb +++ b/lib/haml/util.rb @@ -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, diff --git a/test/helper_test.rb b/test/helper_test.rb index 261357cf..c9040f46 100644 --- a/test/helper_test.rb +++ b/test/helper_test.rb @@ -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) diff --git a/test/template_test.rb b/test/template_test.rb index 4d5674f1..59ccd754 100644 --- a/test/template_test.rb +++ b/test/template_test.rb @@ -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