spec/support/cellect_helper.rb in cellect-client-1.2.0 vs spec/support/cellect_helper.rb in cellect-client-1.3.0
- old
+ new
@@ -1,8 +1,17 @@
require 'timeout'
module CellectHelper
- def pass_until(obj, is:)
+ def pass_until(&block)
+ Timeout::timeout(1) do
+ Thread.pass until block.call
+ end
+ rescue => e
+ puts "Timeout waiting for condition #{ block.inspect }"
+ raise e
+ end
+
+ def pass_until_state_of(obj, is:)
Timeout::timeout(1) do
Thread.pass until obj.state == is
end
rescue => e
puts "Timeout waiting for #{ obj.inspect } to be #{ is }"