Hi,
I am not sure if this is Spock issue, but since it occurred to me after upgrading from an old snapshot release to 0.6-final, I think this is the right place to ask. This spec:
@TestFor(User)
class UserSpec extends Specification
{
@Shared User user
def setup()
{
def username = "username"
def password = "password"
def email = "te...@spotmapping.com"
user = new User(username: username, password: password, email: email)
}
def "everything valid"()
{
expect: "user is valid"
user.validate()
}
}
results in the following error:
| Failure: everything valid(com.spotmapping.domain.security.UserSpec)
| java.lang.IllegalStateException: Already value [org.grails.datastore.mapping.transactions.SessionHolder@6c5dfd35] for key [org.grails.datastore.mapping.simple.SimpleMapDatastore@7b7f9803] bound to thread [main]
at org.grails.datastore.mapping.core.DatastoreUtils.bindSession(DatastoreUtils.java:336)
at grails.test.mixin.domain.DomainClassUnitTestMixin.connectDatastore(DomainClassUnitTestMixin.groovy:110)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:176)
at org.spockframework.runtime.extension.builtin.JUnitFixtureMethodsExtension$FixtureType$FixtureMethodInterceptor.intercept(JUnitFixtureMethodsExtension.java:145)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:84)
at org.spockframework.runtime.extension.builtin.JUnitFixtureMethodsExtension$FixtureType$FixtureMethodInterceptor.intercept(JUnitFixtureMethodsExtension.java:148)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:84)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:176)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:176)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:176)
WARN 07/Mar/2012 18:46:46,362 DatastoreUtils Cannot unbind session, it's not registered in a SessionHolder
With my old snapshot release I also got the warning, but the test passed successful. Any idea what might cause this? Thanks!