I’m having a little problem figuring out how to stub this scenario:
my controller has this code in it:
if current_user.foos << @foo
and my spec is giving me errors about a missing stub:
Mock ‘foos’ received unexpected message :<< with
Also related to this issue, I’m using mock_model but it’s not pulling
in the methods from the model I’ve specified and I have to specify
every single stub that I want to use. Is this normal behavior?
Anyway, I also tried to do
@user = mock_model(User)
@user.foos.stub!(:<<).and_return([])
which still gave me the same dreadful error. Can anyone assist me with
my two problems?
TIA
-L