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
An strange behaviour of should_receive... or mongoid... or me #222
Comments
I think Mongoid, like many ORMs, returns some sort of proxy object that delegates some--but not all--calls through. This doesn't always play nicely with a mocking library like rspec-mocks. I'd be game to investigate further if you pushed up a complete app that I can pull down and get running quickly. |
https://github.com/Mirubiri/strange-rspec There goes |
@alindeman I made a comment on the issue from a Mongoid side (https://github.com/mongoid/mongoid/issues/2788) - I don't believe there is anything that can be done from either framework to allow this expectation to work that is easily accomplished and makes sense to implement. I'd say you can go ahead and close. |
Thanks for the response. I agree. |
I have found an strange behaviour of should_receive which is this:
It brings me this:
but when I change "Parent.new.build_child" to "Child.new" it passes! and both methods return instances of Child!. I don't know if i'm missing something or if it is a bug of rspec or perhaps mongoid but Im getting mad with this. (Fabrication also fails with Fabricate.build(:parent).child)
The text was updated successfully, but these errors were encountered: