-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GrailsUnitTest.defineBeans(new PluginClass()) does not set grailsApplication /applicationContext? #43
Comments
boardbloke
changed the title
defineBeans(new PluginClass()) does not set grailsApplication /applicationContext?
GrailsUnitTest.defineBeans(new PluginClass()) does not set grailsApplication /applicationContext?
Sep 13, 2018
I believe this is the same root cause as for https://github.com/agorapulse/dru/issues/15.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a custom TagLib that makes use of the asset-pipeline-grails (version 3.0.6) AssetsTagLib to display images. It calls asset.image() to output an image tag when it renders.
In order to test this, I have a CustomTagLibSpec that implements TagLibUnitTest, and in the setup method I was expecting to be able to do the following to bootstrap and mock the the relevant asset dependencies:
On running the unit test though, I get a failure because grailsApplication is used in the AssetPipelineGrailsPlugin.doWithSpring Closure, and that is not set.
If I change my unit test code to
Then my unit test works.
Given that all plugins implement Plugin, and therefore ApplicationContextAware, and GrailsApplicationAware, can the defineBeans(Object plugin) method in GrailsUnitTest be changed to set the grailsApplication and applicationContext from the unit test to avoid having to do it manually please ?
The text was updated successfully, but these errors were encountered: