Sha256: 59d04c8dee3f18141ccb2435a6096ea7d862aa632e7bef4e05c34d982561af7b

Contents?: true

Size: 1.26 KB

Versions: 33

Compression:

Stored size: 1.26 KB

Contents

require "spec_helper"

describe Bunny::Channel, "when opened" do
  let(:connection) do
    c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
    c.start
    c
  end

  after :each do
    connection.close
  end

  context "without explicitly provided id" do
    it "gets an allocated id and is successfully opened" do
      connection.should be_connected
      ch = connection.create_channel
      ch.should be_open

      ch.id.should be > 0
    end
  end

  context "with an explicitly provided id = 0" do
    it "raises ArgumentError" do
      connection.should be_connected
      expect {
        connection.create_channel(0)
      }.to raise_error(ArgumentError)
    end
  end


  context "with explicitly provided id" do
    it "uses that id and is successfully opened" do
      ch = connection.create_channel(767)
      connection.should be_connected
      ch.should be_open

      ch.id.should == 767
    end
  end



  context "with explicitly provided id that is already taken" do
    it "reuses the channel that is already opened" do
      ch = connection.create_channel(767)
      connection.should be_connected
      ch.should be_open

      ch.id.should == 767

      connection.create_channel(767).should == ch
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
bunny-1.7.1 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.7.0 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.6.3 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.6.2 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.6.1 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.6.0 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.5.1 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.6.0.rc2 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.6.0.rc1 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.6.0.pre1 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.5.0 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.5.0.pre2 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.5.0.pre1 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.4.1 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.4.0 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.3.1 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.3.0 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.2.2 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.2.1 spec/higher_level_api/integration/channel_open_spec.rb
bunny-1.2.0 spec/higher_level_api/integration/channel_open_spec.rb