diff --git a/test/engine_test.rb b/test/engine_test.rb index 9eb911d8..b11f418d 100644 --- a/test/engine_test.rb +++ b/test/engine_test.rb @@ -92,19 +92,23 @@ class EngineTest < MiniTest::Unit::TestCase end end - def render(text, options = {}, &block) - scope = options.delete(:scope) || Object.new - locals = options.delete(:locals) || {} - engine(text, options).to_html(scope, locals, &block) - end - - def engine(text, options = {}) + def use_test_tracing(options) unless options[:filename] # use caller method name as fake filename. useful for debugging i = -1 caller[i+=1] =~ /`(.+?)'/ until $1 and $1.index('test_') == 0 options[:filename] = "(#{$1})" end + options + end + + def render(text, options = {}, &block) + options = use_test_tracing(options) + super + end + + def engine(text, options = {}) + options = use_test_tracing(options) Haml::Engine.new(text, options) end diff --git a/test/helper_test.rb b/test/helper_test.rb index 7cf36c6c..6f821289 100644 --- a/test/helper_test.rb +++ b/test/helper_test.rb @@ -43,12 +43,8 @@ class HelperTest < MiniTest::Unit::TestCase end def render(text, options = {}) - if options == :action_view - @base.render :inline => text, :type => :haml - else - scope = options.delete :scope_object - Haml::Engine.new(text, options).to_html(scope ? scope : Object.new) - end + return @base.render :inline => text, :type => :haml if options == :action_view + super end def test_flatten @@ -350,7 +346,7 @@ HAML def test_page_class controller = Struct.new(:controller_name, :action_name).new('troller', 'tion') scope = Struct.new(:controller).new(controller) - result = render("%div{:class => page_class} MyDiv", :scope_object => scope) + result = render("%div{:class => page_class} MyDiv", :scope => scope) expected = "