envato / cloudformation_rspec

Test your CloudFormation templates
MIT License
10 stars 0 forks source link

Example doesn't seem to work #8

Closed eamonnfaherty closed 5 years ago

eamonnfaherty commented 5 years ago

I am trying a simple test and I appear to be getting a syntax error.

My code is hosted here: https://github.com/eamonnfaherty/cloudformation_rpec_trial

I am trying to run your example by running rspec and I am getting error:

SyntaxError:
  /specs/vpc_spec.rb:4: syntax error, unexpected ':', expecting '}'
      template_body: template_json,
                    ^

I have added a dockerfile in my example so you can see what I am doing in a clean env.

Do you have any idea where I am going wrong?

patrobinson commented 5 years ago

@eamonnfaherty can you confirm you are running Ruby 1.9 or above? Ruby introduced the template_body: template_json syntax then, otherwise you'll have to use the old syntax of :template_body => template_json

eamonnfaherty commented 5 years ago

thanks for the response. I am using ruby:2.3.1

patrobinson commented 5 years ago

Ah right sorry the example README is wrong. Lines 5-10 should be:

let(:stack) {{
    template_body: template_json,
    parameters: {
      "VpcCidr" => cidr,
    }
  }}

I'll update the README

eamonnfaherty commented 5 years ago

Thanks for fixing this!