class Awspec::Generator::Spec::Lambda

Public Instance Methods

generate_all() click to toggle source
# File lib/awspec/generator/spec/lambda.rb, line 5
def generate_all
  lambda_functions = select_all_lambda_functions
  raise 'Not Found lambda' if lambda_functions.empty?
  ERB.new(lambda_spec_template, nil, '-').result(binding).chomp
end
lambda_spec_template() click to toggle source
# File lib/awspec/generator/spec/lambda.rb, line 11
      def lambda_spec_template
        template = <<-'EOF'
<% lambda_functions.each do |function| %>
describe lambda('<%= function.function_name %>') do
  it { should exist }
  its(:description) { should eq '<%= function.description %>' }
  its(:runtime) { should eq '<%= function.runtime %>' }
  its(:handler) { should eq '<%= function.handler %>' }
  its(:code_size) { should eq <%= function.code_size %> }
  its(:timeout) { should eq <%= function.timeout %> }
  its(:memory_size) { should eq <%= function.memory_size %> }
end
<% end %>
EOF
        template
      end