simple_approvals-chefspec 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +83 -3
- data/lib/simple_approvals/chefspec/approvals.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ef40fd0cffc3cb25f8ef0875753e6d12d4e08d080e3a25a6d61751cb99e0ff0
|
4
|
+
data.tar.gz: 8c7f4ce94242618aedb7be1b695fd54979f8f872c6bbf02e9e935e47a2f6a4fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aeb24ea9fa18e9bcb317f6ea66423461ad1dfb242c23d578cbae586f5326dbdc5130075a04f2c93b40f2cd2db16e9a79a2d000be026184f5b981458d90f85034
|
7
|
+
data.tar.gz: 7e6d5860e9c66ef4fe861a43ed3ff16506aff4d0326945eb26103200a3e172ed89a09241fe4a19acb89ff32b04665a3481702ed4b2f60380f9ed5f7acc51f3d3
|
data/README.md
CHANGED
@@ -1,4 +1,84 @@
|
|
1
|
-
simple_approvals
|
2
|
-
===============
|
1
|
+
# simple_approvals/chefspec
|
3
2
|
|
4
|
-
a simple
|
3
|
+
a simple chefspec-based implementation of the ApprovalTests pattern
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
1. Update your `Gemfile` to include:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'simple_approvals-chefspec'
|
11
|
+
```
|
12
|
+
|
13
|
+
1. Update `spec_helper.rb` to include:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require 'simple_approvals/chefspec'
|
17
|
+
```
|
18
|
+
|
19
|
+
1. Add a single template approval like this:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
describe 'my-cookbook::my-recipe' do
|
23
|
+
include ChefVault::TestFixtures.rspec_shared_context
|
24
|
+
context 'When all attributes are default, on CentOS 7.4.1708' do
|
25
|
+
let(:chef_run) do
|
26
|
+
# for a complete list of available platforms and versions see:
|
27
|
+
# https://github.com/customink/fauxhai/blob/master/PLATFORMS.md
|
28
|
+
runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '7.4.1708') do |node, server|
|
29
|
+
node.override['my-cookbook']['attribute1'] = true
|
30
|
+
end
|
31
|
+
runner.converge(described_recipe)
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
it 'converges successfully' do
|
36
|
+
expect { chef_run }.to_not raise_error
|
37
|
+
end
|
38
|
+
|
39
|
+
verify_chef_template(
|
40
|
+
expected_path: '/path/to/rendered/template',
|
41
|
+
approved_path: 'local/path/to/approved/template/output' # e.g. test/fixtures/approvals/logfile.xml
|
42
|
+
)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
1. Add multiple template approvals like this:
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
describe 'my-cookbook::my-recipe' do
|
51
|
+
include ChefVault::TestFixtures.rspec_shared_context
|
52
|
+
context 'When all attributes are default, on CentOS 7.4.1708' do
|
53
|
+
let(:chef_run) do
|
54
|
+
# for a complete list of available platforms and versions see:
|
55
|
+
# https://github.com/customink/fauxhai/blob/master/PLATFORMS.md
|
56
|
+
runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '7.4.1708') do |node, server|
|
57
|
+
node.override['my-cookbook']['attribute1'] = true
|
58
|
+
end
|
59
|
+
runner.converge(described_recipe)
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
it 'converges successfully' do
|
64
|
+
expect { chef_run }.to_not raise_error
|
65
|
+
end
|
66
|
+
|
67
|
+
verify_chef_templates(
|
68
|
+
{ expected_path: '/path/to/rendered/template1',
|
69
|
+
approved_path: 'local/path/to/approved/template/output1' # e.g. test/fixtures/approvals/logfile1.xml
|
70
|
+
},
|
71
|
+
{ expected_path: '/path/to/rendered/template2',
|
72
|
+
approved_path: 'local/path/to/approved/template/output2' # e.g. test/fixtures/approvals/logfile2.xml
|
73
|
+
}
|
74
|
+
)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
```
|
78
|
+
|
79
|
+
## Development
|
80
|
+
|
81
|
+
1. make changes
|
82
|
+
2. bump `VERSION`
|
83
|
+
3. `gem build simple_approvals-chefspec.gemspec`
|
84
|
+
4. `gem push simple_approvals-chefspec-1.0.0.gem`
|