Sha256: 3f40674e356dfd83d095129cc872fd521445e9eb8c17065647aebbc4deb71750

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

require 'rubygems'
require 'bundler'
Bundler.setup

ENV['OTEL_TRACES_EXPORTER'] = 'none'
require 'opentelemetry/sdk'
OpenTelemetry::SDK.configure

require 'pry'
require 'freddy'
require 'logger'
require 'hamster/experimental/mutable_set'

Thread.abort_on_exception = true

RSpec.configure do |config|
  config.run_all_when_everything_filtered = true
  config.filter_run :focus
  config.order = 'random'
end

def random_destination
  SecureRandom.hex
end

def arbitrary_id
  SecureRandom.hex
end

def default_sleep
  sleep 0.05
end

def wait_for
  100.times do
    return if yield

    sleep 0.005
  end
end

def deliver(custom_destination = destination)
  freddy.deliver custom_destination, payload
  default_sleep
end

def logger
  Logger.new($stdout).tap { |l| l.level = Logger::ERROR }
end

def config
  { host: 'localhost', port: 5672, user: 'guest', pass: 'guest' }
end

def spawn_echo_responder(freddy, queue_name)
  freddy.respond_to queue_name do |payload, msg_handler|
    msg_handler.success(payload)
  end
end

class ArrayLogger
  attr_accessor :calls

  def initialize
    @calls = []
  end

  def info(*args)
    @calls << args
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
freddy-2.2.1 spec/spec_helper.rb
freddy-2.2.0 spec/spec_helper.rb
freddy-2.1.0 spec/spec_helper.rb
freddy-2.0.0 spec/spec_helper.rb