Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/minitest/spec.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#infect_an_assertion(meth, new_name, dont_flip = false) ⇒ Object
:nodoc:
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/minitest/spec.rb', line 4 def infect_an_assertion meth, new_name, dont_flip = false # :nodoc: block = dont_flip == :block dont_flip = false if block self.class_eval <<-EOM, __FILE__, __LINE__ + 1 def #{new_name}(*args, **kws) raise "Calling ##{new_name} outside of test." unless ctx case when #{!!dont_flip} then ctx.#{meth}(target, *args, **kws) when #{block} && Proc === target then ctx.#{meth}(*args, **kws, &target) else ctx.#{meth}(args.first, target, *args[1..-1], **kws) end end EOM end |