Sha256: 2a226d235a6b048e2e452a82595dc38b0ca157c62a9710e3c17220e0a8466c32

Contents?: true

Size: 1.59 KB

Versions: 8

Compression:

Stored size: 1.59 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe AMQP do

  #
  # Environment
  #

  include EventedSpec::AMQPSpec

  default_timeout 5


  #
  # Examples
  #


  context "when queue is redeclared with different attributes across two channels" do
    let(:name)              { "amqp-gem.nondurable.queue" }
    let(:options)           {
      { :durable => false, :passive => false }
    }
    let(:different_options) {
      { :durable => true, :passive => false }
    }


    it "should trigger channel-level #on_error callback" do
      @channel = AMQP::Channel.new
      @channel.on_error do |ch, close|
        puts "This should never happen"
      end
      @q1 = @channel.queue(name, options)

      # backwards compatibility, please consider against
      # using global error handlers in your programs!
      AMQP::Channel.on_error do |msg|
        puts "Global handler has fired: #{msg}"
        @global_callback_fired = true
      end

      # Small delays to ensure the order of execution
      delayed(0.1) {
        @other_channel = AMQP::Channel.new
        @other_channel.on_error do |ch, close|
          @callback_fired = true
        end
        puts "other_channel.id = #{@other_channel.id}"
        @q2 = @other_channel.queue(name, different_options)
      }

      delayed(0.3) {
        @q2.delete
      }

      done(0.4) {
        @callback_fired.should be_true
        @global_callback_fired.should be_true
        # looks like there is a difference between platforms/machines
        # so check either one. MK.
        @other_channel.closed?.should be_true
      }
    end
  end
end # describe AMQP

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
amqp-1.0.4 spec/integration/channel_level_exception_with_multiple_channels_spec.rb
amqp-1.0.3 spec/integration/channel_level_exception_with_multiple_channels_spec.rb
amqp-1.0.2 spec/integration/channel_level_exception_with_multiple_channels_spec.rb
amqp-1.0.1 spec/integration/channel_level_exception_with_multiple_channels_spec.rb
amqp-1.0.0 spec/integration/channel_level_exception_with_multiple_channels_spec.rb
amqp-0.9.10 spec/integration/channel_level_exception_with_multiple_channels_spec.rb
amqp-0.9.9 spec/integration/channel_level_exception_with_multiple_channels_spec.rb
amqp-0.9.8 spec/integration/channel_level_exception_with_multiple_channels_spec.rb