Sha256: 52eaa87e69930d93cddc4fcd34c22e94514299fc4844885c37d52380e227a684

Contents?: true

Size: 1.52 KB

Versions: 50

Compression:

Stored size: 1.52 KB

Contents

module Awspec::Generator
  module Spec
    class Acm
      include Awspec::Helper::Finder
      def generate_all
        certificates = select_all_certificates
        raise 'Not Found Certificates' if certificates.empty?
        ERB.new(acm_spec_template, nil, '-').result(binding).chomp
      end

      def acm_spec_template
        template = <<-'EOF'
<% certificates.each do |certificate| %>
describe acm('<%= certificate.domain_name %>') do
  it { should exist }
<%- if certificate.status == 'ISSUED' -%>
  it { should be_issued }
<% end -%>
  it { should have_domain_name('<%= certificate.domain_name %>') }
  its(:certificate_arn) { should eq '<%= certificate.certificate_arn %>' }
  its(:type) { should eq '<%= certificate.type %>' }
<%- certificate.domain_validation_options.each do |domain_validation_option| -%>
<%- unless domain_validation_option.validation_status.nil? -%>
  it do
    should have_domain_validation_option(domain_name: '<%= domain_validation_option.domain_name %>',
                                         validation_method: '<%= domain_validation_option.validation_method%>',
                                         validation_status: '<%= domain_validation_option.validation_status %>')
  end
<%- else -%>
  it do
    should have_domain_validation_option(domain_name: '<%= domain_validation_option.domain_name %>',
                                         validation_method: '<%= domain_validation_option.validation_method%>')
  end
<%- end -%>
<%- end -%>
end
<% end %>
EOF
        template
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 3 rubygems

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