开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜