From 78727dd8e226f16fd2446db0bcaf41e127ba9bc8 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 14 Dec 2007 18:07:20 +0000 Subject: Fixed that ActionView#file_exists? would be incorrect if @first_render is set (closes #10569) [dbussink] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8385 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/action_view_test.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/action_view_test.rb b/actionpack/test/action_view_test.rb index 729438af32..a69ff36f9f 100644 --- a/actionpack/test/action_view_test.rb +++ b/actionpack/test/action_view_test.rb @@ -23,4 +23,22 @@ class ActionViewTests < Test::Unit::TestCase assert_equal expectation, base.send(:find_template_extension_from_first_render) end end + + def test_should_report_file_exists_correctly + base = ActionView::Base.new + + assert_nil base.send(:find_template_extension_from_first_render) + + assert_equal false, base.send(:file_exists?, 'test.rhtml') + assert_equal false, base.send(:file_exists?, 'test.rb') + + base.instance_variable_set('@first_render', 'foo.rb') + + assert_equal 'rb', base.send(:find_template_extension_from_first_render) + + assert_equal false, base.send(:file_exists?, 'baz') + assert_equal false, base.send(:file_exists?, 'baz.rb') + + end + end -- cgit v1.2.3