Skip to content

Commit 10cf20b

Browse files
committed
Stop sleeping after q.stop in tests
1 parent afb9b76 commit 10cf20b

File tree

1 file changed

+12
-26
lines changed

1 file changed

+12
-26
lines changed

test/qron_test.rb

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@
4646
assert $booted, true
4747

4848
q.stop
49-
50-
sleep 1.4
51-
52-
assert q.started, nil
5349
end
5450

5551
test 'it schedules with a timezone' do
@@ -72,8 +68,6 @@
7268
assert $a.count { |e| e == 'Europe/Budapest' } > 1
7369

7470
q.stop
75-
76-
sleep 1.4
7771
end
7872

7973
group '#on_error' do
@@ -95,10 +89,6 @@
9589
assert $errors.count > 0
9690

9791
q.stop
98-
99-
sleep 1.4
100-
101-
assert q.started, nil
10292
end
10393
end
10494

@@ -122,10 +112,6 @@
122112
assert $errors.count > 0
123113

124114
q.stop
125-
126-
sleep 1.4
127-
128-
assert q.started, nil
129115
end
130116
end
131117

@@ -135,52 +121,52 @@
135121

136122
File.open('test/qrontab', 'wb') { |f|
137123
f.write(%{
138-
* * * * * * $a << 'alpha'
124+
* * * * * * $b << 'alpha'
139125
}) }
140126

141-
$a = []
127+
$b = []
142128

143129
q = Qron.new(tab: 'test/qrontab')
144130

145131
sleep 2.1
146132

147133
File.open('test/qrontab', 'wb') { |f|
148134
f.write(%{
149-
* * * * * * $a << 'bravo'
135+
* * * * * * $b << 'bravo'
150136
}) }
151137

152138
sleep 2.1
153139

154-
assert $a.count { |e| e == 'alpha' } > 1
155-
assert $a.count { |e| e == 'bravo' } < 1
140+
assert $b.count { |e| e == 'alpha' } > 1
141+
assert $b.count { |e| e == 'bravo' } < 1
156142

157-
q.stop; sleep 1.4
143+
q.stop
158144
end
159145

160146
test 'reloads if reload: true' do
161147

162148
File.open('test/qrontab', 'wb') { |f|
163149
f.write(%{
164-
* * * * * * $a << 'alpha'
150+
* * * * * * $c << 'alpha'
165151
}) }
166152

167-
$a = []
153+
$c = []
168154

169155
q = Qron.new(tab: 'test/qrontab', reload: true)
170156

171157
sleep 2.1
172158

173159
File.open('test/qrontab', 'wb') { |f|
174160
f.write(%{
175-
* * * * * * $a << 'bravo'
161+
* * * * * * $c << 'bravo'
176162
}) }
177163

178164
sleep 2.1
179165

180-
assert $a.count { |e| e == 'alpha' } > 1
181-
assert $a.count { |e| e == 'bravo' } > 1
166+
assert $c.count { |e| e == 'alpha' } > 1
167+
assert $c.count { |e| e == 'bravo' } > 1
182168

183-
q.stop; sleep 1.4
169+
q.stop
184170
end
185171
end
186172
end

0 commit comments

Comments
 (0)