Skip to content

Commit

Permalink
- Updated deprecation message for block expectations. (blowmage)
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//src/minitest/dev/": change = 13279]
  • Loading branch information
zenspider committed Dec 11, 2021
1 parent 118c495 commit 0c207e3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/minitest/spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ class Module # :nodoc:
def infect_an_assertion meth, new_name, dont_flip = false # :nodoc:
block = dont_flip == :block
dont_flip = false if block
target_obj = block ? '_{obj.method}' : '_(obj)'

# warn "%-22p -> %p %p" % [meth, new_name, dont_flip]
self.class_eval <<-EOM, __FILE__, __LINE__ + 1
def #{new_name} *args
where = Minitest.filter_backtrace(caller).first
where = where.split(/:in /, 2).first # clean up noise
Kernel.warn "DEPRECATED: global use of #{new_name} from #\{where}. Use _(obj).#{new_name} instead. This will fail in Minitest 6."
Kernel.warn "DEPRECATED: global use of #{new_name} from #\{where}. Use #{target_obj}.#{new_name} instead. This will fail in Minitest 6."
Minitest::Expectation.new(self, Minitest::Spec.current).#{new_name}(*args)
end
EOM
Expand Down

0 comments on commit 0c207e3

Please sign in to comment.