Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: assert_template shouldn't search for partial matches #3879

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def assert_template(options = {}, message = nil)
options.inspect, rendered.keys)
assert_block(msg) do
if options
rendered.any? { |t,num| t.match(options) }
rendered.any? { |t,num| t.match(options + "$") }
else
@templates.blank?
end
Expand Down
7 changes: 7 additions & 0 deletions actionpack/test/controller/action_pack_assertions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,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
Expand Down
2 changes: 1 addition & 1 deletion activesupport/test/file_update_checker_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_should_not_block_if_a_strange_filename_used
FileUtils.touch(FILES.map { |file_name| "tmp_watcher/valid,yetstrange,path,/#{file_name}" } )

test = Thread.new do
checker = ActiveSupport::FileUpdateChecker.new([],"tmp_watcher/valid,yetstrange,path," => :txt){ i += 1 }
ActiveSupport::FileUpdateChecker.new([],"tmp_watcher/valid,yetstrange,path," => :txt){ i += 1 }
Thread.exit
end
test.priority = -1
Expand Down