Sha256: ed5c036cf225da9e2538c927cbd03f5162e1cc7688c8d3f9b757cc70e8b63115

Contents?: true

Size: 827 Bytes

Versions: 5

Compression:

Stored size: 827 Bytes

Contents

require 'ipaddr'

RSpec::Matchers.define :have_route do |destination|
  match do |route_table|
    if !is_ipaddr?(destination) && @use_destination # for deprecated usage
      @gateway_id = destination
    else
      @destination = destination
    end
    route_table.has_route?(@destination, @gateway_id, @instance_id)
  end

  chain :target do |target|
    @gateway_id = target[:gateway]
    @intance_id = target[:instance]
  end

  chain :destination do |dest|
    # rubocop:disable Metrics/LineLength
    puts ''
    puts Color.on_red(Color.white('!!! route_table destination is deprecated. see https://github.com/k1LoW/awspec/pull/65 !!!'))
    # rubocop:enable Metrics/LineLength
    @use_destination = true
    @destination = dest
  end

  private

  def is_ipaddr?(str)
    IPAddr.new(str)
  rescue
    false
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
awspec-0.21.4 lib/awspec/matcher/have_route.rb
awspec-0.21.3 lib/awspec/matcher/have_route.rb
awspec-0.21.2 lib/awspec/matcher/have_route.rb
awspec-0.21.1 lib/awspec/matcher/have_route.rb
awspec-0.21.0 lib/awspec/matcher/have_route.rb