Sha256: ddbab0ab295db7ae38b36aca69e7d3200ed4975ba0728dcefcc36055f5249cf0

Contents?: true

Size: 461 Bytes

Versions: 5

Compression:

Stored size: 461 Bytes

Contents

RSpec::Matchers.define :be_reachable  do
  match do |host|
    proto   = 'tcp'
    timeout = 5
    if @attr
      port    = @attr[:port]
      proto   = @attr[:proto]   if @attr[:proto]
      timeout = @attr[:timeout] if @attr[:timeout]
    end

    if host.respond_to?(:reachable?)
      host.reachable?(port, proto, timeout)
    else
      backend.check_reachable(host, port, proto, timeout)
    end
  end

  chain :with do |attr|
    @attr = attr
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
serverspec-0.5.8 lib/serverspec/matchers/be_reachable.rb
serverspec-0.5.7 lib/serverspec/matchers/be_reachable.rb
serverspec-0.5.6 lib/serverspec/matchers/be_reachable.rb
serverspec-0.5.5 lib/serverspec/matchers/be_reachable.rb
serverspec-0.5.4 lib/serverspec/matchers/be_reachable.rb