|
56 | 56 | expect { differ.output_diff }.to_not output(/No stack found/).to_stdout |
57 | 57 | end |
58 | 58 | end |
| 59 | + |
| 60 | + context 'tags diff' do |
| 61 | + context 'when tags are added on a new proposal' do |
| 62 | + let(:stack) do |
| 63 | + StackMaster::Stack.new( |
| 64 | + stack_name: stack_name, |
| 65 | + region: region, |
| 66 | + template_body: "{}", |
| 67 | + template_format: :json, |
| 68 | + parameters: {}, |
| 69 | + tags: {} |
| 70 | + ) |
| 71 | + end |
| 72 | + let(:proposed_stack) do |
| 73 | + StackMaster::Stack.new( |
| 74 | + stack_name: stack_name, |
| 75 | + region: region, |
| 76 | + template_body: "{}", |
| 77 | + template_format: :json, |
| 78 | + parameters: {}, |
| 79 | + tags: { 'Application' => 'myapp', 'Environment' => 'staging' } |
| 80 | + ) |
| 81 | + end |
| 82 | + |
| 83 | + it 'prints a tags diff header and one-line additions for each tag' do |
| 84 | + expect { differ.output_diff }.to output(/Tags diff:/).to_stdout |
| 85 | + expect { differ.output_diff }.to output(/\+Application: myapp/).to_stdout |
| 86 | + expect { differ.output_diff }.to output(/\+Environment: staging/).to_stdout |
| 87 | + end |
| 88 | + end |
| 89 | + |
| 90 | + context 'when tags are unchanged and empty' do |
| 91 | + let(:stack) do |
| 92 | + StackMaster::Stack.new( |
| 93 | + stack_name: stack_name, |
| 94 | + region: region, |
| 95 | + template_body: "{}", |
| 96 | + template_format: :json, |
| 97 | + parameters: {}, |
| 98 | + tags: {} |
| 99 | + ) |
| 100 | + end |
| 101 | + let(:proposed_stack) do |
| 102 | + StackMaster::Stack.new( |
| 103 | + stack_name: stack_name, |
| 104 | + region: region, |
| 105 | + template_body: "{}", |
| 106 | + template_format: :json, |
| 107 | + parameters: {}, |
| 108 | + tags: {} |
| 109 | + ) |
| 110 | + end |
| 111 | + |
| 112 | + it 'prints Tags diff: No changes' do |
| 113 | + expect { differ.output_diff }.to output(/Tags diff: No changes/).to_stdout |
| 114 | + end |
| 115 | + end |
| 116 | + |
| 117 | + context 'when tags are modified with additions and removals' do |
| 118 | + let(:stack) do |
| 119 | + StackMaster::Stack.new( |
| 120 | + stack_name: stack_name, |
| 121 | + region: region, |
| 122 | + template_body: "{}", |
| 123 | + template_format: :json, |
| 124 | + parameters: {}, |
| 125 | + tags: { 'Application' => 'old', 'Environment' => 'staging' } |
| 126 | + ) |
| 127 | + end |
| 128 | + let(:proposed_stack) do |
| 129 | + StackMaster::Stack.new( |
| 130 | + stack_name: stack_name, |
| 131 | + region: region, |
| 132 | + template_body: "{}", |
| 133 | + template_format: :json, |
| 134 | + parameters: {}, |
| 135 | + tags: { 'Application' => 'new', 'Owner' => 'team' } |
| 136 | + ) |
| 137 | + end |
| 138 | + |
| 139 | + it 'prints +/- lines for changed/added/removed tags, one per line' do |
| 140 | + expect { differ.output_diff }.to output(/-Application: old/).to_stdout |
| 141 | + expect { differ.output_diff }.to output(/\+Application: new/).to_stdout |
| 142 | + expect { differ.output_diff }.to output(/-Environment: staging/).to_stdout |
| 143 | + expect { differ.output_diff }.to output(/\+Owner: team/).to_stdout |
| 144 | + end |
| 145 | + end |
| 146 | + end |
59 | 147 | end |
60 | 148 |
|
61 | 149 | describe '#single_param_update?' do |
|
0 commit comments