Originally reported on Google Code with ID 305
Spock should offer an API that allows
* Creating a mock outside a Specification instance (for example a bean instance managed
by some container such as Spring, etc.)
* Associate such a mock with the current specification instance.
This would allow creating an integration test where complex interactions with external
resources such as 3rd-party services (web service) can be mocked. This is often requried
as these services are slow, accessible only with complex authentication, etc.
See also the forum discussion at https://groups.google.com/forum/?fromgroups=#!topic/spockframework/mKD4HD7tbEs
Reported by Martin.Ahrer on 2013-03-27 10:35:03
When it comes to integration testing, an alternative (that I tend to prefer) is to hand-roll
a fake object. However, I understand that opinions on this matter differ, and it shouldn't
be too difficult to support this use case.
Reported by pniederw on 2013-03-27 11:12:27
I would be very interested in this feature and willing to help on the implementation.
It would be awesome if we could do something like Springokito's @ReplaceWithMock https://bitbucket.org/kubek2k/springockito/wiki/springockito-annotations
Reported by l.bruenings on 2013-07-10 17:56:55
Any news about this? I think the feature would still be useful.
See #17
Is there a 1.1 release (or even a beta release) coming anytime soon? We would like to use this feature in production.
We also need this feature.
I could not find any information about the planned 1.1 release. Is there a planned time or should we better use a snapshot build?
+1folks, this feature is much needed!
+1
Implemented in #546
Will be released in 1.1
@robfletcher could you share a quick example of how to do this?
@Blackbaud-JasonBodnar You can take a look into PRs diff. For example those tests.
@Blackbaud-JasonBodnar see also http://spockframework.org/spock/docs/1.1-rc-3/modules.html
Most helpful comment
@Blackbaud-JasonBodnar see also http://spockframework.org/spock/docs/1.1-rc-3/modules.html