Sha256: 2952629f28ab94ae1407364bb30789a1cf6b19cce5904cc0bc3f173b13903b36

Contents?: true

Size: 1.3 KB

Versions: 17

Compression:

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

17 entries across 17 versions & 1 rubygems

Version Path
bunny-2.6.3 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.6.2 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.6.1 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.6.0 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.5.1 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.5.0 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.4.0 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.3.1 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.3.0 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.2.2 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.2.1 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.2.0 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.1.0 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.0.1 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.0.0 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.0.0.rc2 spec/higher_level_api/integration/channel_open_spec.rb
bunny-2.0.0.rc1 spec/higher_level_api/integration/channel_open_spec.rb