Sha256: 7631c649ef58b9edf62b3e463c7ebf5b3fb054d82384582c4bdfbae4d99eff66

Contents?: true

Size: 662 Bytes

Versions: 5

Compression:

Stored size: 662 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
  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

5 entries across 5 versions & 1 rubygems

Version Path
msgr-0.9.0 spec/msgr/msgr_spec.rb
msgr-0.8.0 spec/msgr/msgr_spec.rb
msgr-0.7.0 spec/msgr/msgr_spec.rb
msgr-0.6.0 spec/msgr/msgr_spec.rb
msgr-0.5.0 spec/msgr/msgr_spec.rb