@@ -32,7 +32,7 @@ module Concurrent
32
32
Thread . new { subject . wait . tap { latch . count_down } }
33
33
sleep ( 0.1 )
34
34
subject . set
35
- expect ( latch . wait ( 1 ) ) . to be_truthy
35
+ expect ( latch . wait ( 1 ) ) . to be true
36
36
end
37
37
38
38
it 'sets the state to set' do
@@ -49,12 +49,12 @@ module Concurrent
49
49
end
50
50
51
51
it 'returns true if not previously set' do
52
- expect ( subject . try? ) . to be_truthy
52
+ expect ( subject . try? ) . to be true
53
53
end
54
54
55
55
it 'returns false if previously set' do
56
56
subject . set
57
- expect ( subject . try? ) . to be_falsey
57
+ expect ( subject . try? ) . to be false
58
58
end
59
59
end
60
60
@@ -69,20 +69,20 @@ module Concurrent
69
69
latch = CountDownLatch . new ( 1 )
70
70
Thread . new { subject . wait . tap { latch . count_down } }
71
71
subject . reset
72
- expect ( latch . wait ( 0.1 ) ) . to be_falsey
72
+ expect ( latch . wait ( 0.1 ) ) . to be false
73
73
end
74
74
75
75
it 'does not interrupt waiting threads when event is unset' do
76
76
latch = CountDownLatch . new ( 1 )
77
77
Thread . new { subject . wait . tap { latch . count_down } }
78
78
subject . reset
79
- expect ( latch . wait ( 0.1 ) ) . to be_falsey
79
+ expect ( latch . wait ( 0.1 ) ) . to be false
80
80
subject . set
81
- expect ( latch . wait ( 0.1 ) ) . to be_truthy
81
+ expect ( latch . wait ( 0.1 ) ) . to be true
82
82
end
83
83
84
84
it 'returns true when called on an unset event' do
85
- expect ( subject . reset ) . to be_truthy
85
+ expect ( subject . reset ) . to be true
86
86
end
87
87
88
88
it 'sets the state of a set event to unset' do
@@ -95,7 +95,7 @@ module Concurrent
95
95
it 'returns true when called on a set event' do
96
96
subject . set
97
97
expect ( subject ) . to be_set
98
- expect ( subject . reset ) . to be_truthy
98
+ expect ( subject . reset ) . to be true
99
99
end
100
100
end
101
101
@@ -133,42 +133,42 @@ module Concurrent
133
133
latch = CountDownLatch . new ( 1 )
134
134
subject . set
135
135
Thread . new { subject . wait ( 1000 ) ; latch . count_down }
136
- expect ( latch . wait ( 0.1 ) ) . to be_truthy
136
+ expect ( latch . wait ( 0.1 ) ) . to be true
137
137
end
138
138
139
139
it 'returns true once the event is set' do
140
140
subject . set
141
- expect ( subject . wait ) . to be_truthy
141
+ expect ( subject . wait ) . to be true
142
142
end
143
143
144
144
it 'blocks indefinitely when the timer is nil' do
145
145
subject . reset
146
146
latch = CountDownLatch . new ( 1 )
147
147
Thread . new { subject . wait . tap { latch . count_down } }
148
- expect ( latch . wait ( 0.1 ) ) . to be_falsey
148
+ expect ( latch . wait ( 0.1 ) ) . to be false
149
149
subject . set
150
- expect ( latch . wait ( 0.1 ) ) . to be_truthy
150
+ expect ( latch . wait ( 0.1 ) ) . to be true
151
151
end
152
152
153
153
it 'stops waiting when the timer expires' do
154
154
subject . reset
155
155
latch = CountDownLatch . new ( 1 )
156
156
Thread . new { subject . wait ( 0.2 ) ; latch . count_down }
157
- expect ( latch . wait ( 0.1 ) ) . to be_falsey
158
- expect ( latch . wait ) . to be_truthy
157
+ expect ( latch . wait ( 0.1 ) ) . to be false
158
+ expect ( latch . wait ) . to be true
159
159
end
160
160
161
161
it 'returns false when the timer expires' do
162
162
subject . reset
163
- expect ( subject . wait ( 1 ) ) . to be_falsey
163
+ expect ( subject . wait ( 1 ) ) . to be false
164
164
end
165
165
166
166
it 'triggers multiple waiting threads' do
167
167
latch = CountDownLatch . new ( 5 )
168
168
subject . reset
169
169
5 . times { Thread . new { subject . wait ; latch . count_down } }
170
170
subject . set
171
- expect ( latch . wait ( 0.2 ) ) . to be_truthy
171
+ expect ( latch . wait ( 0.2 ) ) . to be true
172
172
end
173
173
174
174
it 'behaves appropriately if wait begins while #set is processing' do
@@ -177,7 +177,7 @@ module Concurrent
177
177
5 . times { Thread . new { subject . wait ( 5 ) } }
178
178
subject . set
179
179
5 . times { Thread . new { subject . wait ; latch . count_down } }
180
- expect ( latch . wait ( 0.2 ) ) . to be_truthy
180
+ expect ( latch . wait ( 0.2 ) ) . to be true
181
181
end
182
182
end
183
183
@@ -199,7 +199,7 @@ def subject.simulate_spurious_wake_up
199
199
sleep ( 0.1 )
200
200
subject . simulate_spurious_wake_up
201
201
202
- expect ( latch . wait ( 0.1 ) ) . to be_falsey
202
+ expect ( latch . wait ( 0.1 ) ) . to be false
203
203
end
204
204
205
205
it 'should resist to spurious wake ups with timeout' do
@@ -209,8 +209,8 @@ def subject.simulate_spurious_wake_up
209
209
sleep ( 0.1 )
210
210
subject . simulate_spurious_wake_up
211
211
212
- expect ( latch . wait ( 0.1 ) ) . to be_falsey
213
- expect ( latch . wait ( 1 ) ) . to be_truthy
212
+ expect ( latch . wait ( 0.1 ) ) . to be false
213
+ expect ( latch . wait ( 1 ) ) . to be true
214
214
end
215
215
end
216
216
end
0 commit comments