Sha256: f6c3dc1628e85df39aff510b4a790e687034e92f8661dc37e4c209226cd28d94
Contents?: true
Size: 1.71 KB
Versions: 62
Compression:
Stored size: 1.71 KB
Contents
require 'spec_helper' class Convection::Model::Template describe ResourceCollection do class WebService < Convection::Model::Template::ResourceCollection attach_to_dsl(:web_service) attribute :use_elastic_load_balancing def execute web_service = self # Expose this instance to nested template methods. ec2_instance "#{name}WebService" elb "#{name}LoadBalancer" do tag 'Description', "Load balancer for the #{web_service.name} web service." end if use_elastic_load_balancing end end let(:use_elb_value) { nil } let(:template) do outer_scope = self Convection.template do description 'ResourceCollection Test Template' # A lone resource for testing merging of resources and nested resources. ec2_instance 'LoneResource1' web_service 'ExampleDotOrg' do use_elastic_load_balancing outer_scope.use_elb_value end end end subject do template_json .fetch('Resources') end context 'when the use_elastic_load_balancing attribute is set' do let(:use_elb_value) { true } it { is_expected.to have_key('LoneResource1') } it { is_expected.to have_key('ExampleDotOrgWebService') } it { is_expected.to have_key('ExampleDotOrgLoadBalancer') } end context 'when the use_elastic_load_balancing attribute is not set' do let(:use_elb_value) { false } it { is_expected.to have_key('LoneResource1') } it { is_expected.to have_key('ExampleDotOrgWebService') } it { is_expected.to_not have_key('ExampleDotOrgLoadBalancer') } end private def template_json JSON.parse(template.to_json) end end end
Version data entries
62 entries across 62 versions & 1 rubygems
Version | Path |
---|---|
convection-0.4.1 | spec/convection/model/template/resource_collection_spec.rb |
convection-0.3.3.pre.beta.1 | spec/convection/model/template/resource_collection_spec.rb |