Sha256: e4a1eca970d6b33641df418ab8ab52c72ead31bf2b29ce78290d7809dd957b0f

Contents?: true

Size: 1.05 KB

Versions: 14

Compression:

Stored size: 1.05 KB

Contents

require "spec_helper"

describe "Client-defined heartbeat interval" do
  context "with value > 0" do
    let(:connection) do
      c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed", heartbeat_timeout: 4)
      c.start
      c
    end

    it "can be enabled explicitly" do
      sleep 5.0

      connection.close
    end
  end

  # issue 267
  context "with value = 0" do
    let(:connection) do
      c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed",
        heartbeat_timeout: 0, automatically_recover: false)
      c.start
      c
    end

    it "disables heartbeats" do
      sleep 1.0

      connection.close
    end
  end
end


describe "Server-defined heartbeat interval" do
  let(:connection) do
    c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed", heartbeat_timeout: :server)
    c.start
    c
  end

  it "can be enabled explicitly" do
    puts "Sleeping for 5 seconds with heartbeat interval of 4"
    sleep 5.0

    connection.close
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
bunny-2.19.0 spec/higher_level_api/integration/heartbeat_spec.rb
bunny-2.18.0 spec/higher_level_api/integration/heartbeat_spec.rb
bunny-2.17.0 spec/higher_level_api/integration/heartbeat_spec.rb
bunny-2.16.1 spec/higher_level_api/integration/heartbeat_spec.rb
bunny-2.15.0 spec/higher_level_api/integration/heartbeat_spec.rb
bunny-2.14.4 spec/higher_level_api/integration/heartbeat_spec.rb
bunny-2.14.3 spec/higher_level_api/integration/heartbeat_spec.rb
bunny-2.14.2 spec/higher_level_api/integration/heartbeat_spec.rb
bunny-2.14.1 spec/higher_level_api/integration/heartbeat_spec.rb
bunny-2.13.0 spec/higher_level_api/integration/heartbeat_spec.rb
bunny-2.12.1 spec/higher_level_api/integration/heartbeat_spec.rb
bunny-2.12.0 spec/higher_level_api/integration/heartbeat_spec.rb
bunny-2.12.0.rc1 spec/higher_level_api/integration/heartbeat_spec.rb
bunny-2.11.0 spec/higher_level_api/integration/heartbeat_spec.rb