This post explains how to open a Grails 3 App with IntelliJ as described in the Grails 3 IntelliJ Quickcast by Jeff Scott Brown First, force IntelliJ to run Grails tests in the test environment.
I am fan of restricting my Grails 3 Controller’s actions to certain HTTP methods. If an action does not modify the database let use GET, if an action inserts a new row in the database lets use POST, if an action deletes a row form the database lets use DELETE and so on. With Grails […]
Craig Atkinson‘s talk at GR8Conf US Intro to Spock and Geb claimed the next about Spock Cleanup / Inheritance. Might have a hierarchy of test classes for DRY common test code Spock runs the base class setup first Then goes down the inheritance chain cleanup is the reverse, starting at test class then going up […]
It is easy to ignore a test only if the test is run in a particular environment thanks to the @IgnoreIf Spock annotation. If you run your tests in Jenkins, it is probable that the tests are being run by a user called jenkins. Thus, you can ignore a test in a Jenkins Job easily: […]
Sometimes you have a domain class with multiple fields and you would like to test a single constraint. Create a Grails app test-app Add a firstName, lastName and age to the Person domain class Add the next test to validate the age constraint: Test fails: By default domain class’ fields have the constraint nullable: false. […]