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* 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(first)

Note, this would *not* be part of RSpec, but rather a separate gem.

Would this alleviate any pain for you?
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to