When creating artifacts or using scaffolding, Grails uses templates to create the domain classes, controllers, views, etc. The default templates are part of the Grails distribution for out of the box behaviour, but can be customized for project specific needs.
Copies the the templates used by Grails during code generation to your project directory:
$ grails install-templates
src/templates/
├── artifacts
│ ├── Tests.groovy
│ ├── ...
├── scaffolding
│ ├── Test.groovy
│ ├── ...
└── war
└── web.xml
The artifacts directory contains the templates used by the create-* commands.
The scaffolding directory contains templates used by the generate-* commands.
The war directory contains the web.xml template used to generate the deployment descriptor.
So you need to edit:
src/templates/artifacts/Tests.groovy
file, when execute grails create-unit-test
or grails create-integration-test
commands.
src/templates/scaffolding/Test.groovy
when execute grails generate-all
or grails
generate-controller
commands.
In your case regenerate your controller test and overwrite only your test file:
$ grails generate-controller com.arturoherrero.Post
| Generating controller for domain class com.arturoherrero.Post
> File /grails-app/controllers/com/arturoherrero/PostController.groovy already exists. Overwrite?[y,n,a] n
> File /test/unit/com/arturoherrero/PostControllerTests.groovy already exists. Overwrite?[y,n,a] y
| Finished generation for domain class com.arturoherrero.Post