RSpec lets you define the arguments with which you expect a method to be invoked:
subject.should_receive(:say).with('hello')
Sometimes you don't care about the exact arguments. For such cases RSpec comes with argument constraints like anything
or hash_including
:
subject.should_receive(:update_attributes).with(hash_including(:message => 'hi world'))
You can go even further and use any RSpec matcher to match arguments:
subject.should_receive(:say).with(instance_of(String))
Posted by Henning Koch to makandra dev (2011-10-17 14:01)