[rspec-users] Telling rspec that a method might be called with a OR b ... ?

Marcelo de Moraes Serpa celoserpa at gmail.com
Tue Jul 28 14:28:22 EDT 2009


Hey list,

Let's say I have a model, and I want to setup a partial mock in it, to
set the expectation that it should receive a message with specific
arguments. I know that this is not a good design for a spec, and that
I would probably need to separate this in another example -- but let's
say that I would like to express in the example that this partial mock
could receive this message with agument a OR b. I had a situation
where I have setup the should receive with a specific argument, but
later on in the code flow, the class received the same message (find)
with other arguments, which was breaking the spec. The null_object
pattern would not work, because afaik, it is only for messages and not
for arguments. Any way to tell rspec that a method might be called
with argument A or B (or C) ? :)

Thanks in advance,

MArcelo.


More information about the rspec-users mailing list