Sha256: cc4124ff0f85842f2d9d9cd89c7e9bc83581b6919d71f4dd0250d9b3dfe1d9e0

Contents?: true

Size: 1.11 KB

Versions: 112

Compression:

Stored size: 1.11 KB

Contents

module Awspec::Generator
  module Spec
    class Alb
      include Awspec::Helper::Finder
      def generate_by_vpc_id(vpc_id)
        describes = %w(
          load_balancer_name
        )
        vpc = find_vpc(vpc_id)
        raise 'Not Found VPC' unless vpc
        @vpc_id = vpc[:vpc_id]
        @vpc_tag_name = vpc.tag_name
        albs = select_alb_by_vpc_id(@vpc_id)

        specs = albs.map do |alb|
          content = ERB.new(alb_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
        end
        specs.join("\n")
      end

      def alb_spec_template
        template = <<-'EOF'
describe alb('<%= alb.load_balancer_name %>') do
  it { should exist }
  its(:load_balancer_arn) { should eq '<%= alb.load_balancer_arn %>' }
  its(:dns_name) { should eq '<%= alb.dns_name %>' }
  its(:load_balancer_name) { should eq '<%= alb.load_balancer_name %>' }
  its(:scheme) { should eq '<%= alb.scheme %>' }
  its(:vpc_id) { should eq '<%= alb.vpc_id %>' }
  its(:type) { should eq '<%= alb.type %>' }
  its(:ip_address_type) { should eq '<%= alb.ip_address_type %>' }
end
EOF
        template
      end
    end
  end
end

Version data entries

112 entries across 112 versions & 4 rubygems

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