expects with same method but different arguments

10 views
Skip to first unread message

lonecat

unread,
Nov 11, 2009, 10:07:02 PM11/11/09
to mocha-developer
Is it possible to test that an object should receive a method call 2
but with different arguments, by specifying the arguments?

Something like this:

@object.expects(:method).with(argument_1)
@object.expects(:method).with(argument_2)

The case is a logger, I want to check that the logger receives the
method "info" but with different arguments like "Attemping to create
message #{message}" and "Message #{message} was created"

James Mead

unread,
Nov 12, 2009, 5:31:17 AM11/12/09
to mocha-d...@googlegroups.com
2009/11/12 lonecat <jfgo...@gmail.com>:

Yes. That should work.

Cheers, James.

Reply all
Reply to author
Forward
0 new messages