-
Notifications
You must be signed in to change notification settings - Fork 0
/
SpockSpec.groovy
36 lines (29 loc) · 1.15 KB
/
SpockSpec.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//@Grab(group='org.spockframework', module='spock-core', version='0.7-groovy-2.0') // works...
//@Grab(group='org.spockframework', module='spock-core', version='1.0-groovy-2.4') // ...doesn't?
@Grapes(
@Grab(group='org.spockframework', module='spock-core', version='0.7-groovy-2.0')
)
import spock.lang.Specification
import java.lang.Void as Should // haha!
class SpockSpec extends Specification {
// setup main object; mocks done within "features"
def spock = Spock.instance
Should 'be a logical, nice, vulcan named spock'() {
expect:
Spock.instance.decideIfNiceOrNasty() == 'i am a _nice logical_ creature'
Spock.instance.type() == 'vulcan'
Spock.instance.name() == 'spock'
}
Should 'decide if logical'() {
when:
def reaction = Spock.instance.decideIfLogical(20, 20)
then:
reaction == "'20 == 20' is logical"
}
Should 'decide if illogical'() {
when:
def reaction = Spock.instance.decideIfLogical(20, 'an apple')
then:
reaction == "'20 == an apple' is _illogical_, captain"
}
} // SpockSpec