grails.gorm.tests.AttachMethodSpec.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grails-datastore-gorm-tck Show documentation
Show all versions of grails-datastore-gorm-tck Show documentation
GORM - Grails Data Access Framework
package grails.gorm.tests
/**
* @author graemerocher
*/
class AttachMethodSpec extends GormDatastoreSpec {
void "Test attach method"() {
given:
def test = new Person(firstName:"Bob", lastName:"Builder").save()
when:
session.flush()
then:
session.contains(test) == true
test.isAttached()
test.attached
when:
test.discard()
then:
!session.contains(test)
!test.isAttached()
!test.attached
when:
test.attach()
then:
session.contains(test)
test.isAttached()
test.attached
when:
test.discard()
then:
test == test.attach()
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy