Closed GoogleCodeExporter closed 8 years ago
Simply changing the inheritance of the test from ControllerSpec to UnitSpec
does no fix the problem (point 4), as references to controller.redirectArgs,
mockParams etc. are now broken. Is there a known alternative?
Original comment by alexande...@gmail.com
on 10 Apr 2012 at 1:24
The old Spock unit testing support is effectively deprecated and *should not*
be used with Grails 2.
Grails 2 introduced an entirely new testing mechanism that is owned/maintained
by Grails core. You should use this wherever possible.
Please see:
http://grails.org/doc/latest/guide/testing.html#unitTestingControllers
The approach is exactly the same (e.g. the use of the annotations). So you just
need to adapt them to Spock, which means extending spock.lang.Specification and
not ControllerUnitTestSpec.
Original comment by lda...@gmail.com
on 15 Apr 2012 at 11:45
Ok, thanks for the heads up. This is one of a number of issues I've had with
using the old style tests in Grails 2. Is there a standard place to post such
error messages? They're mostly very opaque, so a big sign pointing from them
to the fact that old grails testing is deprecated could be very helpful for
anyone else getting bogged down in this.
Original comment by alexande...@gmail.com
on 20 Apr 2012 at 1:43
e.g.
| Error Error running script test-app functional: FolderList: cannot find
shared instance field (Use --stacktrace to see the full trace)
Original comment by alexande...@gmail.com
on 20 Apr 2012 at 1:44
Given that the old unit testing support is only deprecated for Grails 2.0, and
the plugin also supports 1.3, we probably cannot print any deprecation warnings
at this time.
Original comment by pnied...@gmail.com
on 12 May 2012 at 12:56
Closing as WontFix as the ControllerSpec class is not compatible with Grails 2.
Original comment by lda...@gmail.com
on 14 May 2012 at 7:36
Original issue reported on code.google.com by
zsxking
on 29 Mar 2012 at 7:12Attachments: