class Foo
def bar(a, b)
...
Foo.should_receive( :bar )
期望使用任何参数调用bar.
Foo.should_receive( :bar ).with( :baz, :qux )
期望:baz和:qux作为参数传入.
如何期望第一个参数等于:baz,而不关心其他参数?
class Foo
def bar(a, b)
...
Foo.should_receive( :bar )
期望使用任何参数调用bar.
Foo.should_receive( :bar ).with( :baz, :qux )
期望:baz和:qux作为参数传入.
如何期望第一个参数等于:baz,而不关心其他参数?
使用anything
匹配器:
Foo.should_receive(:bar).with(:baz, anything)