Sha256: 264048fbd09ae19cb1fbbe729456c16100c696e276abc4eb9f41efc7f10f9b13

Contents?: true

Size: 1.29 KB

Versions: 30

Compression:

Stored size: 1.29 KB

Contents

require "spec_helper"

describe Bunny::Channel, "when opened" do
  let(:connection) do
    c = Bunny.new(username: "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
      expect(connection).to be_connected
      ch = connection.create_channel
      expect(ch).to be_open

      expect(ch.id).to be > 0
    end
  end

  context "with an explicitly provided id = 0" do
    it "raises ArgumentError" do
      expect(connection).to 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)
      expect(connection).to be_connected
      expect(ch).to be_open

      expect(ch.id).to eq 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)
      expect(connection).to be_connected
      expect(ch).to be_open

      expect(ch.id).to eq 767

      expect(connection.create_channel(767)).to eq ch
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
bunny-2.8.1 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.9.0 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.7.3 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.8.0 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.7.2 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.7.1 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.7.0 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.6.6 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.6.5 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.6.4 spec/higher_level_api/integration/channel_open_spec.rb