I've got a simple controller. It calls Foo.something('xyz') and returns 'XYZ'. I have a before filter for my entire application that calls Foo.something(nil) and returns nil.
I'm not sure how to specify that in my tests and rspec is complaining about expecting one or the other. I'm sure it's something simple, but I'm missing it.
What I want is this, but in the additive sense and it seems to be in the replacement sense:
you have a couple of options. stub out the before_filter completely in
your before block [or in the example i guess] or put all the arguments
[or at least some of the defining ones] in the should_receive. i'd
probably do the former.
also you shouldn't be should_receiving the filter [because that's
probably going on in the before block] and should be stubbing it
instead. should_receive in the before block will create two
expectations for every spec and that's usually a bad idea. hope that
helps.
RSL
PS: reading your error message it might be possible that whatever
argument you're sending as the with evaluates to nil. since it's
saying it receives with nil twice.