I have a controller with actions using the isLoggedIn() function provided by the Grails Spring Security Core plugin. I want to be able to unit test these actions, and I therefore need a way to mock the isLoggedIn() function so that it always returns false. This method is provided by a trait, which I believe is the source of my issue.
I have already tried to add a new function to the metaclass:
UserController.metaClass.isLoggedIn = { -> false}
This does not seem to be working, however; the original method is still being called.
Any suggestions as to how this can be accomplished?