Sha256: 15f364cfef35755702be4f84b891a0831dc612e353c961898a7014e4811339a9

Contents?: true

Size: 572 Bytes

Versions: 11

Compression:

Stored size: 572 Bytes

Contents

# frozen_string_literal: true
def wait_for(timeout_milliseconds = 2000)
  timeout = (timeout_milliseconds + 0.0) / 1000
  finish = Time.now + timeout

  Thread.new do
    sleep(0.001) while Time.now < finish && !yield
  end.join
end

def test_config_for_backend(backend)
  config = { backend: backend }
  case backend
  when :redis
    config[:url] = ENV['REDISURL']
  when :postgres
    config[:backend_options] = { host: ENV['PGHOST'], user: ENV['PGUSER'] || ENV['USER'], password: ENV['PGPASSWORD'], dbname: ENV['PGDATABASE'] || 'message_bus_test' }
  end
  config
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
message_bus-3.3.6 spec/helpers.rb
message_bus-3.3.5 spec/helpers.rb
message_bus-3.3.4 spec/helpers.rb
message_bus-3.3.3 spec/helpers.rb
message_bus-3.3.2 spec/helpers.rb
message_bus-3.3.1 spec/helpers.rb
message_bus-3.3.0 spec/helpers.rb
message_bus-3.2.0 spec/helpers.rb
message_bus-3.1.0 spec/helpers.rb
message_bus-3.0.0 spec/helpers.rb
message_bus-2.2.4 spec/helpers.rb