Details
Description
I encountered this issue when trying to use createLink in unit and integration tests. The problem pops up in 1.1.1 when creating integration tests since the "create-integration-test" script generates a test that subclasses GrailsUnitTestCase rather than GroovyTestCase. GrailsUnitTestCase sets grailsApplication.config to null in its tearDown routine which causes any additional tests that call createLink in that particular run to fail (the first one succeeds).
After changing the integration test to subclass GroovyTestCase, you don't get this issue but it can crop up in other contexts. The specific suggestion is to change the first line of makeServerURL to use null-safe referencing, i.e.
def u = ConfigurationHolder.config?.grails?.serverURL
More generally though, it would be nice to clarify how/when ApplicationTagLib actions can be used. I am using them in services and in tests that exercise those services and had to explicitly create an ApplicationTagLib in order to call the tag.
Issue Links
| This issue relates to: | ||||
| GRAILS-5686 | Integration Testing json response for controller , single test passes but same test in multiple tests fails |
|
|
|
This bug makes unit testing withFormat in a ControllerUnitTestCase fail as described in http://agileice.blogspot.com/2009/09/grails-integration-testing.html