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

mock.instance_of does not verify that method is called #32

Open
mikeymicrophone opened this issue Mar 19, 2010 · 1 comment
Open

mock.instance_of does not verify that method is called #32

mikeymicrophone opened this issue Mar 19, 2010 · 1 comment

Comments

@mikeymicrophone
Copy link

mock.instance_of(User).explode
the spec passes even if User#explode is never invoked

@btakita
Copy link
Owner

btakita commented Apr 10, 2010

This one is a little tricky. Currently, the mock expectation is on an instance basis. User.new is stubbed, with no times called expectation. If User.new is invoked, the returned User has the expectation that explode will be called once.

Since spies were implemented, RR keeps track of the method calls. We could treat this more like User#explode must be invoked once globally.

I will be adding mock.all_instances_of (currently it's in master but not yet released), which will override the User class, removing the dependence on User.new. It could totally work in that case.

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

No branches or pull requests

2 participants