Grails Unit testing GORM global constraints

315 Views Asked by At

I have an issue where the global constraints setup in the Config are not working when running unit tests.

This is in my Config.groovy:

grails.gorm.default.constraints={
'*'(nullable:true, bindable:true)
}

in my test I have tried this:

static doWithConfig(c){
c.grails.gorm.default.constraints={
'*'(nullable:true, bindable:true)
}

and also in the setupSpec():

grailsApplication.config.grails.gorm.default.constraints={
'*'(nullable:true, bindable:true)
}

All I'm doing in my test is trying to create a domain object from a json string. Is there anything special that I should be doing to get this to work in the Unit test? This is also using the Gorm-MongoDb plugin.

0

There are 0 best solutions below