Sha256: 4e360ff300e0837f67a437b7846faa900f6211d264d4eab8af019762663f0bc0

Contents?: true

Size: 1.14 KB

Versions: 12

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

module Awspec::Generator
  module Spec
    class Directconnect
      include Awspec::Helper::Finder
      def generate_all
        generate_virtual_interface_all
      end

      def generate_virtual_interface_all
        virtual_interfaces = select_virtual_interfaces
        raise 'Not Found virtual_interfaces' if virtual_interfaces.empty?

        ERB.new(virtual_interface_spec_template, nil, '-').result(binding).chomp
      end

      def virtual_interface_spec_template
        <<-'EOF'
<% virtual_interfaces.each do |interface| %>
describe directconnect_virtual_interface('<%= interface.virtual_interface_name %>') do
  it { should exist }
  it { should be_<%= interface.virtual_interface_state %> }
  its(:connection_id) { should eq '<%= interface.connection_id %>' }
  its(:virtual_interface_id) { should eq '<%= interface.virtual_interface_id %>' }
  its(:amazon_address) { should eq '<%= interface.amazon_address %>' }
  its(:customer_address) { should eq '<%= interface.customer_address %>' }
  its(:virtual_gateway_id) { should eq '<%= interface.virtual_gateway_id %>' }
end
<% end %>
EOF
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
awspec-1.30.0 lib/awspec/generator/spec/directconnect.rb
awspec-1.29.3 lib/awspec/generator/spec/directconnect.rb
awspec-1.29.2 lib/awspec/generator/spec/directconnect.rb
awspec-1.29.1 lib/awspec/generator/spec/directconnect.rb
awspec-1.29.0 lib/awspec/generator/spec/directconnect.rb
awspec-1.28.2 lib/awspec/generator/spec/directconnect.rb
awspec-1.28.1 lib/awspec/generator/spec/directconnect.rb
awspec-1.28.0 lib/awspec/generator/spec/directconnect.rb
awspec-1.27.1 lib/awspec/generator/spec/directconnect.rb
awspec-1.27.0 lib/awspec/generator/spec/directconnect.rb
awspec-1.26.0 lib/awspec/generator/spec/directconnect.rb
awspec-1.25.2 lib/awspec/generator/spec/directconnect.rb