Sha256: 15b6a1c149ccb7ce1d8c5791ad1750ccbeac80420d8e35ea631f7383e1ba48b6

Contents?: true

Size: 1.04 KB

Versions: 22

Compression:

Stored size: 1.04 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 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

22 entries across 22 versions & 1 rubygems

Version Path
bunny-0.10.2 spec/higher_level_api/integration/channel_open_spec.rb
bunny-0.10.1 spec/higher_level_api/integration/channel_open_spec.rb