Skip to content

Commit 837a74a

Browse files
committed
Update for consistent data structures
1 parent d67bb0b commit 837a74a

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

spec/octocatalog-diff/tests/catalog-diff/filter/single_item_array_spec.rb

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
it 'should filter when from-catalog has string and to-catalog has array with that string' do
2626
diff = [
2727
'~',
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]']
3131
]
3232
diff_obj = OctocatalogDiff::API::V1::Diff.new(diff)
3333
result = subject.filtered?(diff_obj)
@@ -37,9 +37,9 @@
3737
it 'should filter when to-catalog has string and from-catalog has array with that string' do
3838
diff = [
3939
'~',
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]'
4343
]
4444
diff_obj = OctocatalogDiff::API::V1::Diff.new(diff)
4545
result = subject.filtered?(diff_obj)
@@ -49,9 +49,9 @@
4949
it 'should not filter when from-catalog has string and to-catalog has array with a different string' do
5050
diff = [
5151
'~',
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]']
5555
]
5656
diff_obj = OctocatalogDiff::API::V1::Diff.new(diff)
5757
result = subject.filtered?(diff_obj)
@@ -61,9 +61,9 @@
6161
it 'should not filter when to-catalog has string and from-catalog has array with a different string' do
6262
diff = [
6363
'~',
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]'
6767
]
6868
diff_obj = OctocatalogDiff::API::V1::Diff.new(diff)
6969
result = subject.filtered?(diff_obj)
@@ -73,9 +73,9 @@
7373
it 'should not filter when both of the items are arrays' do
7474
diff = [
7575
'~',
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]']
7979
]
8080
diff_obj = OctocatalogDiff::API::V1::Diff.new(diff)
8181
result = subject.filtered?(diff_obj)
@@ -86,9 +86,9 @@
8686
# This diff should never be produced by the program, but catch the edge case anyway.
8787
diff = [
8888
'~',
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]']
9292
]
9393
diff_obj = OctocatalogDiff::API::V1::Diff.new(diff)
9494
result = subject.filtered?(diff_obj)
@@ -99,9 +99,9 @@
9999
# This diff should never be produced by the program, but catch the edge case anyway.
100100
diff = [
101101
'~',
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]'
105105
]
106106
diff_obj = OctocatalogDiff::API::V1::Diff.new(diff)
107107
result = subject.filtered?(diff_obj)
@@ -112,8 +112,9 @@
112112
diff = [
113113
'~',
114114
"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]']
117118
]
118119
diff_obj = OctocatalogDiff::API::V1::Diff.new(diff)
119120
result = subject.filtered?(diff_obj)

0 commit comments

Comments
 (0)