Sha256: 1dd5709fb2e11d73340776919b3b55327212887cbaa931b149a04b20b9281b15

Contents?: true

Size: 1.25 KB

Versions: 20

Compression:

Stored size: 1.25 KB

Contents

# encoding: utf-8
require 'spec_helper'


describe "When queue has no consumers" do

  #
  # Environment
  #

  include EventedSpec::AMQPSpec
  default_timeout 1.5

  amqp_before do
    @producer_channel    = AMQP::Channel.new
    @consumer_channel    = AMQP::Channel.new
  end

  # ...


  #
  # Examples
  #

  context "and message is published as :immediate" do
    it "that message is returned to the publisher" do
      exchange = @producer_channel.fanout("amq.fanout")
      queue    = @consumer_channel.queue("", :exclusive => true)

      exchange.on_return do |basic_return, metadata, payload|
        done if payload == "immediate message body"
      end

      queue.bind(exchange) do
        exchange.publish "immediate message body", :immediate => true
      end
    end
  end



  context "and message is published as non :immediate" do
    it "that message is dropped" do
      exchange = @producer_channel.fanout("amq.fanout")
      queue    = @consumer_channel.queue("", :exclusive => true)

      exchange.on_return do |basic_return, metadata, payload|
        fail "Should not happen"
      end

      queue.bind(exchange) do
        exchange.publish "non-immediate message body", :immediate => false
      end

      done(1.0)
    end
  end
end # describe

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
amqp-1.0.0.pre2 spec/integration/immediate_messages_spec.rb
amqp-0.9.7 spec/integration/immediate_messages_spec.rb
amqp-0.9.6 spec/integration/immediate_messages_spec.rb
amqp-1.0.0.pre1 spec/integration/immediate_messages_spec.rb
amqp-0.9.5 spec/integration/immediate_messages_spec.rb
amqp-0.9.4 spec/integration/immediate_messages_spec.rb
amqp-0.9.3 spec/integration/immediate_messages_spec.rb
amqp-0.9.2 spec/integration/immediate_messages_spec.rb
amqp-0.9.1 spec/integration/immediate_messages_spec.rb
amqp-0.9.0 spec/integration/immediate_messages_spec.rb
amqp-0.9.0.pre3 spec/integration/immediate_messages_spec.rb
amqp-0.9.0.pre2 spec/integration/immediate_messages_spec.rb
amqp-0.9.0.pre1 spec/integration/immediate_messages_spec.rb
amqp-0.8.4 spec/integration/immediate_messages_spec.rb
amqp-0.8.3 spec/integration/immediate_messages_spec.rb
amqp-0.8.2 spec/integration/immediate_messages_spec.rb
amqp-0.8.1 spec/integration/immediate_messages_spec.rb
amqp-0.8.0 spec/integration/immediate_messages_spec.rb
amqp-0.8.0.rc15 spec/integration/immediate_messages_spec.rb
amqp-0.8.0.rc14 spec/integration/immediate_messages_spec.rb