Details
Description
In my integration test, I get the above error when using "render(template:'/trip/list')" but not when using "render(view:'list')"
TripController.groovy
================
class TripController {
def list = {
render(template:'/trip/list', model:[tripInstanceList: Trip.list(params),
tripInstanceTotal: Trip.count()])
}
}
The above runs fine, with "grails run-app". However, "grails test-app" fails (happens in Grails 1.1 and Grails 1.2M4):
TripControllerTests.groovy
===================
class TripControllerTests extends GroovyTestCase {
void testList() {
def tripController = new TripController()
tripController.list()
}
}
Error:
====
Error executing tag <g:sortableColumn>: org.codehaus.groovy.grails.web.mapping.exceptions.UrlMappingException: Unable to create URL for mapping [/(*)/(*)?/(*)?] and parameters [{sort=id, order=asc, action=list}]. Parameter [controller] is required, but was not specified! (F:/work/test_project/test-app/grails-app/views/trip/_list.gsp:5)
org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Error executing tag : org.codehaus.groovy.grails.web.mapping.exceptions.UrlMappingException: Unable to create URL for mapping [/(*)/(*)?/(*)?] and parameters [{sort=id, order=asc, action=list}]. Parameter [controller] is required, but was not specified! (F:/work/test_project/test-app/grails-app/views/trip/_list.gsp:5)
However,
def list = { render(view:'list', model:[tripInstanceList: Trip.list(params), tripInstanceTotal: Trip.count()]) }
works, as does
def list = { [tripInstanceList: Trip.list(params), tripInstanceTotal: Trip.count()] }
There is a workaround. Set the controller name manually in your test.