My previous post showed how to get around some of the shortcomings of testing Grails Controllers with the ControllerSpec provided by the Spock testing framework.

I also found that ControllerSpec is a subclass of UnitSpec, so it does not provide transactional rollback. This makes ControllerSpec somewhat undesirable for an integration test.

So, I merged the code for ControllerSpec and IntegrationSpec to create ControllerIntegrationSpec. It works just like ControllerSpec, but executes each test method in a transaction, and rolls the transaction back at the end of the method.

Here is the Groovy source, which can also be found at