Skip to content

Commit 99d9f24

Browse files
committed
Add counterexample
1 parent 1437c7c commit 99d9f24

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

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

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
expect(result).to eq(true)
3535
end
3636

37-
it 'should filter when from-catalog has string and to-catalog has array with that string' do
37+
it 'should filter when to-catalog has string and from-catalog has array with that string' do
3838
diff = [
3939
'~',
4040
"File\ffoobar.json",
@@ -45,5 +45,29 @@
4545
result = subject.filtered?(diff_obj)
4646
expect(result).to eq(true)
4747
end
48+
49+
it 'should not filter when from-catalog has string and to-catalog has array with a different string' do
50+
diff = [
51+
'~',
52+
"File\ffoobar.json",
53+
{ 'parameters' => { 'notify' => 'Service[bar]' } },
54+
{ 'parameters' => { 'notify' => ['Service[foo]'] } }
55+
]
56+
diff_obj = OctocatalogDiff::API::V1::Diff.new(diff)
57+
result = subject.filtered?(diff_obj)
58+
expect(result).to eq(false)
59+
end
60+
61+
it 'should not filter when to-catalog has string and from-catalog has array with a different string' do
62+
diff = [
63+
'~',
64+
"File\ffoobar.json",
65+
{ 'parameters' => { 'notify' => ['Service[foo]'] } },
66+
{ 'parameters' => { 'notify' => 'Service[bar]' } }
67+
]
68+
diff_obj = OctocatalogDiff::API::V1::Diff.new(diff)
69+
result = subject.filtered?(diff_obj)
70+
expect(result).to eq(false)
71+
end
4872
end
4973
end

0 commit comments

Comments
 (0)