Sha256: cf767eb72b01bf11b38035881eb3346476f6f951e6941c176b4921929f781424

Contents?: true

Size: 467 Bytes

Versions: 22

Compression:

Stored size: 467 Bytes

Contents

require 'timeout'

module CellectHelper
  def pass_until(timeout: 1, &block)
    Timeout::timeout(timeout) 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, timeout: 1, 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

22 entries across 22 versions & 2 rubygems

Version Path
cellect-client-3.0.2 spec/support/cellect_helper.rb
cellect-server-3.0.2 spec/support/cellect_helper.rb
cellect-client-3.0.1 spec/support/cellect_helper.rb
cellect-server-3.0.1 spec/support/cellect_helper.rb
cellect-client-3.0.0 spec/support/cellect_helper.rb
cellect-server-3.0.0 spec/support/cellect_helper.rb
cellect-client-2.1.1 spec/support/cellect_helper.rb
cellect-server-2.1.1 spec/support/cellect_helper.rb
cellect-client-2.1.0 spec/support/cellect_helper.rb
cellect-server-2.1.0 spec/support/cellect_helper.rb
cellect-client-2.0.1 spec/support/cellect_helper.rb
cellect-server-2.0.1 spec/support/cellect_helper.rb
cellect-client-2.0.0 spec/support/cellect_helper.rb
cellect-server-2.0.0 spec/support/cellect_helper.rb
cellect-client-2.0.0.beta4 spec/support/cellect_helper.rb
cellect-server-2.0.0.beta4 spec/support/cellect_helper.rb
cellect-client-2.0.0.beta3 spec/support/cellect_helper.rb
cellect-server-2.0.0.beta3 spec/support/cellect_helper.rb
cellect-client-2.0.0.beta2 spec/support/cellect_helper.rb
cellect-server-2.0.0.beta2 spec/support/cellect_helper.rb