Use of GORM methods in Integration test
- by canotto90
I'm trying to use gorm find method on my domain class, inside of an Spock Integration Spec.
My code:
class myDomainClassSpec extends IntegrationSpec{
...
def 'my test'() {
when: ...
then:
MyDomainClass.find { id == 1 }
}
...
}
This fails, throwing:
groovy.lang.MissingPropertyException: No such property: id for class: grails.gorm.DetachedCriteria
If instead I code: MyDomainClass.findAll().find { id == 1 } it works.
Any ideas??