3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/spec-unit/assert_helper.rb', line 3
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
|