grails - Test UrlMapping Paths for Resource Controllers -
in grails 2.3 , above, there concept of resource controller. however, not seem work asserturlmappings
concepts.
/foo (resources:"foo")
then in url-mappings-report
following appears:
controller: foo | | /foo | action: index | | /foo/create | action: create | post | /foo | action: save | | /foo/${id} | action: show | | /foo/${id}/edit | action: edit | put | /foo/${id} | action: update | patch | /foo/${id} | action: patch | delete | /foo/${id} | action: delete
however, in following file, urls cannot tested:
@testfor(urlmappings) @mock(foocontroller) class foourireversemappingsspec extends specification { def "ensure basic mapping operations foo uris"() { expect: asserturlmapping(url, controller: expectctrl, action: expectaction) { id = expectid } where: url | expectctrl | expectaction | expectid // not sure why, resource controller generation url test not find real 'foos' url '/foo/123'|'foo'|'show'|'123' } }
then without default action url $controller/$action/$id (which match foo/show/123
) test cannot find generated url.
the generated error is: junit.framework.assertionfailederror: url '/foo/123' did not match mappings
is there way test resource urls?
Comments
Post a Comment