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

Verifying doubles with mock_model #25

Open
JasonBarnabe opened this issue May 31, 2016 · 0 comments
Open

Verifying doubles with mock_model #25

JasonBarnabe opened this issue May 31, 2016 · 0 comments

Comments

@JasonBarnabe
Copy link

Verifying doubles allows you to ensure that you're not mocking up attributes and methods that don't exist on the mocked class.

rspec-activemodel-mocks should support verifying doubles when using mock_model. I was able to enable it by simply changing:

double("#{model_class.name}_#{stubs[:id]}", stubs).tap do |m|

double("#{model_class.name}_#{stubs[:id]}", stubs).tap do |m|

to

instance_double(model_class, stubs).tap do |m|

This works great for how I'm using this gem, but I suspect it might break things for other users, for example if mock_model was passed "A String representing a Class that does not exist" (?)

I would be happy to work on a PR if given some advice on how to proceed.

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

1 participant