Displaying 1 result from an estimated 1 matches for "should_receive_chain".
2012 Feb 21
8
should_receive_chain
...ceive(:first)
users = double(''users'', active: active)
account.should_receive(:users).and_return(users)
for this:
account.users.active.first
?
Of course, we could use stub_chain, but that doesn''t let us know
*where* the chain broke.
Would you like to do this?
account.should_receive_chain(:users, :active, :first)
Under the hood, it would create something like this:
users = double(''user'')
active = double(''active'')
first = double(''first'')
users.should_receive(:active).and_return(active)
active.should_receive(:first).and_return(fi...