Closed tim3z closed 9 years ago
Would you think it's better to write out the comprehensive case, so other users can simply backspace the ones they don't want? I do agree that and_return
is used more than with
(and should be anyways)
hm personally I like the only return more. But thats mainly a matter of project backwards compatibility and of how people use it, right? I just looked through my own specs and I had in maybe 10-20% of the cases where I would mock a .with
. Dunno if thats representative and if thats worth it.
So... what do you do when you want a with
call?
You expand the snippet, tab through and fill out $1 and $2, on $3 you press left to fill in .with(...)
then tab to $4 results?
bump
Yeah something like that. I mean it happens pretty seldom. Mostly it will be: do the snippet without .with
and then write some spec, notice oh I need to be more precise, I need args, so lets add .with
. But I can change it to the complete version. I don't mind either.
Yeah I think it is better to have the complete version for now. I'm sure most unit test lovers and TDD guys use .with
very often.
Thanks a lot for sending PRs and having discussions, BTW.
Your welcome. Well those are just a bunch of adjustments I made for my own use where I figured they might be useful to the rest of the world, too :smile: Updated to have both .with
and .and_return
Very kind of you, sir! Thanks and merging.
Since
allow
is usually used for stubbing there will almost always be a value to be returned - probably more often than arguments to check. This PR changes the allow snippet reflect that.