Sha256: ea5081d864b95edc83214ec66bd38ca60dcac0c5b8ce24c307a9de2c397116d9

Contents?: true

Size: 717 Bytes

Versions: 4

Compression:

Stored size: 717 Bytes

Contents

require 'spec_helper'

class TestConsumer < Msgr::Consumer
  def index
    puts "<<< #{payload}"
  end
end

describe Msgr do
  before do
    Msgr.logger = nil;
    Msgr.logger.level = Logger::Severity::DEBUG if Msgr.logger
  end

  let(:client) { Msgr::Client.new size: 1, prefix: SecureRandom.hex(32) }

  before do
    client.routes.configure do
      route '#', to: 'test#index'
    end

    client.start
  end

  after do
    client.stop timeout: 10, delete: true, wait_empty: 10
  end

  it 'should dispatch published methods to consumer' do
    expect_any_instance_of(TestConsumer).to receive(:index).within(10).seconds.and_call_original

    client.publish 'Payload', to: 'routing.key'

    sleep 10
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
msgr-0.3.0 spec/msgr/msgr_spec.rb
msgr-0.2.1 spec/msgr/msgr_spec.rb
msgr-0.2.0 spec/msgr/msgr_spec.rb
msgr-0.1.1 spec/msgr/msgr_spec.rb