diff options
author | David Chelimsky <dchelimsky@gmail.com> | 2010-04-29 08:18:47 -0500 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-05-03 13:46:12 +0200 |
commit | 849ab9294244ac94f9ce4621c8cd325a2992a382 (patch) | |
tree | 5d3059b82714c1bb14119c6e1838ea9d2ee8c071 /actionpack/test/controller | |
parent | 36fc489aa3086e384db9f13390f01246d006e47e (diff) | |
download | rails-849ab9294244ac94f9ce4621c8cd325a2992a382.tar.gz rails-849ab9294244ac94f9ce4621c8cd325a2992a382.tar.bz2 rails-849ab9294244ac94f9ce4621c8cd325a2992a382.zip |
Eliminate false positives when passing symbols to assert_template
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/action_pack_assertions_test.rb | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb index 1741b58f72..eae2641dc0 100644 --- a/actionpack/test/controller/action_pack_assertions_test.rb +++ b/actionpack/test/controller/action_pack_assertions_test.rb @@ -349,21 +349,43 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase assert_template :partial => '_partial' end - def test_assert_template_with_nil + def test_assert_template_with_nil_passes_when_no_template_rendered get :nothing assert_template nil end - def test_assert_template_with_string + def test_assert_template_with_nil_fails_when_template_rendered + get :hello_world + assert_raise(ActiveSupport::TestCase::Assertion) do + assert_template nil + end + end + + def test_assert_template_passes_with_correct_string get :hello_world assert_template 'hello_world' + assert_template 'test/hello_world' end - def test_assert_template_with_symbol + def test_assert_template_passes_with_correct_symbol get :hello_world assert_template :hello_world end + def test_assert_template_fails_with_incorrect_string + get :hello_world + assert_raise(ActiveSupport::TestCase::Assertion) do + assert_template 'hello_planet' + end + end + + def test_assert_template_fails_with_incorrect_symbol + get :hello_world + assert_raise(ActiveSupport::TestCase::Assertion) do + assert_template :hello_planet + end + end + # check if we were rendered by a file-based template? def test_rendered_action process :nothing @@ -387,7 +409,6 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase assert_nil @response.redirect_url end - # check server errors def test_server_error_response_code process :response500 |