Sha256: aab910d1688ae87e03e561d8aa4816f7aa28d7788ea47f937423a7896e7805c9

Contents?: true

Size: 803 Bytes

Versions: 3

Compression:

Stored size: 803 Bytes

Contents

require 'spec_helper'

#class Waffle::Transports::Rabbitmq
#end

describe Waffle::Transports::Rabbitmq do
  subject{Waffle::Transports::Rabbitmq.new(config)}

  let(:exchange){mock(:exchange)}
  let(:config){Waffle::Config::Node.new({})}

  before do
    subject.stub(:exchange => exchange)
  end

  describe '.publish' do
    before{exchange.should_receive(:publish).with('"message"', :key => 'events')}
    specify{subject.publish('events', 'message')}
  end

  describe '.subscribe' do
    let(:queue){mock(:queue, :bind => nil)}

    before do
      subject.stub(:queue => queue)
      queue.should_receive(:subscribe).and_yield({
        :payload => '{"data":"message"}',
        :delivery_details => {:routing_key => 'event'}
      })
    end

    specify{subject.subscribe('events'){}}
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
waffle-0.6.0 spec/waffle/transports/rabbitmq_spec.rb
waffle-0.5.1 spec/waffle/transports/rabbitmq_spec.rb
waffle-0.5.0 spec/waffle/transports/rabbitmq_spec.rb