simple_approvals-chefspec 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f09a4f70a83e0c647f63ec39b38ccdf7382271dc532eab8a41b93668d86efc0a
4
- data.tar.gz: b692894f7d4abe9c4500e58dfa641d0b89a5aaab1804ee714d2900b219718ecc
3
+ metadata.gz: 7ef40fd0cffc3cb25f8ef0875753e6d12d4e08d080e3a25a6d61751cb99e0ff0
4
+ data.tar.gz: 8c7f4ce94242618aedb7be1b695fd54979f8f872c6bbf02e9e935e47a2f6a4fe
5
5
  SHA512:
6
- metadata.gz: 8cdac16c42c407e1334ecae4d0e6209470807ddc7d2497cbad0d35a9cc238c19435125d15fd8b082ad624f324a286808a8d871d7fce32d8173805b6af1592858
7
- data.tar.gz: 53b5c31907d0b1f2f6a81941aa96100e01cb49680cf2993e7e526bc33de7474c754c7e863f300209eae7fd2b26629d7f88bd19d918d0490257212407fac2a270
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 ruby implementation of the ApprovalTests pattern
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`
@@ -1,6 +1,6 @@
1
1
  require 'rspec'
2
2
  require 'chefspec'
3
- require 'simple_approvals'
3
+ require 'simple_approvals/rspec'
4
4
 
5
5
  module RSpec
6
6
  module Core
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_approvals-chefspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Alpert