Created
October 11, 2012 16:40
-
-
Save willryan/3873734 to your computer and use it in GitHub Desktop.
Geb DB test helpers
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
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) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment