This repository has been archived by the owner on Jan 19, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from yamkazu/GRAILS-9922
GRAILS-9922 - After a test of validation error, another test of delete() was failed
- Loading branch information
Showing
4 changed files
with
74 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
grails-datastore-gorm-hibernate/src/test/groovy/grails/gorm/tests/DeleteSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package grails.gorm.tests | ||
|
||
import spock.lang.Issue | ||
|
||
class DeleteSpec extends GormDatastoreSpec { | ||
|
||
@Issue("GRAILS-9922") | ||
def "Test deleting an entity that has a validation error"() { | ||
when: | ||
def entity = new TestEntity(name: "Bob", age: 44).save(flush: true) | ||
|
||
then: | ||
!entity.hasErrors() | ||
TestEntity.count() == 1 | ||
|
||
when: | ||
entity.name = "" | ||
entity.save(flush: true) | ||
|
||
then: | ||
entity.hasErrors() | ||
|
||
when: | ||
entity.delete(flush: true) | ||
|
||
then: | ||
TestEntity.count() == 0 | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
grails-datastore-gorm-hibernate4/src/test/groovy/grails/gorm/tests/DeleteSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package grails.gorm.tests | ||
|
||
import spock.lang.Issue | ||
|
||
class DeleteSpec extends GormDatastoreSpec { | ||
|
||
@Issue("GRAILS-9922") | ||
def "Test deleting an entity that has a validation error"() { | ||
when: | ||
def entity = new TestEntity(name: "Bob", age: 44).save(flush: true) | ||
|
||
then: | ||
!entity.hasErrors() | ||
TestEntity.count() == 1 | ||
|
||
when: | ||
entity.name = "" | ||
entity.save(flush: true) | ||
|
||
then: | ||
entity.hasErrors() | ||
|
||
when: | ||
entity.delete(flush: true) | ||
|
||
then: | ||
TestEntity.count() == 0 | ||
} | ||
|
||
} |