Permalink
Browse files

Fix: assert_template should not search for partial matches - regex mo…

…dified
  • Loading branch information...
1 parent 9dee540 commit c1814169b4fe22978ddac38813ce5c3cf24d2ef1 @sandeepr-sourcebits sandeepr-sourcebits committed Dec 6, 2011
@@ -80,7 +80,7 @@ def assert_template(options = {}, message = nil)
options, rendered.keys.join(', '))
assert_block(msg) do
if options
- rendered.any? { |t,num| t.match(options) }
+ rendered.any? { |t,num| t.match(options + "$") }
else
@templates.blank?
end
@@ -478,6 +478,13 @@ def test_assert_template_reset_between_requests
get :nothing
assert_template nil
end
+
+ def test_fails_with_partially_matching_string
+ get :hello_world
+ assert_raise(ActiveSupport::TestCase::Assertion) do
+ assert_template 'hello'
+ end
+ end
end
class ActionPackHeaderTest < ActionController::TestCase

0 comments on commit c181416

Please sign in to comment.