Sha256: baf00e657d2a954df7cbc989290d1425366278afa3ea9f3ead5c3df1fdaf951c

Contents?: true

Size: 1022 Bytes

Versions: 110

Compression:

Stored size: 1022 Bytes

Contents

module Awspec::Generator
  module Spec
    class InternetGateway
      include Awspec::Helper::Finder
      def generate_by_vpc_id(vpc_id)
        describes = %w(
        )
        vpc = find_vpc(vpc_id)
        raise 'Not Found VPC' unless vpc
        @vpc_id = vpc[:vpc_id]
        @vpc_tag_name = vpc.tag_name
        internet_gateways = select_internet_gateway_by_vpc_id(@vpc_id)
        specs = internet_gateways.map do |internet_gateway|
          internet_gateway_id = internet_gateway[:internet_gateway_id]
          content = ERB.new(internet_gateway_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
        end
        specs.join("\n")
      end

      def internet_gateway_spec_template
        template = <<-'EOF'
describe internet_gateway('<%= internet_gateway_id %>') do
  it { should exist }
<%- if @vpc_tag_name -%>
  it { should be_attached_to('<%= @vpc_tag_name %>') }
<%- else -%>
  it { should be_attached_to('<%= @vpc_id %>') }
<%- end -%>
end
EOF
        template
      end
    end
  end
end

Version data entries

110 entries across 110 versions & 4 rubygems

Version Path
awspec-1.25.1 lib/awspec/generator/spec/internet_gateway.rb
awspec-1.25.0 lib/awspec/generator/spec/internet_gateway.rb
awspec-1.24.4 lib/awspec/generator/spec/internet_gateway.rb
awspec-1.24.3 lib/awspec/generator/spec/internet_gateway.rb
awspec-1.24.2 lib/awspec/generator/spec/internet_gateway.rb
awspec-1.24.1 lib/awspec/generator/spec/internet_gateway.rb
awspec-1.24.0 lib/awspec/generator/spec/internet_gateway.rb
awspec-1.23.0 lib/awspec/generator/spec/internet_gateway.rb
awspec-1.22.1 lib/awspec/generator/spec/internet_gateway.rb
awspec-1.22.0 lib/awspec/generator/spec/internet_gateway.rb
awspec-1.21.1 lib/awspec/generator/spec/internet_gateway.rb
awspec-1.21.0 lib/awspec/generator/spec/internet_gateway.rb
awspec-1.20.0 lib/awspec/generator/spec/internet_gateway.rb
awspec-1.19.2 lib/awspec/generator/spec/internet_gateway.rb
awspec-1.19.1 lib/awspec/generator/spec/internet_gateway.rb
awspec-1.19.0 lib/awspec/generator/spec/internet_gateway.rb
cthiesfork-awspec-1.2.4 lib/awspec/generator/spec/internet_gateway.rb
awspec-api_gateway_extended-1.2.4 lib/awspec/generator/spec/internet_gateway.rb
awspec-api_gateway_extended-1.2.3 lib/awspec/generator/spec/internet_gateway.rb
awspec-1.18.6 lib/awspec/generator/spec/internet_gateway.rb