Skip to content

Commit c0906ef

Browse files
author
Kevin Paulisse
committed
Create fixtures and first integration test
1 parent 7c02f8a commit c0906ef

File tree

3 files changed

+111
-0
lines changed

3 files changed

+111
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"document_type": "Catalog",
3+
"data": {
4+
"tags": ["settings"],
5+
"name": "my.rspec.node",
6+
"version": "production",
7+
"environment": "production",
8+
"resources": [
9+
{
10+
"type": "Stage",
11+
"title": "main",
12+
"tags": ["stage"],
13+
"exported": false,
14+
"parameters": {
15+
"name": "main"
16+
}
17+
},
18+
{
19+
"type": "Class",
20+
"title": "Settings",
21+
"tags": ["class","settings"],
22+
"exported": false
23+
},
24+
{
25+
"type": "File",
26+
"title": "/tmp/foo",
27+
"tags": ["tag-one-new","tag-too"],
28+
"parameters": {
29+
"content": "foofoo",
30+
"owner": "root"
31+
}
32+
}
33+
],
34+
"classes": [
35+
"settings"
36+
]
37+
},
38+
"metadata": {
39+
"api_version": 1
40+
}
41+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"document_type": "Catalog",
3+
"data": {
4+
"tags": ["settings"],
5+
"name": "my.rspec.node",
6+
"version": "production",
7+
"environment": "production",
8+
"resources": [
9+
{
10+
"type": "Stage",
11+
"title": "main",
12+
"tags": ["stage"],
13+
"exported": false,
14+
"parameters": {
15+
"name": "main"
16+
}
17+
},
18+
{
19+
"type": "Class",
20+
"title": "Settings",
21+
"tags": ["class","settings"],
22+
"exported": false
23+
},
24+
{
25+
"type": "File",
26+
"title": "/tmp/foo",
27+
"tags": ["tag-one","tag-two"],
28+
"parameters": {
29+
"content": "foofoo",
30+
"owner": "root"
31+
}
32+
}
33+
],
34+
"classes": [
35+
"settings"
36+
]
37+
},
38+
"metadata": {
39+
"api_version": 1
40+
}
41+
}

spec/octocatalog-diff/integration/include_tags_spec.rb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,36 @@
44
require 'json'
55

66
describe 'include-tags integration' do
7+
let(:default_argv) do
8+
[
9+
'--from-catalog', OctocatalogDiff::Spec.fixture_path('catalogs/include-tags-old.json'),
10+
'--to-catalog', OctocatalogDiff::Spec.fixture_path('catalogs/include-tags-new.json')
11+
]
12+
end
13+
714
context 'with --include-tags specified' do
15+
let(:argv) do
16+
default_argv.concat ['--include-tags']
17+
end
18+
19+
let(:result) do
20+
OctocatalogDiff::Integration.integration(
21+
argv: argv
22+
)
23+
end
24+
25+
it 'should exit indicating success with differences' do
26+
expect(result.exitcode).to eq(2)
27+
end
28+
29+
it 'should contain representative tag differences' do
30+
diffs = result.diffs
31+
expect(diffs.size).to eq(1)
32+
expect(diffs.first.change?).to eq(true)
33+
expect(diffs.first.structure).to eq(['tags'])
34+
expect(diffs.first.old_value).to eq(['tag-one', 'tag-two'])
35+
expect(diffs.first.new_value).to eq(['tag-one-new', 'tag-too'])
36+
end
837
end
938

1039
context 'with --no-include-tags specified' do

0 commit comments

Comments
 (0)