-
Notifications
You must be signed in to change notification settings - Fork 61
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
How to create a "dummy" mock where no expectations are required #578
Comments
You can already do this, partially. If your methods return type implements Default and you build mockall with the "nightly" feature, then every expectation will automatically return its default value. But you still must create the expectation. |
Thanks for your reply! I'll have a try. I don't feel this is the right way to go, can this issue be morphed into a feature request? I could also be a simple function with either:
|
No, it really can't become a new feature. At least, not on stable Rust, because absent Specialization there's no way for Mockall to know what return value to use if the user doesn't supply one. |
Okay, I like KISS too. At least we discussed it so people can find it back. Maybe I have to revise my implementation I need to test or my test itself. |
I couldn't find my answer anywhere. I remember from the Google Test framework I could create mocks that don't require any expectation to be set so tests would pass (see https://google.github.io/googletest/reference/mocking.html#NiceMock where you also have NaggyMock & StrictMock).
The current scenario I have is, I can call 2 dependencies where I want 2 separate tests where I check the expectations for each one of them.
The text was updated successfully, but these errors were encountered: