# frozen_string_literal: true

require 'spec_helper'
Awspec::Stub.load 'transit_gateway'

describe transit_gateway('tgw-1234567890abcdefg') do
  it { should exist }
  it { should have_tag('Name').value('my-transit-gateway') }
  it { should have_attachment('tgw-attach-1234567890abcdefg') }
  its('options.amazon_side_asn') { should eq 64_516 }
  its('options.auto_accept_shared_attachments') { should eq 'enable' }
  its('options.default_route_table_association') { should eq 'enable' }
  its('options.default_route_table_propagation') { should eq 'enable' }
  its('options.dns_support') { should eq 'enable' }
  its('options.vpn_ecmp_support') { should eq 'enable' }
  its('options.association_default_route_table_id') { should eq 'tgw-rtb-0123456789abcdefg' }
  its('options.propagation_default_route_table_id') { should eq 'tgw-rtb-0123456789abcdefg' }
end

describe transit_gateway('my-transit-gateway') do
  it { should exist }
  its(:transit_gateway_id) { should eq 'tgw-1234567890abcdefg' }
end

describe transit_gateway('my-transit-gateway') do
  it { should exist }
  it 'supports `have_attachment` by attachment name' do
    should have_attachment('my-transit-gateway-attachment')
  end
end

describe transit_gateway('my-transit-gateway') do
  it { should exist }
  it 'supports `have_attachment` by attachment regular expression' do
    should have_attachment(/my-transit-gateway-attachment/)
  end
end

describe transit_gateway('my-transit-gateway') do
  it 'supports have_attachment when `should exist` hasn\'t been called first' do
    should have_attachment('tgw-attach-1234567890abcdefg')
  end
end
