{"id":18510774,"url":"https://github.com/envato/cloudformation_rspec","last_synced_at":"2025-04-09T04:33:23.320Z","repository":{"id":62555810,"uuid":"130169189","full_name":"envato/cloudformation_rspec","owner":"envato","description":"Test your CloudFormation templates","archived":false,"fork":false,"pushed_at":"2020-04-02T01:04:30.000Z","size":62,"stargazers_count":10,"open_issues_count":1,"forks_count":0,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-04-24T19:33:44.471Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/envato.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-19T06:30:50.000Z","updated_at":"2021-04-26T09:22:55.000Z","dependencies_parsed_at":"2022-11-03T05:31:20.292Z","dependency_job_id":null,"html_url":"https://github.com/envato/cloudformation_rspec","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envato%2Fcloudformation_rspec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envato%2Fcloudformation_rspec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envato%2Fcloudformation_rspec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envato%2Fcloudformation_rspec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/envato","download_url":"https://codeload.github.com/envato/cloudformation_rspec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247980833,"owners_count":21027803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T15:25:03.298Z","updated_at":"2025-04-09T04:33:22.860Z","avatar_url":"https://github.com/envato.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CloudFormation RSpec\n\nCloudFormation provides a black-box orchestration model; you feed templates in and infrastructure pops out the other end. This is good in that we design our templates without having to understand how the sausage gets made, but we want a way to test, quickly, what it's actually doing is what we expect.\n\nCloudFormation RSpec enables us to use RSpec matchers test your templates against the actual CloudFormation APIs without creating actual infrastructure. This is a tradeoff to get faster feedback (typically in under 2 minutes) without waiting for CloudFormation stacks to build and is designed to complement but not replace Acceptance Testing.\n\n## Usage\n\n### Testing template Change Set with Parameters\n\n```ruby\ndescribe 'vpc_template' do\n  let(:template_json) { File.read('fixtures/vpc.json') }\n  let(:stack) {{\n    template_body: template_json,\n    parameters: {\n      \"VpcCidr\" =\u003e cidr,\n    }\n  }}\n\n  it 'is valid' do\n    expect(template_json).to be_valid\n  end\n\n  context 'with a valid cidr' do\n    let(:cidr) { \"10.0.0.0/16\" }\n\n    it 'creates a vpc' do\n      expect(stack).to contain_in_change_set(\"AWS::EC2::VPC\", \"vpc\")\n    end\n  end\n\n  context 'with invalid cidr' do\n    let(:cidr) { \"1.1.1.0/16\" }\n\n    it 'fails to create a change set' do\n      expect(stack).to have_change_set_failed\n    end\n  end\nend\n```\n\n### Testing SparkleFormation templates\n\n```ruby\ndescribe 'vpc_template' do\n  let(:stack) {\n    compiler: :sparkleformation,\n    template_file: \"templates/vpc.rb\",\n    compile_state: {public_subnets: [\"10.0.0.0/24\", \"10.0.1.0/24\"], private_subnets: [\"10.0.2.0/24\", \"10.0.3.0/24\"]},\n    parameters: {\n      \"VpcCidr\" =\u003e cidr,\n    }\n  }\n\n  it 'is valid' do\n    expect(stack).to be_valid_sparkleformation\n  end\n\n  context 'with a valid cidr' do\n    let(:cidr) { \"10.0.0.0/16\" }\n\n    it 'creates a vpc' do\n      expect(stack).to contain_in_change_set(\"AWS::EC2::VPC\", \"vpc\")\n    end\n  end\n\n  context 'with invalid cidr' do\n    let(:cidr) { \"1.1.1.0/16\" }\n\n    it 'fails to create a change set' do\n      expect(stack).to have_change_set_failed\n    end\n  end\nend\n```\n\n## Development Status\n\nIn production use\n\n## Maintainers\n\nPatrick Robinson (@patrobinson)\n\n## Limitations\n\nCurrently we don't support templates larger than 51,200 bytes, as this requires uploading the template to S3 first.\n\n## Contributing\n\nFor bug fixes, documentation changes, and small features:  \n1. Fork it ( https://github.com/envato/cloudformation_rspec/fork )  \n2. Create your feature branch (`git checkout -b my-new-feature`)  \n3. Commit your changes (`git commit -am 'Add some feature'`)  \n4. Push to the branch (`git push origin my-new-feature`)  \n5. Create a new Pull Request  \n\nFor larger new features: Do everything as above, but first also make contact with the project maintainers to be sure your change fits with the project direction and you won't be wasting effort going in the wrong direction\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenvato%2Fcloudformation_rspec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenvato%2Fcloudformation_rspec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenvato%2Fcloudformation_rspec/lists"}