Sha256: bfa2591330e5ca4865f180f571dc6376a06b1d1d2f66cad3512bee57938e5740

Contents?: true

Size: 822 Bytes

Versions: 6

Compression:

Stored size: 822 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe CfnDsl::ResourceDefinition do
  subject { CfnDsl::CloudFormationTemplate.new.AutoScalingGroup(:web_servers) }

  context '#addTag' do
    it 'is a pass-through method to add_tag' do
      expect(subject).to receive(:add_tag).with('role', 'web-server', true)
      subject.addTag('role', 'web-server', true)
    end
  end

  context '#add_tag' do
    it 'adds a Tag for the resource' do
      subject.add_tag('role', 'web-server', true)
      tags = subject.Property(:Tags).value
      expect(tags).to be_an(Array)
      tag = tags.pop
      expect(tag.instance_variable_get('@Key')).to eq('role')
      expect(tag.instance_variable_get('@Value')).to eq('web-server')
      expect(tag.instance_variable_get('@PropagateAtLaunch')).to eq(true)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cfndsl-0.17.5 spec/resources_spec.rb
cfndsl-0.17.4 spec/resources_spec.rb
cfndsl-0.17.3 spec/resources_spec.rb
cfndsl-0.17.2 spec/resources_spec.rb
cfndsl-0.17.1 spec/resources_spec.rb
cfndsl-0.17.0 spec/resources_spec.rb