Method: Awspec::Generator::Spec::Redshift#redshift_spec_template

Defined in:
lib/awspec/generator/spec/redshift.rb

#redshift_spec_templateObject

rubocop:disable all



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/awspec/generator/spec/redshift.rb', line 33

def redshift_spec_template
  template = <<-'EOF'
describe redshift('<%= cluster.cluster_identifier %>') do
  it { should exist }
  it { should be_<%= cluster.cluster_status %> }
<% describes.each do |describe| %>
<%- if cluster.members.include?(describe.to_sym) && !cluster[describe.to_sym].nil? -%>
<%- if cluster[describe].is_a?(String) -%>
  its(:<%= describe %>) { should eq '<%= cluster[describe] %>' }
<%- else -%>
  its(:<%= describe %>) { should eq <%= cluster[describe] %> }
<%- end -%>
<%- end -%>
<% end %>
<% sg_group_names.each do |sg_group_name| %>
  it { should have_security_group('<%= sg_group_name %>') }
<% end %>
<%- if @vpc_tag_name -%>
  it { should belong_to_vpc('<%= @vpc_tag_name %>') }
<%- else -%>
  it { should belong_to_vpc('<%= @vpc_id %>') }
<%- end -%>
  it { should belong_to_cluster_subnet_group('<%= cluster.cluster_subnet_group_name %>') }
<% cluster.cluster_parameter_groups.each do |pg| %>
  it { should have_cluster_parameter_group('<%= pg.parameter_group_name %>').parameter_apply_status('<%= pg.parameter_apply_status %>') }
<% end %>
<% cluster.tags.each do |tag| %>
  it { should have_tag('<%= tag.key %>').value('<%= tag.value %>') }
<% end %>
end
EOF
  template
end