Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- java.lang.IllegalStateException: Method on class [sampleplugin.Person] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails correctly.
- at org.grails.datastore.gorm.GormEntity$Trait$Helper.currentGormInstanceApi(GormEntity.groovy:52)
- at org.grails.datastore.gorm.GormEntity$Trait$Helper.save(GormEntity.groovy:165)
- at sampleplugin.PersonSpec.$tt__$spock_feature_0_1(PersonSpec.groovy:25)
- at sampleplugin.PersonSpec.test save_closure2(PersonSpec.groovy)
- at groovy.lang.Closure.call(Closure.java:423)
- at groovy.lang.Closure.call(Closure.java:439)
- at grails.transaction.GrailsTransactionTemplate$1.doInTransaction(GrailsTransactionTemplate.groovy:67)
- at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
- at grails.transaction.GrailsTransactionTemplate.executeAndRollback(GrailsTransactionTemplate.groovy:64)
- at sampleplugin.PersonSpec.test save(PersonSpec.groovy)
- package sampleplugin
- class Person {
- String name
- }
- package sampleplugin
- import grails.test.mixin.integration.Integration
- import grails.transaction.*
- import spock.lang.*
- @Integration
- @Rollback
- class PersonSpec extends Specification {
- void "canary test"() {
- expect:
- true == true
- }
- void "test save"() {
- when:
- new Person(name: "John Doe").save flush:true
- then:
- 1 == Person.count()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement