Sha256: 2a1843064fedc42af7e5a5fac1e661916aca453d3b924140f8428689fe00511e

Contents?: true

Size: 771 Bytes

Versions: 1

Compression:

Stored size: 771 Bytes

Contents

require 'spec_helper'

class Waffle::Transports::Rabbitmq
  def initialize
  end
end

describe Waffle::Transports::Rabbitmq do
  subject{Waffle::Transports::Rabbitmq.new}

  let(:exchange){mock(:exchange)}

  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

1 entries across 1 versions & 1 rubygems

Version Path
waffle-0.4.0 spec/waffle/transports/rabbitmq_spec.rb