How to test flash.message in a Grails webflow?

Posted by callie16 on Stack Overflow See other posts from Stack Overflow or by callie16
Published on 2011-04-28T04:53:42Z Indexed on 2011/06/21 16:22 UTC
Read the original article Hit count: 197

Filed under:
|
|

I'm using webflows in Grails and I'm currently writing tests for it. Now, inside I've got something that throws an error so I set a message to the flash scope before redirecting:

...
if (some_condition) {
   flash.message = "my error message"
   return error()
}
...

Now, I know that when I'm going to display this in the GSP page, I access the flash message as

<g:if test="${message}">...

instead of the usual

<g:if test="${flash.message}">...

So anyway, I'm writing my test and I'm wondering how to test the content of the message? Usually, in normal actions in the controllers, I follow what's written in here . However, since this is a webflow, I can't seem to find the message even if I check controller.flash.message / controller.params.message / controller.message . I've also tried looking at the flow scope...

Any ideas on how to see the message then? Thanks a bunch!

© Stack Overflow or respective owner

Related posts about testing

Related posts about grails