aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/action_pack_assertions_test.rb
diff options
context:
space:
mode:
authorRoberto Soares <roberto.tech@gmail.com>2012-11-23 16:13:08 -0300
committerRoberto Soares <roberto.tech@gmail.com>2012-11-23 16:15:17 -0300
commit20723ca49873076d8fc8c2bf0729568373e31738 (patch)
treee08be318835b970b676c77f7ed7af42cc2317f02 /actionpack/test/controller/action_pack_assertions_test.rb
parent36ee5802a5e52e0720eaa80fd0473fd131ffe890 (diff)
downloadrails-20723ca49873076d8fc8c2bf0729568373e31738.tar.gz
rails-20723ca49873076d8fc8c2bf0729568373e31738.tar.bz2
rails-20723ca49873076d8fc8c2bf0729568373e31738.zip
`assert_template` fails with empty string when a template has been rendered
For instance, it prevents false positive in this case: file = nil get :index assert_template("#{file}")
Diffstat (limited to 'actionpack/test/controller/action_pack_assertions_test.rb')
-rw-r--r--actionpack/test/controller/action_pack_assertions_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb
index ca542eb7e2..c653f7e756 100644
--- a/actionpack/test/controller/action_pack_assertions_test.rb
+++ b/actionpack/test/controller/action_pack_assertions_test.rb
@@ -447,6 +447,13 @@ class AssertTemplateTest < ActionController::TestCase
end
end
+ def test_with_empty_string_fails_when_template_rendered
+ get :hello_world
+ assert_raise(ActiveSupport::TestCase::Assertion) do
+ assert_template ""
+ end
+ end
+
def test_passes_with_correct_string
get :hello_world
assert_template 'hello_world'