How to expect some (but not all) arguments with RSpec should_receive?

前端 未结 3 890
渐次进展
渐次进展 2021-01-07 16:32
class Foo
  def bar(a, b)
  ...

Foo.should_receive( :bar )

expects bar to be called with any arguments.

Foo.should_receive( :bar )         


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-07 17:12

    Use the anything matcher:

    Foo.should_receive(:bar).with(:baz, anything)
    

提交回复
热议问题