@@ -68,20 +68,20 @@ class PromiseSpec extends Specification {
68
68
69
69
when : ' a promise list is created from two promises'
70
70
def p1 = Promises . createPromise {
71
- sleep 200
71
+ sleep 200 // simulate long running task
72
72
1 + 1
73
73
}
74
74
def p2 = Promises . createPromise {
75
- sleep 200
75
+ sleep 200 // simulate long running task
76
76
2 + 2
77
77
}
78
78
def list = Promises . createPromise(p1, p2)
79
79
def result = null
80
80
list. onComplete { result = it }
81
81
82
82
then : ' the result is correct'
83
- new PollingConditions (timeout : 5 ). eventually {
84
- result == [2 , 4 ]
83
+ new PollingConditions (timeout : 5 , delay : 0.2 ). eventually {
84
+ assert result == [2 , 4 ]
85
85
}
86
86
}
87
87
@@ -95,17 +95,17 @@ class PromiseSpec extends Specification {
95
95
list. onComplete { result = it }
96
96
97
97
then : ' the result is correct'
98
- new PollingConditions (timeout : 5 ). eventually {
99
- result == [2 , 4 ]
98
+ new PollingConditions (timeout : 5 , delay : 0.2 ). eventually {
99
+ assert result == [2 , 4 ]
100
100
}
101
101
102
102
when : ' a promise list is created from two closures'
103
103
list = Promises . createPromise({ 3 + 3 }, { 4 + 4 })
104
104
list. onComplete { result = it }
105
105
106
106
then : ' the result is correct'
107
- new PollingConditions (timeout : 5 ). eventually {
108
- result == [6 , 8 ]
107
+ new PollingConditions (timeout : 5 , delay : 0.2 ). eventually {
108
+ assert result == [6 , 8 ]
109
109
}
110
110
}
111
111
@@ -119,9 +119,9 @@ class PromiseSpec extends Specification {
119
119
promise. onError { hasError = true }
120
120
121
121
then : ' the onComplete handler is invoked and the onError handler is ignored'
122
- new PollingConditions (timeout : 5 ). eventually {
123
- result == 2
124
- hasError == false
122
+ new PollingConditions (timeout : 5 , delay : 0.2 ). eventually {
123
+ assert result == 2
124
+ assert hasError == false
125
125
}
126
126
}
127
127
@@ -135,10 +135,10 @@ class PromiseSpec extends Specification {
135
135
promise. onError { error = it }
136
136
137
137
then : ' the onComplete handler is invoked and the onError handler is ignored'
138
- new PollingConditions (timeout : 5 ). eventually {
139
- ! result
140
- error
141
- error. message. contains(' bad' )
138
+ new PollingConditions (timeout : 5 , delay : 0.2 ). eventually {
139
+ assert ! result
140
+ assert error
141
+ assert error. message. contains(' bad' )
142
142
}
143
143
}
144
144
0 commit comments