Skip to content

Commit 34e3db4

Browse files
jonathanhefnerioquatix
authored andcommitted
Clean up tests
This prevents a hang in the case of a regression, and reduces the test suite running time by 1 second.
1 parent 3cee333 commit 34e3db4

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

spec/notifier_spec.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,18 @@
9494
@notifier.stop
9595

9696
dir.join("three.txt").write("hello world")
97-
barriers.shift.wait(1)
98-
99-
dir.join("four.txt").write("hello world")
100-
run_thread.join
97+
run_thread.join(1) or raise "timeout"
10198

10299
expect(events.map(&:name)).to match_array(%w(one.txt two.txt))
103100
end
104101

105102
it "can be stopped from within a callback" do
106-
barriers = Array.new(3) { Concurrent::Event.new }
107-
barrier_queue = barriers.dup
108-
events = recording(dir, :create) { @notifier.stop }
103+
recording(dir, :create) { @notifier.stop }
109104

110105
run_thread = Thread.new { @notifier.run }
106+
111107
dir.join("one.txt").write("hello world")
112-
run_thread.join
108+
run_thread.join(1) or raise "timeout"
113109
end
114110
end
115111

0 commit comments

Comments
 (0)