|
25 | 25 | it 'should filter when from-catalog has string and to-catalog has array with that string' do |
26 | 26 | diff = [ |
27 | 27 | '~', |
28 | | - "File\ffoobar.json", |
29 | | - { 'parameters' => { 'notify' => 'Service[foo]' } }, |
30 | | - { 'parameters' => { 'notify' => ['Service[foo]'] } } |
| 28 | + "File\ffoobar.json\fparameters\fnotify", |
| 29 | + 'Service[foo]', |
| 30 | + ['Service[foo]'] |
31 | 31 | ] |
32 | 32 | diff_obj = OctocatalogDiff::API::V1::Diff.new(diff) |
33 | 33 | result = subject.filtered?(diff_obj) |
|
37 | 37 | it 'should filter when to-catalog has string and from-catalog has array with that string' do |
38 | 38 | diff = [ |
39 | 39 | '~', |
40 | | - "File\ffoobar.json", |
41 | | - { 'parameters' => { 'notify' => ['Service[foo]'] } }, |
42 | | - { 'parameters' => { 'notify' => 'Service[foo]' } } |
| 40 | + "File\ffoobar.json\fparameters\fnotify", |
| 41 | + ['Service[foo]'], |
| 42 | + 'Service[foo]' |
43 | 43 | ] |
44 | 44 | diff_obj = OctocatalogDiff::API::V1::Diff.new(diff) |
45 | 45 | result = subject.filtered?(diff_obj) |
|
49 | 49 | it 'should not filter when from-catalog has string and to-catalog has array with a different string' do |
50 | 50 | diff = [ |
51 | 51 | '~', |
52 | | - "File\ffoobar.json", |
53 | | - { 'parameters' => { 'notify' => 'Service[bar]' } }, |
54 | | - { 'parameters' => { 'notify' => ['Service[foo]'] } } |
| 52 | + "File\ffoobar.json\fparameters\fnotify", |
| 53 | + 'Service[bar]', |
| 54 | + ['Service[foo]'] |
55 | 55 | ] |
56 | 56 | diff_obj = OctocatalogDiff::API::V1::Diff.new(diff) |
57 | 57 | result = subject.filtered?(diff_obj) |
|
61 | 61 | it 'should not filter when to-catalog has string and from-catalog has array with a different string' do |
62 | 62 | diff = [ |
63 | 63 | '~', |
64 | | - "File\ffoobar.json", |
65 | | - { 'parameters' => { 'notify' => ['Service[foo]'] } }, |
66 | | - { 'parameters' => { 'notify' => 'Service[bar]' } } |
| 64 | + "File\ffoobar.json\fparameters\fnotify", |
| 65 | + ['Service[foo]'], |
| 66 | + 'Service[bar]' |
67 | 67 | ] |
68 | 68 | diff_obj = OctocatalogDiff::API::V1::Diff.new(diff) |
69 | 69 | result = subject.filtered?(diff_obj) |
|
73 | 73 | it 'should not filter when both of the items are arrays' do |
74 | 74 | diff = [ |
75 | 75 | '~', |
76 | | - "File\ffoobar.json", |
77 | | - { 'parameters' => { 'notify' => ['Service[bar]'] } }, |
78 | | - { 'parameters' => { 'notify' => ['Service[foo]'] } } |
| 76 | + "File\ffoobar.json\fparameters\fnotify", |
| 77 | + ['Service[foo]'], |
| 78 | + ['Service[bar]'] |
79 | 79 | ] |
80 | 80 | diff_obj = OctocatalogDiff::API::V1::Diff.new(diff) |
81 | 81 | result = subject.filtered?(diff_obj) |
|
86 | 86 | # This diff should never be produced by the program, but catch the edge case anyway. |
87 | 87 | diff = [ |
88 | 88 | '~', |
89 | | - "File\ffoobar.json", |
90 | | - { 'parameters' => { 'notify' => ['Service[foo]'] } }, |
91 | | - { 'parameters' => { 'notify' => ['Service[foo]'] } } |
| 89 | + "File\ffoobar.json\fparameters\fnotify", |
| 90 | + ['Service[foo]'], |
| 91 | + ['Service[foo]'] |
92 | 92 | ] |
93 | 93 | diff_obj = OctocatalogDiff::API::V1::Diff.new(diff) |
94 | 94 | result = subject.filtered?(diff_obj) |
|
99 | 99 | # This diff should never be produced by the program, but catch the edge case anyway. |
100 | 100 | diff = [ |
101 | 101 | '~', |
102 | | - "File\ffoobar.json", |
103 | | - { 'parameters' => { 'notify' => 'Service[foo]' } }, |
104 | | - { 'parameters' => { 'notify' => 'Service[foo]' } } |
| 102 | + "File\ffoobar.json\fparameters\fnotify", |
| 103 | + 'Service[foo]', |
| 104 | + 'Service[foo]' |
105 | 105 | ] |
106 | 106 | diff_obj = OctocatalogDiff::API::V1::Diff.new(diff) |
107 | 107 | result = subject.filtered?(diff_obj) |
|
112 | 112 | diff = [ |
113 | 113 | '~', |
114 | 114 | "File\ffoobar.json", |
115 | | - { 'parameters' => { 'notify' => 'Service[foo]' } }, |
116 | | - { 'parameters' => { 'notify' => ['Service[foo]', 'Service[bar]'] } } |
| 115 | + "File\ffoobar.json\fparameters\fnotify", |
| 116 | + 'Service[foo]', |
| 117 | + ['Service[foo]', 'Service[bar]'] |
117 | 118 | ] |
118 | 119 | diff_obj = OctocatalogDiff::API::V1::Diff.new(diff) |
119 | 120 | result = subject.filtered?(diff_obj) |
|
0 commit comments