1) _GrailsTest.groovy.compileTests() chooses to use extended compiler
'testc' (GrailsTestCompiler) for unit tests classes.
2) GrailsTestCompiler injects a ASTTransformationCustomizer for
3) Because of the ASTTransformationCustomizer added in 2), Groovy now
introduces TestForTransformation for all unit test classes, which in turn
weaves in methods from DomainClassUnitTestMixin into the unit test classes.
In this chain, what do you see that can be local to a particular
environment? I can look more, if you can provide a hint.
Looked at your tests for spock-grails plugin.
The difference is that you use gradle based build for it. So (refer 1-3
above), _GrailsTest.groovy does not come into the picture as it does when
"grails test-app unit:" is done. That's why GrailsTestCompiler and then
weaving of DomainClassUnitTestMixin also does not come into the picture for
your tests. So, it's all clean.
I am attaching an almost blank grails application created with Grails 2.0.0.
All I did was:
a) create an app
b) add a dependency to plugin ':spock:0.6-SNAPSHOT'
c) grails create-domain-class book
d) grails test-app unit: -> *this now fails to compile BookSpec added in 3)
due to the very same error that I have been reporting and explaining :-)*