Skip to content

Instantly share code, notes, and snippets.

@jaco0646
Created May 9, 2019 22:57
Show Gist options
  • Save jaco0646/6347541de3591bf8845a4a837b5dcdae to your computer and use it in GitHub Desktop.
Save jaco0646/6347541de3591bf8845a4a837b5dcdae to your computer and use it in GitHub Desktop.
Spock Lifecycle
import spock.lang.Specification
class SpockLifecycleSpec extends Specification {
def setupSpec() {
println 'setupSpec'
}
def setup() {
println 'setup'
}
def cleanup() {
println 'cleanup'
}
def cleanupSpec() {
println 'cleanupSpec'
}
def test() {
given:
println 'given'
when:
println 'when'
then:
println 'then'
interaction {
println 'interaction'
}
where:
where << [where(1), where(2)]
}
static where(int count) {
println "where$count"
}
}
//setupSpec
//where1
//where2
//setup
//given
//interaction
//when
//then
//cleanup
//setup
//given
//interaction
//when
//then
//cleanup
//cleanupSpec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment