Sha256: 93471f48e2ed3c7623b23d49f0bb21b7dcff50355abad2a53bf72084c1d169b0

Contents?: true

Size: 1.21 KB

Versions: 32

Compression:

Stored size: 1.21 KB

Contents

# encoding: utf-8

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

describe "AMQ::Client::CoolioClient", "Basic.Ack", :nojruby => true do
  include EventedSpec::SpecHelper
  default_timeout 1

  context "sending 100 messages" do
    let(:messages) { (0..99).map {|i| "Message #{i}" } }

    it "should receive & acknowledge all the messages" do
      @received_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)
          queue.bind("amq.fanout")

          queue.consume do |_, consumer_tag|
            queue.on_delivery do |method, header, payload|
              queue.acknowledge(method.delivery_tag)
              @received_messages << payload
            end

            exchange = AMQ::Client::Exchange.new(client, channel, "amq.fanout", :fanout)
            messages.each do |message|
              exchange.publish(message)
            end
          end # consume
        end # open

        done(0.8) {
          @received_messages.should =~ messages
        }
      end # coolio_amqp_connect
    end # it
  end # context
end # describe

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
amq-client-0.9.0 spec/integration/coolio/basic_ack_spec.rb
amq-client-0.9.0.pre2 spec/integration/coolio/basic_ack_spec.rb
amq-client-0.9.0.pre1 spec/integration/coolio/basic_ack_spec.rb
amq-client-0.8.7 spec/integration/coolio/basic_ack_spec.rb
amq-client-0.8.7.pre1 spec/integration/coolio/basic_ack_spec.rb
amq-client-0.8.6 spec/integration/coolio/basic_ack_spec.rb
amq-client-0.8.5 spec/integration/coolio/basic_ack_spec.rb
amq-client-0.8.4 spec/integration/coolio/basic_ack_spec.rb
amq-client-0.8.3 spec/integration/coolio/basic_ack_spec.rb
amq-client-0.8.2 spec/integration/coolio/basic_ack_spec.rb
amq-client-0.8.1 spec/integration/coolio/basic_ack_spec.rb
amq-client-0.8.0 spec/integration/coolio/basic_ack_spec.rb