Sha256: 798b5e86428004a282abf36538b1330bb299b23a70d7db723c632b7177a9f6d9

Contents?: true

Size: 1.39 KB

Versions: 53

Compression:

Stored size: 1.39 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe AMQP::Queue do

  #
  # Environment
  #

  include EventedSpec::AMQPSpec

  default_timeout 5



  #
  # Examples
  #

  describe "#status" do
    it "yields # of messages & consumers to the callback" do
      events  = []
      channel = AMQP::Channel.new

      queue1 = channel.queue("", :auto_delete => true)
      queue2 = channel.queue("amqpgem.tests.a.named.queue", :auto_delete => true)

      EventMachine.add_timer(1.0) do
        queue1.status do |m, c|
          events << :queue1_declare_ok
        end
        queue2.status do |m, c|
          events << :queue2_declare_ok
        end        
      end

      done(2.0) {
        events.should include(:queue1_declare_ok)
        events.should include(:queue2_declare_ok)
      }
    end


    it "yields # of messages & consumers to the callback in pseudo-synchronous code" do
      events  = []
      channel = AMQP::Channel.new

      queue1 = channel.queue("", :auto_delete => true)
      queue2 = channel.queue("amqpgem.tests.a.named.queue", :auto_delete => true)

      queue1.status do |m, c|
        events << :queue1_declare_ok
      end
      queue2.status do |m, c|
        events << :queue2_declare_ok
      end

      done(2.0) {
        queue1.name.should =~ /^amq\..+/
        events.should include(:queue1_declare_ok)
        events.should include(:queue2_declare_ok)
      }
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
amqp-1.8.0 spec/integration/queue_status_spec.rb
amqp-1.7.0 spec/integration/queue_status_spec.rb
amqp-1.6.0 spec/integration/queue_status_spec.rb
amqp-1.5.3 spec/integration/queue_status_spec.rb
amqp-1.5.2 spec/integration/queue_status_spec.rb
amqp-1.5.1 spec/integration/queue_status_spec.rb
amqp-1.5.0 spec/integration/queue_status_spec.rb
amqp-1.4.2 spec/integration/queue_status_spec.rb
amqp-1.4.1 spec/integration/queue_status_spec.rb
amqp-1.4.0 spec/integration/queue_status_spec.rb
amqp-1.3.0 spec/integration/queue_status_spec.rb
amqp-1.2.1 spec/integration/queue_status_spec.rb
amqp-1.2.0 spec/integration/queue_status_spec.rb
amqp-1.1.8 spec/integration/queue_status_spec.rb
amqp-1.1.7 spec/integration/queue_status_spec.rb
amqp-1.1.6 spec/integration/queue_status_spec.rb
amqp-1.1.5 spec/integration/queue_status_spec.rb
amqp-1.1.4 spec/integration/queue_status_spec.rb
amqp-1.1.3 spec/integration/queue_status_spec.rb
amqp-1.0.4 spec/integration/queue_status_spec.rb