Sha256: 8576c542aeccb43fc80c7b72c024f2881a3fff4099a7a768aba858b0dcf6047e

Contents?: true

Size: 1.31 KB

Versions: 15

Compression:

Stored size: 1.31 KB

Contents

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

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

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

  it "should stop receiving messages after receiving cancel-ok" 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")
        exchange = AMQ::Client::Exchange.new(client, channel, "amq.fanout", :fanout)

        queue.consume(true) do |amq_method|
          queue.on_delivery do |method, header, payload|
            @received_messages << payload
          end

          messages.each do |message|
            exchange.publish(message)
          end
        end

        delayed(1.5) {
          @received_messages.should =~ messages
          queue.cancel do
            exchange.publish("Extra message, should not be received")
          end
        }

        done(2.5) {
          @received_messages.should =~ messages
        }
      end
    end

  end # it "should stop receiving messages after receiving cancel-ok"
end # describe AMQ::Client::CoolioClient, "Basic.Consume"

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
amq-client-0.7.0.alpha35 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.7.0.alpha34 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.7.0.alpha33 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.7.0.alpha32 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.7.0.alpha31 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.7.0.alpha30 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.7.0.alpha29 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.7.0.alpha28 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.7.0.alpha27 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.7.0.alpha26 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.7.0.alpha25 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.7.0.alpha24 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.7.0.alpha23 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.7.0.alpha22 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.7.0.alpha21 spec/integration/coolio/basic_cancel_spec.rb