Class: Module

Inherits:
Object show all
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
# File 'lib/minitest/spec.rb', line 4

def infect_an_assertion meth, new_name, dont_flip = false # :nodoc:
  # warn "%-22p -> %p %p" % [meth, new_name, dont_flip]
  self.class_eval "    def \#{new_name} *args\n      case\n      when \#{!!dont_flip} then\n        Minitest::Spec.current.\#{meth}(self, *args)\n      when Proc === self then\n        Minitest::Spec.current.\#{meth}(*args, &self)\n      else\n        Minitest::Spec.current.\#{meth}(args.first, self, *args[1..-1])\n      end\n    end\n  EOM\nend\n"