From 49b6f33f99a28d68f18203a696fb47854a9085d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 10 Oct 2010 14:47:11 +0200 Subject: Clean up unused methods from AV::Base and pass in the template object on rendering. --- actionpack/test/template/template_test.rb | 18 ++++++++++-------- actionpack/test/template/translation_helper_test.rb | 4 ++-- actionpack/test/template/url_helper_test.rb | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/template_test.rb b/actionpack/test/template/template_test.rb index 22401dd145..63f792d328 100644 --- a/actionpack/test/template/template_test.rb +++ b/actionpack/test/template/template_test.rb @@ -4,12 +4,14 @@ require "logger" class TestERBTemplate < ActiveSupport::TestCase ERBHandler = ActionView::Template::Handlers::ERB.new - class Context - class LookupContext - def disable_cache - yield - end + class LookupContext + def disable_cache + yield end + end + + class Context + attr_accessor :_template def initialize @output_buffer = "original" @@ -22,7 +24,7 @@ class TestERBTemplate < ActiveSupport::TestCase def partial ActionView::Template.new( - "<%= @_virtual_path %>", + "<%= @_template.virtual_path %>", "partial", ERBHandler, :virtual_path => "partial" @@ -84,9 +86,9 @@ class TestERBTemplate < ActiveSupport::TestCase end def test_virtual_path - @template = new_template("<%= @_virtual_path %>" \ + @template = new_template("<%= @_template.virtual_path %>" \ "<%= partial.render(self, {}) %>" \ - "<%= @_virtual_path %>") + "<%= @_template.virtual_path %>") assert_equal "hellopartialhello", render end diff --git a/actionpack/test/template/translation_helper_test.rb b/actionpack/test/template/translation_helper_test.rb index 952719a589..763080550b 100644 --- a/actionpack/test/template/translation_helper_test.rb +++ b/actionpack/test/template/translation_helper_test.rb @@ -31,13 +31,13 @@ class TranslationHelperTest < ActiveSupport::TestCase def test_scoping_by_partial I18n.expects(:translate).with("test.translation.helper", :raise => true).returns("helper") - @view = ActionView::Base.new(ActionController::Base.view_paths, {}) + @view = ::ActionView::Base.new(ActionController::Base.view_paths, {}) assert_equal "helper", @view.render(:file => "test/translation") end def test_scoping_by_partial_of_an_array I18n.expects(:translate).with("test.scoped_translation.foo.bar", :raise => true).returns(["foo", "bar"]) - @view = ActionView::Base.new(ActionController::Base.view_paths, {}) + @view = ::ActionView::Base.new(ActionController::Base.view_paths, {}) assert_equal "foobar", @view.render(:file => "test/scoped_translation") end diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index 98276da559..b8a7d4259d 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -9,7 +9,7 @@ class UrlHelperTest < ActiveSupport::TestCase # or request. # # In those cases, we'll set up a simple mock - attr_accessor :controller, :request + attr_accessor :controller, :request, :_template routes = ActionDispatch::Routing::RouteSet.new routes.draw do -- cgit v1.2.3