Sha256: 24d23d6af9736fab721cc23d0abc97f171aa5d0b770fdbaa1ded4798eea81142

Contents?: true

Size: 1.33 KB

Versions: 32

Compression:

Stored size: 1.33 KB

Contents

# encoding: utf-8

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

32 entries across 32 versions & 1 rubygems

Version Path
amq-client-1.0.4 spec/integration/coolio/basic_cancel_spec.rb
amq-client-1.0.3 spec/integration/coolio/basic_cancel_spec.rb
amq-client-1.1.0.pre1 spec/integration/coolio/basic_cancel_spec.rb
amq-client-1.0.2 spec/integration/coolio/basic_cancel_spec.rb
amq-client-1.0.1 spec/integration/coolio/basic_cancel_spec.rb
amq-client-1.0.0 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.9.12 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.9.11 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.9.10 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.9.9 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.9.8 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.9.7 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.9.6 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.9.5 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.9.4 spec/integration/coolio/basic_cancel_spec.rb
amq-client-1.0.0.pre2 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.9.3 spec/integration/coolio/basic_cancel_spec.rb
amq-client-1.0.0.pre1 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.9.2 spec/integration/coolio/basic_cancel_spec.rb
amq-client-0.9.1 spec/integration/coolio/basic_cancel_spec.rb