Skip to content

Commit 37c64b5

Browse files
author
Kevin Paulisse
committed
Add remaining integration test cases
1 parent c0906ef commit 37c64b5

File tree

2 files changed

+99
-2
lines changed

2 files changed

+99
-2
lines changed

spec/octocatalog-diff/fixtures/catalogs/include-tags-new.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
{
2525
"type": "File",
2626
"title": "/tmp/foo",
27-
"tags": ["tag-one-new","tag-too"],
27+
"tags": ["tag-one-new","tag-too","ignore-tag__file"],
2828
"parameters": {
2929
"content": "foofoo",
3030
"owner": "root"

spec/octocatalog-diff/integration/include_tags_spec.rb

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,116 @@
3232
expect(diffs.first.change?).to eq(true)
3333
expect(diffs.first.structure).to eq(['tags'])
3434
expect(diffs.first.old_value).to eq(['tag-one', 'tag-two'])
35-
expect(diffs.first.new_value).to eq(['tag-one-new', 'tag-too'])
35+
expect(diffs.first.new_value).to eq(['ignore-tag__file', 'tag-one-new', 'tag-too'])
3636
end
3737
end
3838

3939
context 'with --no-include-tags specified' do
40+
let(:argv) do
41+
default_argv.concat ['--no-include-tags']
42+
end
43+
44+
let(:result) do
45+
OctocatalogDiff::Integration.integration(
46+
argv: argv
47+
)
48+
end
49+
50+
it 'should exit indicating success with no differences' do
51+
expect(result.exitcode).to eq(0)
52+
end
53+
54+
it 'should contain representative tag differences' do
55+
diffs = result.diffs
56+
expect(diffs.size).to eq(0)
57+
end
4058
end
4159

4260
context 'with --include-tags not specified' do
61+
let(:argv) do
62+
default_argv
63+
end
64+
65+
let(:result) do
66+
OctocatalogDiff::Integration.integration(
67+
argv: argv
68+
)
69+
end
70+
71+
it 'should exit indicating success with no differences' do
72+
expect(result.exitcode).to eq(0)
73+
end
74+
75+
it 'should contain representative tag differences' do
76+
diffs = result.diffs
77+
expect(diffs.size).to eq(0)
78+
end
4379
end
4480

4581
context 'with --ignore-tags and --include-tags specified' do
82+
let(:argv) do
83+
default_argv.concat ['--include-tags', '--ignore-tags', 'foo']
84+
end
85+
86+
let(:result) do
87+
OctocatalogDiff::Integration.integration(
88+
argv: argv
89+
)
90+
end
91+
92+
it 'should exit indicating success with differences' do
93+
expect(result.exitcode).to eq(2)
94+
end
95+
96+
it 'should contain representative tag differences' do
97+
diffs = result.diffs
98+
expect(diffs.size).to eq(1)
99+
expect(diffs.first.change?).to eq(true)
100+
expect(diffs.first.structure).to eq(['tags'])
101+
expect(diffs.first.old_value).to eq(['tag-one', 'tag-two'])
102+
expect(diffs.first.new_value).to eq(['ignore-tag__file', 'tag-one-new', 'tag-too'])
103+
end
46104
end
47105

48106
context 'with --ignore-tags and --no-include-tags specified' do
107+
let(:argv) do
108+
default_argv.concat ['--no-include-tags', '--ignore-tags', 'foo']
109+
end
110+
111+
let(:result) do
112+
OctocatalogDiff::Integration.integration(
113+
argv: argv
114+
)
115+
end
116+
117+
it 'should exit indicating success with no differences' do
118+
expect(result.exitcode).to eq(0)
119+
end
120+
121+
it 'should contain representative tag differences' do
122+
diffs = result.diffs
123+
expect(diffs.size).to eq(0)
124+
end
125+
end
126+
127+
context 'with matching --ignore-tags and --include-tags specified' do
128+
let(:argv) do
129+
default_argv.concat ['--include-tags', '--ignore-tags', 'ignore-tag']
130+
end
131+
132+
let(:result) do
133+
OctocatalogDiff::Integration.integration(
134+
argv: argv
135+
)
136+
end
137+
138+
it 'should exit indicating success with no differences' do
139+
expect(result.exitcode).to eq(0)
140+
end
141+
142+
it 'should contain representative tag differences' do
143+
diffs = result.diffs
144+
expect(diffs.size).to eq(0)
145+
end
49146
end
50147
end

0 commit comments

Comments
 (0)