Sha256: 48240a7efe09093c1dc79a1786099e60a4b828a6756725c5e443b1b5ac4c85f4

Contents?: true

Size: 1.64 KB

Versions: 53

Compression:

Stored size: 1.64 KB

Contents

# encoding: utf-8

require "spec_helper"

describe "A 'Hello, world'-like example with a non-empty message" do

  #
  # Environment
  #

  include EventedSpec::AMQPSpec
  default_options AMQP_OPTS
  default_timeout 5

  amqp_before do
    @channel   = AMQP::Channel.new
    @channel.on_error do |ch, close|
      raise "Channel-level error!: #{close.inspect}"
    end

    @queue    = @channel.queue("", :auto_delete => true)
    @exchange = @channel.direct("amqpgem.tests.integration.direct.exchange", :auto_delete => true)

    @queue.bind(@exchange, :routing_key => "messages.all")
  end



  it "is delivered" do
    consumer1 = AMQP::Consumer.new(@channel, @queue).consume
    consumer1.on_delivery do |metadata, payload|
      done
    end

    EventMachine.add_timer(0.5) do
      @exchange.publish("Hello!", :routing_key => "messages.all")
    end
  end
end



describe "A 'Hello, world'-like example with a blank message" do

  #
  # Environment
  #

  include EventedSpec::AMQPSpec
  default_options AMQP_OPTS
  default_timeout 5

  amqp_before do
    @channel   = AMQP::Channel.new
    @channel.on_error do |ch, close|
      raise "Channel-level error!: #{close.inspect}"
    end

    @queue    = @channel.queue("", :auto_delete => true)
    @exchange = @channel.direct("amqpgem.tests.integration.direct.exchange", :auto_delete => true)

    @queue.bind(@exchange, :routing_key => "messages.all")
  end



  it "is delivered" do
    consumer1 = AMQP::Consumer.new(@channel, @queue).consume
    consumer1.on_delivery do |metadata, payload|
      done
    end

    EventMachine.add_timer(0.5) do
      @exchange.publish("", :routing_key => "messages.all")
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

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