Skip to content

Commit

Permalink
Fixed that ActionView#file_exists? would be incorrect if @first_rende…
Browse files Browse the repository at this point in the history
…r is set (closes rails#10569) [dbussink]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8385 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Dec 14, 2007
1 parent 7a22435 commit 78727dd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*

* Fixed that ActionView#file_exists? would be incorrect if @first_render is set #10569 [dbussink]

* Added that Array#to_param calls to_param on all it's elements #10473 [brandon]

* Ensure asset cache directories are automatically created. #10337 [Josh Peek, Chu Yeow]
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/base.rb
Expand Up @@ -404,7 +404,7 @@ def file_exists?(template_path)#:nodoc:
if template_file_extension
template_exists?(template_file_name, template_file_extension)
else
pick_template_extension(template_path)
template_exists?(template_file_name, pick_template_extension(template_path))
end
end

Expand Down
18 changes: 18 additions & 0 deletions actionpack/test/action_view_test.rb
Expand Up @@ -23,4 +23,22 @@ def test_find_template_extension_from_first_render
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

0 comments on commit 78727dd

Please sign in to comment.