Closed magx2 closed 8 years ago
Try to activate the services and rending plugin for the test by declaring this the test class:
import static grails.test.runtime.GrailsApplicationTestPlugin.TestRuntimeGrailsApplicationPostProcessor.DEFAULT_INCLUDED_PLUGINS
...
static includePlugins = DEFAULT_INCLUDED_PLUGINS + ['services', 'rendering']
I would be very much in favor of removing the automatic injection of the pdfRenderingService by the trait.
The solution is to make each wired bean use required=false
:
Example:
@Autowired(required=false)
and then add a null check in the render methods.
Pull requests welcome.
@graemerocher What kind of null check you want?
smt like this:
if (pdfRenderingService) {
// do stuff
} else {
log.warning(...)
}
or
if (pdfRenderingService) {
// do stuff
} else {
throw new IllegalStateException('there is no pdfRenderingBean')
}
the latter seems reasonable
Please look at PR #32
merged thanks
Will you do release with this issue?
When I add Grails Rendering Plugin (
compile "org.grails.plugins:rendering:2.0.1"
) into my dependencies all my SpockUnit test with controllers are getting broken.The error that I got is:
Also I have in my build.gradle file dependency on Spring test:
runtime 'org.springframework:spring-test:4.1.7.RELEASE'
. As far as I know this is needed for rendering pluginGrails version: 3.0.9