Sha256: d9ee5314143a88c4f6ebabb81bdd741eba562204cf8e80b5023318d81e4efcf8

Contents?: true

Size: 1.9 KB

Versions: 31

Compression:

Stored size: 1.9 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe "AMQP queue redeclaration with different attributes" do

  #
  # Environment
  #

  include EventedSpec::AMQPSpec

  default_timeout 5


  #
  # Examples
  #

  context "when :durable value is different" do
    let(:name)              { "amqp-gem.nondurable.queue" }
    let(:options)           {
      { :durable => false, :exclusive => true, :auto_delete => true, :arguments => {}, :passive => false }
    }
    let(:different_options) {
      { :durable => true, :exclusive => true, :auto_delete => true, :arguments => {}, :passive => false}
    }


    it "should raise AMQP::IncompatibleOptionsError for incompatable options" do
      channel = AMQP::Channel.new
      channel.on_error do |ch, channel_close|
        @error_code = channel_close.reply_code
      end

      channel.queue(name, options)
      expect {
        channel.queue(name, different_options)
      }.to raise_error(AMQP::IncompatibleOptionsError)

      done(0.5) {
        @error_code.should == 406
      }
    end
  end

  context "when :headers are different" do
    let(:name)              { "amqp-gem.nondurable.queue" }
    let(:options)           {
      { :durable => false, :exclusive => true, :auto_delete => true, :arguments => {}, :passive => false }
    }
    let(:different_options) {
      { :durable => false, :exclusive => true, :auto_delete => true, :arguments => {}, :passive => false, :header => {:random => 'stuff' } }
    }

    it "should not raise AMQP::IncompatibleOptionsError for irrelevant options" do
      channel = AMQP::Channel.new
      channel.on_error do |ch, channel_close|
        @error_code = channel_close.reply_code
      end

      channel.queue(name, options)
      expect {
        channel.queue(name, different_options)
      }.to_not raise_error(AMQP::IncompatibleOptionsError)

      done(0.5) {
        @error_code.should == 406
      }
    end
  end
end # describe AMQP

Version data entries

31 entries across 31 versions & 1 rubygems

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