grails.gorm.tests.QueryAfterPropertyChangeSpec.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grace-datastore-gorm-tck Show documentation
Show all versions of grace-datastore-gorm-tck Show documentation
Grace Data : Grace Datastore Gorm Tck
package grails.gorm.tests
/**
* @author graemerocher
*/
class QueryAfterPropertyChangeSpec extends GormDatastoreSpec {
void "Test that an entity is de-indexed after a change to an indexed property"() {
given:
def person = new Person(firstName:"Homer", lastName:"Simpson").save(flush:true)
when:
session.clear()
person = Person.findByFirstName("Homer")
then:
person != null
when:
person.firstName = "Marge"
person.save(flush:true)
session.clear()
person = Person.findByFirstName("Homer")
then:
Person.findByFirstName("Marge") != null
person == null
}
}