Permalink
Browse files

Cherry Pick Merge: Fixes issue #3849 assert_template false positive

  • Loading branch information...
1 parent e18a951 commit 75075c532c4bd979467aecf9d47f212ccbd4ee37 @freegenie freegenie committed with Dec 4, 2011
@@ -86,7 +86,9 @@ def assert_template(options = {}, message = nil)
assert_block(msg) do
case options
when String
- rendered.any? { |t,num| t.end_with?(options) }
+ rendered.any? do |t, num|
+ (options.split(File::SEPARATOR) - t.split(File::SEPARATOR)).empty?
+ end
when Regexp
rendered.any? { |t,num| t.match(options) }
when NilClass
@@ -495,6 +495,13 @@ def test_assert_template_reset_between_requests
get :nothing
assert_template nil
end
+
+ def test_fails_with_partial_name_matching_string
+ get :hello_world
+ assert_raise(ActiveSupport::TestCase::Assertion) do
+ assert_template 'world'
+ end
+ end
end
class ActionPackHeaderTest < ActionController::TestCase

0 comments on commit 75075c5

Please sign in to comment.