Grails Integrationtest - Request Object
I'm testing a controller and there I defined an action which uses a value from the requestobject.
How can I mock the request object in an integration test?
I know that integration tests don't run in an Servlet, so there is no Reques开发者_运维技巧tobject, but how do I obtain it?
Quickest thing is to mock needed methods using Map coercion:
myController.request = [ getHeader: { -> '0' } ]
(that link also includes Expando sample).
If you need extensive Request usage, try functional-test plugin.
精彩评论