> Would you like to do this?
>
> account.should_receive_chain(:users, :active, :first)
+1 from me!
Patrick J. Collins
http://collinatorstudios.com
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
+1
I've often wondered if there is a better way to stub this situation.
On Tue, Feb 21, 2012 at 7:43 AM, Ken Chien wrote:
> Hi Justin,
>
> On Tue, Feb 21, 2012 at 4:03 AM, Justin Ko wrote:
>
>> Would you like to do this?
>>
>> account.should_receive_chain(:users, :active, :first)
>>
>>
> I wou
Hi Justin,
On Tue, Feb 21, 2012 at 4:03 AM, Justin Ko wrote:
> Would you like to do this?
>
> account.should_receive_chain(:users, :active, :first)
>
>
I would love this syntax. I find that I usually resort to stub_chain and
lose the ability to check that the object received a particular message
Do you often find yourself doing this:
active = double('active')
active.should_receive(: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