Sha256: ee7bac953a3ce73fcb6b3c6b770c8968d582aaeb2c372eb9672e4a8fa629e141

Contents?: true

Size: 1.06 KB

Versions: 15

Compression:

Stored size: 1.06 KB

Contents

require "spec_helper"

describe Bunny::Queue, "bound to an exchange" 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
  end


  it "can be unbound from an exchange it was bound to" do
    ch = connection.create_channel
    x  = ch.fanout("amq.fanout")
    q  = ch.queue("", :exclusive => true).bind(x)

    x.publish("")
    sleep 0.3
    q.message_count.should == 1

    q.unbind(x)

    x.publish("")
    q.message_count.should == 1
  end
end



describe Bunny::Queue, "NOT bound to an exchange" 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
  end


  it "cannot be unbound (raises a channel error)" do
    ch = connection.create_channel
    x  = ch.fanout("amq.fanout")
    q  = ch.queue("", :exclusive => true)

    lambda {
      q.unbind(x)
    }.should raise_error(Bunny::NotFound, /no binding/)
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

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