|
45 | 45 | )
|
46 | 46 | end
|
47 | 47 | end
|
| 48 | + |
| 49 | + context 'with single-item array filter engaged' do |
| 50 | + before(:all) do |
| 51 | + @result = OctocatalogDiff::Integration.integration( |
| 52 | + spec_catalog_old: 'filter-single-item-array-1.json', |
| 53 | + spec_catalog_new: 'filter-single-item-array-2.json', |
| 54 | + argv: ['--filters', 'SingleItemArray'] |
| 55 | + ) |
| 56 | + @diffs = OctocatalogDiff::Spec.remove_file_and_line(@result[:diffs]) |
| 57 | + end |
| 58 | + |
| 59 | + it 'should succeed' do |
| 60 | + expect(@result[:exitcode]).not_to eq(-1), "Internal error: #{@result[:exception]}\n#{@result[:logs]}" |
| 61 | + expect(@result[:exitcode]).to eq(2), "Runtime error: #{@result[:logs]}" |
| 62 | + end |
| 63 | + |
| 64 | + it 'should contain the correct number of diffs' do |
| 65 | + expect(@diffs.size).to eq(3), @diffs.inspect |
| 66 | + end |
| 67 | + |
| 68 | + it 'should suppress a diff of a string to a single-item array' do |
| 69 | + expect(@diffs).not_to include( |
| 70 | + ['~', "File\f/tmp/amazing\fparameters\fnotify", 'Service[foo]', ['Service[foo]']] |
| 71 | + ) |
| 72 | + end |
| 73 | + |
| 74 | + it 'should contain a diff of an array whose size has changed' do |
| 75 | + expect(@diffs).to include( |
| 76 | + ['~', "File\f/tmp/foobar\fparameters\fnotify", 'Service[foobar]', ['Service[fizzbuzz]', 'Service[foobar]']] |
| 77 | + ) |
| 78 | + end |
| 79 | + |
| 80 | + it 'should contain a diff of an array whose elements have changed' do |
| 81 | + expect(@diffs).to include( |
| 82 | + ['!', "File\f/tmp/awesome\fparameters\fnotify", ['Service[bar]', 'Service[foo]'], ['Service[baz]', 'Service[foo]']] |
| 83 | + ) |
| 84 | + end |
| 85 | + |
| 86 | + it 'should contain a diff of an array that has been added' do |
| 87 | + expect(@diffs).to include( |
| 88 | + ['!', "File\f/tmp/fizzbuzz\fparameters\fnotify", nil, ['Service[fizzbuzz]']] |
| 89 | + ) |
| 90 | + end |
| 91 | + end |
48 | 92 | end
|
0 commit comments