Sha256: 8f088f2f98e158b79e09ba2828de7d0aed2b6670bc4d2731aa9c09a0ec63c503

Contents?: true

Size: 863 Bytes

Versions: 3

Compression:

Stored size: 863 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe RabbitmqClient::ExchangeRegistry do
  let(:registry) { described_class.new }

  let(:exchange_name) { 'tmp_exchange' }
  let(:exchange_type) { 'test' }
  let(:exchange_opt) { { opt: false } }

  it 'initialize with emprty registry' do
    expect(registry.instance_variable_get(:@exchanges)).to be_empty
  end

  it 'add and find exchanges' do
    expect do
      registry.add(exchange_name, exchange_type, exchange_opt)
    end.not_to raise_error

    exchange = registry.find(exchange_name)
    expect(exchange.name).to eq exchange_name
    expect(exchange.type).to eq exchange_type
    expect(exchange.options).to eq exchange_opt
  end

  it 'raise error for unknown exchanges' do
    expect do
      registry.find(exchange_name)
    end.to raise_error(described_class::ExchangeNotFound)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rabbitmq_client-0.0.3 spec/exchange_registry_spec.rb
rabbitmq_client-0.0.2 spec/exchange_registry_spec.rb
rabbitmq_client-0.0.1 spec/exchange_registry_spec.rb