Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[Feature Request] Support for reusable mocks #845
I use Spock for testing my Grails applications. Currently, the
My goal is to define reusable mocks which can be used across multiple test files and override this at places if needed.
Quoted from the document:
This feature helps the developer to create reusable mocks and inject it across multiple test cases and override them if needed. Here is a sample app which demonstrates the use of this feature.
Is there a way to implement something similar with Spock? The feature would really help with organized code, readability, and maintainability.
The issue with this request is, that the actual mock interactions are part of the Specification not the mock. Furthermore, the mock syntax only works in Specifications, since it is done via AST magic. So this won't be easy.
However, you can do use a custom