SublimeText / RSpec

Sublime Text 2 / 3 plugin for RSpec BDD Framework
124 stars 57 forks source link

use and_return as default on allow stubs instead of with args #63

Closed tim3z closed 9 years ago

tim3z commented 9 years ago

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.

princemaple commented 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)

tim3z commented 9 years ago

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.

princemaple commented 9 years ago

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?

princemaple commented 9 years ago

bump

tim3z commented 9 years ago

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.

princemaple commented 9 years ago

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.

tim3z commented 9 years ago

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

princemaple commented 9 years ago

Very kind of you, sir! Thanks and merging.