Sha256: 91e53de7a338f1170ec18a7396b0f460ce3b2d11d19b40a307c05d2e5895bddb

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'
require 'integration/coolio/spec_helper'

describe "AMQ::Client::Coolio", "Basic.Return", :nojruby => true do
  include EventedSpec::SpecHelper
  default_timeout 1.0

  context "when messages are sent to a direct exchange not bound to a queue" do
    let(:messages) { (0..9).map {|i| "Message #{i}" } }

    it "should return all the messages" do
      @returned_messages = []
      coolio_amqp_connect do |client|
        channel = AMQ::Client::Channel.new(client, 1)
        channel.open do
          queue = AMQ::Client::Queue.new(client, channel).declare(false, false, false, true)

          exchange = AMQ::Client::Exchange.new(client, channel, "direct-exchange", :direct).declare.on_return do |method|
            @returned_messages << method.reply_text
          end

          messages.each do |message|
            exchange.publish(message, AMQ::Protocol::EMPTY_STRING, {}, false, true)
          end
        end

        done(0.6) { @returned_messages.size == messages.size }
      end

      @returned_messages.should == ["NO_CONSUMERS"] * messages.size
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
amq-client-0.5.0 spec/integration/coolio/basic_return_spec.rb