Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to receive with a hash of mappings, similar to double(:name, hash) #389

Closed
rosenfeld opened this issue Aug 1, 2013 · 1 comment
Closed

Comments

@rosenfeld
Copy link

Currently one can use a shorthand version of double which is very useful, as in:

user = double(:user, id: 1, username: 'admin')

It would be useful to extend this feature when stubbing existing objects as in:

allow(controller).to receive(:authenticate_user!, current_user: user, ...)

The idea is to extract latest argument if it is a hash. In that case, the values will be the return value for the methods as the key names.

For the other arguments, just stubs them as in:

allow(controller).to receive :authenticate_user!

I'd much prefer this style for lots of my stubbings...

@myronmarston
Copy link
Member

This is a duplicate of #368. Closing so we can keep the discussion there, in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants