Sha256: de67d1cde825baa8d2ac47842b4f3269717bc852818b06d6c5112cca39963ea2

Contents?: true

Size: 973 Bytes

Versions: 101

Compression:

Stored size: 973 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, @vpc_peering_connection_id, @nat_gateway_id)
  end

  chain :target do |target|
    @gateway_id = target[:gateway]
    @instance_id = target[:instance]
    @vpc_peering_connection_id = target[:vpc_peering_connection]
    @nat_gateway_id = target[:nat]
  end

  chain :destination do |dest|
    # rubocop:disable Metrics/LineLength
    puts ''
    warn 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

101 entries across 101 versions & 2 rubygems

Version Path
awspec-0.88.1 lib/awspec/matcher/have_route.rb
awspec-0.88.0 lib/awspec/matcher/have_route.rb
awspec-0.87.1 lib/awspec/matcher/have_route.rb
awspec-0.87.0 lib/awspec/matcher/have_route.rb
awspec-0.86.0 lib/awspec/matcher/have_route.rb
cmonson_2ndwatch_awspec-0.85.4 lib/awspec/matcher/have_route.rb
awspec-0.85.3 lib/awspec/matcher/have_route.rb
cmonson_2ndwatch_awspec-0.85.3 lib/awspec/matcher/have_route.rb
awspec-0.85.2 lib/awspec/matcher/have_route.rb
awspec-0.85.1 lib/awspec/matcher/have_route.rb
awspec-0.85.0 lib/awspec/matcher/have_route.rb
awspec-0.84.1 lib/awspec/matcher/have_route.rb
awspec-0.84.0 lib/awspec/matcher/have_route.rb
awspec-0.83.0 lib/awspec/matcher/have_route.rb
awspec-0.82.3 lib/awspec/matcher/have_route.rb
awspec-0.82.2 lib/awspec/matcher/have_route.rb
awspec-0.82.1 lib/awspec/matcher/have_route.rb
awspec-0.82.0 lib/awspec/matcher/have_route.rb
awspec-0.81.1 lib/awspec/matcher/have_route.rb
awspec-0.81.0 lib/awspec/matcher/have_route.rb