Sha256: 5efe45f5cf6596b398a033a406b5d3c1de36c8eed775e7f6b08787abbd0b82f8

Contents?: true

Size: 921 Bytes

Versions: 17

Compression:

Stored size: 921 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)
  end

  chain :target do |target|
    @gateway_id = target[:gateway]
    @instance_id = target[:instance]
    @vpc_peering_connection_id = target[:vpc_peering_connection]
  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

17 entries across 17 versions & 1 rubygems

Version Path
awspec-0.27.1 lib/awspec/matcher/have_route.rb
awspec-0.27.0 lib/awspec/matcher/have_route.rb
awspec-0.26.2 lib/awspec/matcher/have_route.rb
awspec-0.26.1 lib/awspec/matcher/have_route.rb
awspec-0.26.0 lib/awspec/matcher/have_route.rb
awspec-0.25.3 lib/awspec/matcher/have_route.rb
awspec-0.25.2 lib/awspec/matcher/have_route.rb
awspec-0.25.1 lib/awspec/matcher/have_route.rb
awspec-0.25.0 lib/awspec/matcher/have_route.rb
awspec-0.24.2 lib/awspec/matcher/have_route.rb
awspec-0.24.1 lib/awspec/matcher/have_route.rb
awspec-0.24.0 lib/awspec/matcher/have_route.rb
awspec-0.23.0 lib/awspec/matcher/have_route.rb
awspec-0.22.1 lib/awspec/matcher/have_route.rb
awspec-0.22.0 lib/awspec/matcher/have_route.rb
awspec-0.21.6 lib/awspec/matcher/have_route.rb
awspec-0.21.5 lib/awspec/matcher/have_route.rb