From ac50ee0edfa0df90ae7a8dd09f4a41ecbd1c7a94 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 28 Oct 2008 11:06:08 -0500 Subject: Track rendered templates in stack so the current template can always be accessed. Added ActionView::Base#template to access the template object. --- actionpack/test/fixtures/test/template.erb | 1 + actionpack/test/template/render_test.rb | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 actionpack/test/fixtures/test/template.erb (limited to 'actionpack/test') diff --git a/actionpack/test/fixtures/test/template.erb b/actionpack/test/fixtures/test/template.erb new file mode 100644 index 0000000000..785afa8f6a --- /dev/null +++ b/actionpack/test/fixtures/test/template.erb @@ -0,0 +1 @@ +<%= template.path %> \ No newline at end of file diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb index a4ea22ddcb..7e4fff3da6 100644 --- a/actionpack/test/template/render_test.rb +++ b/actionpack/test/template/render_test.rb @@ -41,6 +41,10 @@ class ViewRenderTest < Test::Unit::TestCase assert_equal "The secret is in the sauce\n", @view.render("test/dot.directory/render_file_with_ivar") end + def test_render_has_access_current_template + assert_equal "test/template.erb", @view.render("test/template.erb") + end + def test_render_update # TODO: You should not have to stub out template because template is self! @view.instance_variable_set(:@template, @view) -- cgit v1.2.3