-
-
Notifications
You must be signed in to change notification settings - Fork 968
Closed
Labels
Milestone
Description
nullable: true does not work within unit tests. The following test describes the problem.
// when @TestFor is removed test fails
//@TestFor(IndividualPerson)
class IndividualPersonSpec extends HibernateSpec {
@Override
List<Class> getDomainClasses() {
[Address, IndividualPerson, Season, User, InvoiceAddress]
}
void "Validation fails"() {
given:
def member = new IndividualPerson(firstname: 'helo', name: 'wangler', memberSince: '2014', active: Boolean.TRUE)
when:
def valid = member.validate()
and:
member.save()
then: 'validation fails'
valid
and: 'and of course member is null'
member.id
}
}
Steps to Reproduce
- Checkout Grails 3.2.1 app
- Run test
Expected Behaviour
Validation should work as in production mode.
Actual Behaviour
Validation nullable: true is not respected
Environment Information
- Operating System: macOS Sierra
- Grails Version: 3.2.1
- JDK Version: 1.8
Example Application
- see above