spec/build/files/monitor_spec.rb in build-files-0.3.2 vs spec/build/files/monitor_spec.rb in build-files-0.3.3
- old
+ new
@@ -49,26 +49,30 @@
monitor.track_changes(directory) do |state|
changed = state.added.include? path
end
+ touched = false
+
thread = Thread.new do
- sleep 1.0
+ sleep 0.1
path.touch
+
+ touched = true
end
triggered = 0
monitor.run do
triggered += 1
- throw :interrupt
+ throw :interrupt if touched
end
thread.join
expect(changed).to be true
- expect(triggered).to be == 1
+ expect(triggered).to be >= 1
end
end
end