On Tue, Dec 20, 2011 at 10:36 PM, ld...@ldaley.com <ld...@ldaley.com> wrote:
Thanks. Will verify soon with our app.
I can't see anything, I'm stumped.
I found why. Details below :-)
That's why GrailsTestCompiler and then weaving of
DomainClassUnitTestMixin also does not come into the picture for your
tests. So, it's all clean.
That's not the case, the Gradle build is delegating to the Grails build
system so they are compiled the same way. I'm at a a loss to explain why
these tests pass.
Went nearly crazy debugging through Grails 2.0 + Gradle + Groovy 1.8.4 +
grails-gradle-plugin + grails-launcher + spock-grails plugins, and here is
the simple difference between my application and your spock-grails with
- In my app, for a unit test like AndroidClientSpec, I have a domain
class AndroidClient. In your app, for unit tests like UnitSpecSpec,
GoodSpec, there are no corresponding classes UnitSpec or Good
- The way Grails 2.0 TestForTransformation works is that it
auto-magically applies @TestFor and weaves all its mock / mixin stuff to a
unit test only if for FooTests or FooSpec unit test, it finds a Foo
So, if you want to cover this auto-magic mixing of old style unit tests
(that extend UnitSpec) in your spock-grails test application, then you need
to introduce a correspnding artefact (domain class, say), and you should
see that then Grails 2.0 will then weave stuff into that test, while
skipping other tests that don't have a matching class to test / mock for.