Skip to content

Commit

Permalink
Test case for #676 (GRAILS-11855). The fix is in grails-data-mapping.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbywarner committed Apr 29, 2015
1 parent 45e80e5 commit ae57f6c
Showing 1 changed file with 36 additions and 0 deletions.
@@ -0,0 +1,36 @@
package grails.test.mixin.domain

import grails.persistence.Entity
import grails.test.mixin.TestFor
import spock.lang.Specification

@TestFor(Person)
class SaveDomainSpec extends Specification {

void 'test dateCreated and lastUpdated populated'() {
given:
Person person = new Person(name: 'Bobby')

when:
person.save(flush: true)

then:
person.dateCreated != null
person.lastUpdated != null
person.dateCreated == person.lastUpdated

when:
person.name = 'Bobby Updated'
person.save(flush: true)

then:
person.lastUpdated > person.dateCreated
}
}

@Entity
class Person {
String name
Date dateCreated
Date lastUpdated
}

0 comments on commit ae57f6c

Please sign in to comment.