Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class OneTimeDataUnitTestMixin extends GrailsUnitTestMixin {
def mockOneTimeData(spec, controller) {
spec.metaClass.otdData = [:]
spec.metaClass.otdId = 1
controller.metaClass.oneTimeData << { Closure dataSetup ->
dataSetup.delegate = spec.otdData
dataSetup()
spec.otdId
}
controller.metaClass.getOneTimeData << { ->
spec.otdData
}
controller.metaClass.getOneTimeData << { String id ->
spec.otdData
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.