aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/render_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-11-20 08:52:48 +0100
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-11-20 08:52:48 +0100
commit206c5643aae40b0884d42fdb8caeb3f763936fa9 (patch)
tree608f5cc7daab7b58b3d159429c595303e7e1c7d4 /actionpack/test/template/render_test.rb
parentfb1eebac940d0648d1640d20a24f085d901d6f30 (diff)
parent20a346170cf3922d16e265487cfb1abcc85383c1 (diff)
downloadrails-206c5643aae40b0884d42fdb8caeb3f763936fa9.tar.gz
rails-206c5643aae40b0884d42fdb8caeb3f763936fa9.tar.bz2
rails-206c5643aae40b0884d42fdb8caeb3f763936fa9.zip
Merge branch 'master' of git@github.com:rails/rails
Diffstat (limited to 'actionpack/test/template/render_test.rb')
-rw-r--r--actionpack/test/template/render_test.rb22
1 files changed, 15 insertions, 7 deletions
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index 476e651757..0323c33b95 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -8,7 +8,7 @@ class ViewRenderTest < Test::Unit::TestCase
end
def test_render_file
- assert_equal "Hello world!", @view.render("test/hello_world.erb")
+ assert_equal "Hello world!", @view.render(:file => "test/hello_world.erb")
end
def test_render_file_not_using_full_path
@@ -16,11 +16,11 @@ class ViewRenderTest < Test::Unit::TestCase
end
def test_render_file_without_specific_extension
- assert_equal "Hello world!", @view.render("test/hello_world")
+ assert_equal "Hello world!", @view.render(:file => "test/hello_world")
end
def test_render_file_at_top_level
- assert_equal 'Elastica', @view.render('/shared')
+ assert_equal 'Elastica', @view.render(:file => '/shared')
end
def test_render_file_with_full_path
@@ -29,20 +29,20 @@ class ViewRenderTest < Test::Unit::TestCase
end
def test_render_file_with_instance_variables
- assert_equal "The secret is in the sauce\n", @view.render("test/render_file_with_ivar.erb")
+ assert_equal "The secret is in the sauce\n", @view.render(:file => "test/render_file_with_ivar.erb")
end
def test_render_file_with_locals
locals = { :secret => 'in the sauce' }
- assert_equal "The secret is in the sauce\n", @view.render("test/render_file_with_locals.erb", locals)
+ assert_equal "The secret is in the sauce\n", @view.render(:file => "test/render_file_with_locals.erb", :locals => locals)
end
def test_render_file_not_using_full_path_with_dot_in_path
- assert_equal "The secret is in the sauce\n", @view.render("test/dot.directory/render_file_with_ivar")
+ assert_equal "The secret is in the sauce\n", @view.render(:file => "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")
+ assert_equal "test/template.erb", @view.render(:file => "test/template.erb")
end
def test_render_update
@@ -51,6 +51,10 @@ class ViewRenderTest < Test::Unit::TestCase
assert_equal 'alert("Hello, World!");', @view.render(:update) { |page| page.alert('Hello, World!') }
end
+ def test_render_partial_from_default
+ assert_equal "only partial", @view.render("test/partial_only")
+ end
+
def test_render_partial
assert_equal "only partial", @view.render(:partial => "test/partial_only")
end
@@ -73,6 +77,10 @@ class ViewRenderTest < Test::Unit::TestCase
assert_equal "5", @view.render(:partial => "test/counter", :locals => { :counter_counter => 5 })
end
+ def test_render_partial_with_locals_from_default
+ assert_equal "only partial", @view.render("test/partial_only", :counter_counter => 5)
+ end
+
def test_render_partial_with_errors
@view.render(:partial => "test/raise")
flunk "Render did not raise TemplateError"