Sha256: 87de6740d009ffc212d84e370fbdce1b1da557dfab95f73bada9a4630c9eb1b4

Contents?: true

Size: 1.61 KB

Versions: 31

Compression:

Stored size: 1.61 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) {
        @q1.delete
        @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

31 entries across 31 versions & 1 rubygems

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