36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/spec-unit/assert_helper.rb', line 36
def self.assert_helper(base)
base.module_eval do
class << self
for meth in methods
undef_method(meth) if meth.to_s =~ /^assert_/ || meth.to_s =~ /^assert$/
end
alias_method :spec_unit_method_missing, :method_missing
def method_missing(sym, *args, &block)
if sym.to_s =~ /^assert_/
self.send(:define_method, :"test_#{args[0]}") do
if block
send(sym, *(instance_eval(&block)))
else
send(sym)
end
end
else
spec_unit_method_missing sym, *args, &block
end
end
end
end
end
|