Sha256: a388b725ec875cd0d76a1c1a6f4d5522144a97f159c1517651433335d98bf0ee

Contents?: true

Size: 1.01 KB

Versions: 12

Compression:

Stored size: 1.01 KB

Contents

require "spec_helper"

describe Bunny::Queue, "#pop" do
  let(:connection) do
    c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed",
                  :automatically_recover => false)
    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

12 entries across 12 versions & 1 rubygems

Version Path
bunny-0.9.8 spec/higher_level_api/integration/basic_get_spec.rb
bunny-1.0.0.pre2 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.7 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.6 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.5 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.4 spec/higher_level_api/integration/basic_get_spec.rb
bunny-1.0.0.pre1 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.3 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.2 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.1 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.0 spec/higher_level_api/integration/basic_get_spec.rb
bunny-0.9.0.rc2 spec/higher_level_api/integration/basic_get_spec.rb