|
69 | 69 | result = subject.filtered?(diff_obj)
|
70 | 70 | expect(result).to eq(false)
|
71 | 71 | end
|
| 72 | + |
| 73 | + it 'should not filter when both of the items are arrays' do |
| 74 | + diff = [ |
| 75 | + '~', |
| 76 | + "File\ffoobar.json", |
| 77 | + { 'parameters' => { 'notify' => ['Service[bar]'] } }, |
| 78 | + { 'parameters' => { 'notify' => ['Service[foo]'] } } |
| 79 | + ] |
| 80 | + diff_obj = OctocatalogDiff::API::V1::Diff.new(diff) |
| 81 | + result = subject.filtered?(diff_obj) |
| 82 | + expect(result).to eq(false) |
| 83 | + end |
| 84 | + |
| 85 | + it 'should not filter when both of the items are arrays even if identical' do |
| 86 | + # This diff should never be produced by the program, but catch the edge case anyway. |
| 87 | + diff = [ |
| 88 | + '~', |
| 89 | + "File\ffoobar.json", |
| 90 | + { 'parameters' => { 'notify' => ['Service[foo]'] } }, |
| 91 | + { 'parameters' => { 'notify' => ['Service[foo]'] } } |
| 92 | + ] |
| 93 | + diff_obj = OctocatalogDiff::API::V1::Diff.new(diff) |
| 94 | + result = subject.filtered?(diff_obj) |
| 95 | + expect(result).to eq(false) |
| 96 | + end |
| 97 | + |
| 98 | + it 'should not filter when both of the items are strings even if identical' do |
| 99 | + # This diff should never be produced by the program, but catch the edge case anyway. |
| 100 | + diff = [ |
| 101 | + '~', |
| 102 | + "File\ffoobar.json", |
| 103 | + { 'parameters' => { 'notify' => 'Service[foo]' } }, |
| 104 | + { 'parameters' => { 'notify' => 'Service[foo]' } } |
| 105 | + ] |
| 106 | + diff_obj = OctocatalogDiff::API::V1::Diff.new(diff) |
| 107 | + result = subject.filtered?(diff_obj) |
| 108 | + expect(result).to eq(false) |
| 109 | + end |
| 110 | + |
| 111 | + it 'should not filter when one item has an array with multiple elements' do |
| 112 | + diff = [ |
| 113 | + '~', |
| 114 | + "File\ffoobar.json", |
| 115 | + { 'parameters' => { 'notify' => 'Service[foo]' } }, |
| 116 | + { 'parameters' => { 'notify' => ['Service[foo]', 'Service[bar]'] } } |
| 117 | + ] |
| 118 | + diff_obj = OctocatalogDiff::API::V1::Diff.new(diff) |
| 119 | + result = subject.filtered?(diff_obj) |
| 120 | + expect(result).to eq(false) |
| 121 | + end |
72 | 122 | end
|
73 | 123 | end
|
0 commit comments