diff options
author | David Chelimsky <dchelimsky@gmail.com> | 2010-06-22 01:40:22 -0500 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-22 14:51:22 +0200 |
commit | 0576ec4ddd5f806c6ae98184d28391fc239db1ef (patch) | |
tree | a0563ebe3f34e2f99c25554c2e57d38d8b37067c /actionpack/test | |
parent | 02399a1184d0f87b14af461fab731120d92c5ad8 (diff) | |
download | rails-0576ec4ddd5f806c6ae98184d28391fc239db1ef.tar.gz rails-0576ec4ddd5f806c6ae98184d28391fc239db1ef.tar.bz2 rails-0576ec4ddd5f806c6ae98184d28391fc239db1ef.zip |
Add support for specifying locals in view tests with assert template [#4927 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/test_case_test.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/actionpack/test/template/test_case_test.rb b/actionpack/test/template/test_case_test.rb index c365aec841..d86dc7b185 100644 --- a/actionpack/test/template/test_case_test.rb +++ b/actionpack/test/template/test_case_test.rb @@ -220,10 +220,24 @@ module ActionView end class RenderTemplateTest < ActionView::TestCase - test "render template" do + test "render template supports specifying partials" do controller.controller_path = "test" render(:template => "test/calling_partial_with_layout") - assert_template "partial_for_use_in_layout" + assert_template :partial => "_partial_for_use_in_layout" + end + + test "render template supports specifying locals (passing)" do + controller.controller_path = "test" + render(:template => "test/calling_partial_with_layout") + assert_template :partial => "_partial_for_use_in_layout", :locals => { :name => "David" } + end + + test "render template supports specifying locals (failing)" do + controller.controller_path = "test" + render(:template => "test/calling_partial_with_layout") + assert_raise Test::Unit::AssertionFailedError, /Somebody else.*David/m do + assert_template :partial => "_partial_for_use_in_layout", :locals => { :name => "Somebody Else" } + end end end end |