Sha256: 9bea1853b75ebfd6cd11a0ed1f825ad873de03bed5e03c6e5850db6de9b4e3a3

Contents?: true

Size: 987 Bytes

Versions: 13

Compression:

Stored size: 987 Bytes

Contents

require "spec_helper"

describe Bunny::Queue, "#pop" do
  let(:connection) do
    c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
    c.start
    c
  end

  after :all do
    connection.close if connection.open?
  end

  context "with all defaults" do
    it "fetches a messages which is automatically acknowledged" do
      ch = connection.create_channel

      q  = ch.queue("", :exclusive => true)
      x  = ch.default_exchange

      x.publish("xyzzy", :routing_key => q.name)

      sleep(0.5)
      delivery_info, properties, content = q.pop
      content.should == "xyzzy"
      q.message_count.should == 0

      ch.close
    end
  end


  context "with an empty queue" do
    it "returns an empty response" do
      ch = connection.create_channel

      q  = ch.queue("", :exclusive => true)
      q.purge

      _, _, content = q.pop
      content.should be_nil
      q.message_count.should == 0

      ch.close
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
bunny-0.9.0.pre13 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.0.pre12 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.0.pre11 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.0.pre10 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.0.pre9 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.0.pre8 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.0.pre7 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.0.pre6 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.0.pre5 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.0.pre4 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.0.pre3 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.0.pre2 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.0.pre1 spec/higher_level_api/integration/basic_get_spec.rb