Ashley Moran
2008-Mar-31 16:25 UTC
[rspec-users] Can you add simple argument-baesd logic to stubs?
Hi
Is there any way to do the following with stubs?
template.should_receive(:formatted_last_login).
with(duck_type(:last_login_date)).
any_number_of_times.
and_return { |user| "last-login-#{user.id}" }
If I change "should_receive" to "stub!", Ruby complains that
0 args are
being passed in for 1 to the block. But a quick look through the RSpec code
makes it look like stub call args are passed to the and_return block.
I can live with the above, I just don''t need it auto-verified
(I''m doing
that with should have_tag)
Thanks
Ashley
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/rspec-users/attachments/20080331/843a07ff/attachment.html