diff options
author | José Valim <jose.valim@gmail.com> | 2010-10-10 23:11:50 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-10-10 23:12:23 +0200 |
commit | 5ec27189b8b433145baa7270cf4219c5041f6a4c (patch) | |
tree | 60978ebf6493b79f450215f057e2353f9795a0b8 /actionpack/test | |
parent | 682368d4ba0bb4548f896d02bc4e038ee8ba6b4d (diff) | |
download | rails-5ec27189b8b433145baa7270cf4219c5041f6a4c.tar.gz rails-5ec27189b8b433145baa7270cf4219c5041f6a4c.tar.bz2 rails-5ec27189b8b433145baa7270cf4219c5041f6a4c.zip |
Do not allow templates coming from Fallback resolvers to store a virtual path.
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/lookup_context_test.rb | 4 | ||||
-rw-r--r-- | actionpack/test/template/render_test.rb | 13 |
2 files changed, 14 insertions, 3 deletions
diff --git a/actionpack/test/template/lookup_context_test.rb b/actionpack/test/template/lookup_context_test.rb index 23dfc1ba75..850589b13b 100644 --- a/actionpack/test/template/lookup_context_test.rb +++ b/actionpack/test/template/lookup_context_test.rb @@ -100,8 +100,8 @@ class LookupContextTest < ActiveSupport::TestCase @lookup_context.with_fallbacks do assert_equal 3, @lookup_context.view_paths.size - assert @lookup_context.view_paths.include?(ActionView::FileSystemResolver.new("")) - assert @lookup_context.view_paths.include?(ActionView::FileSystemResolver.new("/")) + assert @lookup_context.view_paths.include?(ActionView::FallbackFileSystemResolver.new("")) + assert @lookup_context.view_paths.include?(ActionView::FallbackFileSystemResolver.new("/")) end end diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb index 756d8d05d2..17bb610b6a 100644 --- a/actionpack/test/template/render_test.rb +++ b/actionpack/test/template/render_test.rb @@ -114,7 +114,7 @@ module RenderTestCases end def test_render_sub_template_with_errors - @view.render(:file => "test/sub_template_raise") + @view.render(:template => "test/sub_template_raise") flunk "Render did not raise Template::Error" rescue ActionView::Template::Error => e assert_match %r!method.*doesnt_exist!, e.message @@ -123,6 +123,17 @@ module RenderTestCases assert_equal File.expand_path("#{FIXTURE_LOAD_PATH}/test/_raise.html.erb"), e.file_name end + def test_render_file_with_errors + @view.render(:file => File.expand_path("test/_raise", FIXTURE_LOAD_PATH)) + flunk "Render did not raise Template::Error" + rescue ActionView::Template::Error => e + assert_match %r!method.*doesnt_exist!, e.message + assert_equal "", e.sub_template_message + assert_equal "1", e.line_number + assert_equal "1: <%= doesnt_exist %>", e.annoted_source_code.strip + assert_equal File.expand_path("#{FIXTURE_LOAD_PATH}/test/_raise.html.erb"), e.file_name + end + def test_render_object assert_equal "Hello: david", @view.render(:partial => "test/customer", :object => Customer.new("david")) end |