Sha256: cb600564c88e15c54aae4efb1a72d4dd39ce79de5505b69b109701e8a4f8cd98

Contents?: true

Size: 675 Bytes

Versions: 4

Compression:

Stored size: 675 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 delete: true
  end

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

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

    sleep 4
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
msgr-0.11.0.rc1 spec/msgr/msgr_spec.rb
msgr-0.10.2 spec/msgr/msgr_spec.rb
msgr-0.10.1 spec/msgr/msgr_spec.rb
msgr-0.10.0 spec/msgr/msgr_spec.rb