Sha256: cceef368dce938b5759b5d2aa43eb9654f3ebf9b640bd6c4f42a7bdd9ad512ea

Contents?: true

Size: 717 Bytes

Versions: 103

Compression:

Stored size: 717 Bytes

Contents

module Awspec::Generator
  module Spec
    class Eip
      include Awspec::Helper::Finder
      def select_all_addresses
        res = ec2_client.describe_addresses
        res.addresses
      end

      def generate_all
        eips = select_all_addresses
        raise 'Not Found Elastic IP addresses.' if eips.empty?
        ERB.new(eip_spec_template, nil, '-').result(binding).chomp
      end

      def eip_spec_template
        template = <<-'EOF'
<% eips.each do |eip| %>
describe eip('<%= eip.public_ip %>') do
  it { should exist }
  it { should be_associated_to('<%= eip.instance_id %>') }
  it { should belong_to_domain('<%= eip.domain %>') }
end
<% end %>
EOF
        template
      end
    end
  end
end

Version data entries

103 entries across 103 versions & 4 rubygems

Version Path
awspec-1.15.1 lib/awspec/generator/spec/eip.rb
awspec-1.15.0 lib/awspec/generator/spec/eip.rb
awspec-1.14.1 lib/awspec/generator/spec/eip.rb
awspec-1.14.0 lib/awspec/generator/spec/eip.rb
awspec-1.13.0 lib/awspec/generator/spec/eip.rb
awspec-1.12.7 lib/awspec/generator/spec/eip.rb
awspec-1.12.6 lib/awspec/generator/spec/eip.rb
awspec-1.12.5 lib/awspec/generator/spec/eip.rb
awspec-1.12.4 lib/awspec/generator/spec/eip.rb
awspec-1.12.3 lib/awspec/generator/spec/eip.rb
awspec-1.12.2 lib/awspec/generator/spec/eip.rb
awspec-1.12.1 lib/awspec/generator/spec/eip.rb
awspec-1.12.0 lib/awspec/generator/spec/eip.rb
awspec-1.11.1 lib/awspec/generator/spec/eip.rb
awspec-1.11.0 lib/awspec/generator/spec/eip.rb
awspec-1.10.0 lib/awspec/generator/spec/eip.rb
awspec-1.9.0 lib/awspec/generator/spec/eip.rb
awspec-1.8.0 lib/awspec/generator/spec/eip.rb
awspec-1.7.0 lib/awspec/generator/spec/eip.rb
awspec-1.6.1 lib/awspec/generator/spec/eip.rb