public
Last active

Geb DB test helpers

  • Download Gist
MyBaseGebTest.groovy
Groovy
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
abstract class MyBaseGebTest extends GebReportingTest {
SessionFactory sessionFactory = ApplicationHolder.application.mainContext.sessionFactory
 
def inTransaction(closure) {
inNewSession {
TransactionRunner.getInstance().runInNewTransaction(closure)
}
}
 
def inNewSession(closure) {
// GORM class is arbitrary, I just picked one of ours
MyModelClass.withNewSession { session ->
closure(session)
}
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.