From cc6da6825a73042eaca4a612310311e7e0b0d4d4 Mon Sep 17 00:00:00 2001 From: Cezary Baginski Date: Sun, 29 Mar 2009 13:01:41 +0200 Subject: [PATCH] Additional render test for backup files --- actionpack/test/controller/render_test.rb | 11 +++++++++++ .../test/fixtures/test/backup_files/item.html.erb | 1 + .../fixtures/test/backup_files/item.html.erb.orig | 1 + actionpack/test/template/template_test.rb | 2 ++ 4 files changed, 15 insertions(+), 0 deletions(-) create mode 100644 actionpack/test/fixtures/test/backup_files/item.html.erb create mode 100644 actionpack/test/fixtures/test/backup_files/item.html.erb.orig diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index a529315..dde1641 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -716,6 +716,10 @@ class TestController < ActionController::Base render :action => "calling_partial_with_layout", :layout => "layouts/partial_with_layout" end + def render_item_when_backups_present + render :template => "/test/backup_files/item" + end + def rescue_action(e) raise end @@ -1539,6 +1543,13 @@ class RenderTest < ActionController::TestCase get :render_call_to_partial_with_layout_in_main_layout_and_within_content_for_layout assert_equal "Before (Anthony)\nInside from partial (Anthony)\nAfter\nBefore (David)\nInside from partial (David)\nAfter\nBefore (Ramm)\nInside from partial (Ramm)\nAfter", @response.body end + + def test_render_with_backup_files + get :render_item_when_backups_present + assert_template "backup_files/item" + assert_equal "The correct item.erb was loaded.\n", @response.body + end + end class ExpiresInRenderTest < ActionController::TestCase diff --git a/actionpack/test/fixtures/test/backup_files/item.html.erb b/actionpack/test/fixtures/test/backup_files/item.html.erb new file mode 100644 index 0000000..aaac0a2 --- /dev/null +++ b/actionpack/test/fixtures/test/backup_files/item.html.erb @@ -0,0 +1 @@ +The correct item.erb was loaded. diff --git a/actionpack/test/fixtures/test/backup_files/item.html.erb.orig b/actionpack/test/fixtures/test/backup_files/item.html.erb.orig new file mode 100644 index 0000000..a2b153e --- /dev/null +++ b/actionpack/test/fixtures/test/backup_files/item.html.erb.orig @@ -0,0 +1 @@ +This is an editor backup file and should never be loaded! diff --git a/actionpack/test/template/template_test.rb b/actionpack/test/template/template_test.rb index 7caec7a..5c65232 100644 --- a/actionpack/test/template/template_test.rb +++ b/actionpack/test/template/template_test.rb @@ -19,6 +19,8 @@ class TemplateTest < Test::Unit::TestCase t.assert_parses_template_path 'abc', :extension => nil, :format => nil, :name => nil t.assert_parses_template_path 'abc.xxx', :extension => nil, :format => 'xxx', :name => 'abc' t.assert_parses_template_path 'abc.html.xxx', :extension => nil, :format => 'xxx', :name => 'abc' + + t.assert_parses_template_path 'abc.html.erb.orig', :format => 'orig', :extension => nil end end -- 1.5.6.3