Sha256: e92c1ae02359e497703a094ec9d440419abc2cb3051ef67b323a88f788ce34e4

Contents?: true

Size: 437 Bytes

Versions: 8

Compression:

Stored size: 437 Bytes

Contents

require 'timeout'

module CellectHelper
  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 }"
    raise e
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
cellect-client-1.3.3 spec/support/cellect_helper.rb
cellect-server-1.3.3 spec/support/cellect_helper.rb
cellect-client-1.3.2 spec/support/cellect_helper.rb
cellect-server-1.3.2 spec/support/cellect_helper.rb
cellect-client-1.3.1 spec/support/cellect_helper.rb
cellect-server-1.3.1 spec/support/cellect_helper.rb
cellect-client-1.3.0 spec/support/cellect_helper.rb
cellect-server-1.3.0 spec/support/cellect_helper.rb