Sha256: 69f962e4d3161b3bab74b1d75e52d0cfb5819070117d26eca7f4aa28cf1e669b

Contents?: true

Size: 996 Bytes

Versions: 33

Compression:

Stored size: 996 Bytes

Contents

# encoding: utf-8

require "spec_helper"


describe "Message published as mandatory" do

  #
  # Environment
  #

  include EventedSpec::AMQPSpec
  include EventedSpec::SpecHelper

  em_before { AMQP.cleanup_state }
  em_after  { AMQP.cleanup_state }

  default_options AMQP_OPTS
  default_timeout 3

  amqp_before do
    @channel   = AMQP::Channel.new
    @channel.should be_open

    @exchange = @channel.fanout("amqpgem.specs.#{Time.now.to_i}", :auto_delete => true, :durable => false)
  end

  after(:all) do
    AMQP.cleanup_state
    done
  end


  context "that cannot be routed to any queue" do
    it "is returned to the publisher via basic.return" do
      returned_messages  = []

      @exchange.on_return do |basic_return, header, body|
        returned_messages << basic_return.reply_text
      end
      (1..10).to_a.each { |m| @exchange.publish(m, :mandatory => true) }

      done(1.0) {
        returned_messages.should == Array.new(10) { "NO_ROUTE" }
      }
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

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