chef-vault-testfixtures 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +5 -0
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/chef-vault-testfixtures.gemspec +6 -6
- data/lib/chef-vault/test_fixtures.rb +8 -11
- data/spec/lib/chef-vault/test_fixtures_spec.rb +8 -11
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04ea0fe25bfe84593f513f0eeb1895700cfddebb
|
4
|
+
data.tar.gz: a8c1060a2aa4972194aee6211eaee8741e826290
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26758f55992b2a69fafce02ece3e0a8c5fd96ec679ee892807d78063361ac8a740e01176e8ab1746ccc26d1e4bd571d799d899873e73eefb1a2f56c5f7268456
|
7
|
+
data.tar.gz: 3c83e862177247beb5627095792d5c71102e6b02cb269bae2092d152a23efc1d9cb861803e3ec0e365bf4a1364c78012521861992036adce5535c2460865250c
|
data/History.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog for chef-vault-testfixtures
|
2
2
|
|
3
|
+
## 0.1.3
|
4
|
+
|
5
|
+
* change chef runtime dependency from >= 11.14 to >= 11.0
|
6
|
+
* clean up some test ordering problems related to not clearing the blacklist properly
|
7
|
+
|
3
8
|
## 0.1.2
|
4
9
|
|
5
10
|
* allow access to the data bag via the symbol form as well as the string form
|
data/README.md
CHANGED
@@ -13,11 +13,11 @@ dynamically stubs access to chef-vault encrypted data bags.
|
|
13
13
|
|
14
14
|
## USAGE
|
15
15
|
|
16
|
-
chef-vault is a gem to manage distribution and control of keys to
|
16
|
+
[chef-vault](https://github.com/Nordstrom/chef-vault) is a gem to manage distribution and control of keys to
|
17
17
|
decrypt Chef encrypted data bags.
|
18
18
|
|
19
19
|
When testing a cookbook that uses chef-vault, encryption is generally
|
20
|
-
out of scope, which results in a large
|
20
|
+
out of scope, which results in a large number of stubs or mocks so that you can get back fixture data without performing decryption.
|
21
21
|
|
22
22
|
This gem makes testing Chef cookbooks easier using ChefSpec by
|
23
23
|
dynamically stubbing attempts to access vault data to return invalid
|
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ begin
|
|
13
13
|
extra_deps << ['rspec', '~> 3.1']
|
14
14
|
extra_deps << ['chef-vault', '~> 2.5']
|
15
15
|
extra_deps << ['little-plugger', '~> 1.1']
|
16
|
-
extra_deps << ['chef', '>= 11.
|
16
|
+
extra_deps << ['chef', '>= 11.0']
|
17
17
|
extra_dev_deps << ['hoe', '~> 3.13']
|
18
18
|
extra_dev_deps << ['hoe-gemspec', '~> 1.0']
|
19
19
|
extra_dev_deps << ['rake', '~> 10.3']
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: chef-vault-testfixtures 0.1.
|
2
|
+
# stub: chef-vault-testfixtures 0.1.3.20150225104151 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "chef-vault-testfixtures"
|
6
|
-
s.version = "0.1.
|
6
|
+
s.version = "0.1.3.20150225104151"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["James FitzGibbon"]
|
11
|
-
s.date = "2015-02-
|
11
|
+
s.date = "2015-02-25"
|
12
12
|
s.description = "chef-vault-testfixtures provides an RSpec shared context that\ndynamically stubs access to chef-vault encrypted data bags."
|
13
13
|
s.email = ["james.i.fitzgibbon@nordstrom.com"]
|
14
14
|
s.extra_rdoc_files = ["History.md", "Manifest.txt", "README.md"]
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_runtime_dependency(%q<rspec>, ["~> 3.1"])
|
27
27
|
s.add_runtime_dependency(%q<chef-vault>, ["~> 2.5"])
|
28
28
|
s.add_runtime_dependency(%q<little-plugger>, ["~> 1.1"])
|
29
|
-
s.add_runtime_dependency(%q<chef>, [">= 11.
|
29
|
+
s.add_runtime_dependency(%q<chef>, [">= 11.0"])
|
30
30
|
s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
|
31
31
|
s.add_development_dependency(%q<hoe>, ["~> 3.13"])
|
32
32
|
s.add_development_dependency(%q<hoe-gemspec>, ["~> 1.0"])
|
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
|
|
46
46
|
s.add_dependency(%q<rspec>, ["~> 3.1"])
|
47
47
|
s.add_dependency(%q<chef-vault>, ["~> 2.5"])
|
48
48
|
s.add_dependency(%q<little-plugger>, ["~> 1.1"])
|
49
|
-
s.add_dependency(%q<chef>, [">= 11.
|
49
|
+
s.add_dependency(%q<chef>, [">= 11.0"])
|
50
50
|
s.add_dependency(%q<rdoc>, ["~> 4.0"])
|
51
51
|
s.add_dependency(%q<hoe>, ["~> 3.13"])
|
52
52
|
s.add_dependency(%q<hoe-gemspec>, ["~> 1.0"])
|
@@ -67,7 +67,7 @@ Gem::Specification.new do |s|
|
|
67
67
|
s.add_dependency(%q<rspec>, ["~> 3.1"])
|
68
68
|
s.add_dependency(%q<chef-vault>, ["~> 2.5"])
|
69
69
|
s.add_dependency(%q<little-plugger>, ["~> 1.1"])
|
70
|
-
s.add_dependency(%q<chef>, [">= 11.
|
70
|
+
s.add_dependency(%q<chef>, [">= 11.0"])
|
71
71
|
s.add_dependency(%q<rdoc>, ["~> 4.0"])
|
72
72
|
s.add_dependency(%q<hoe>, ["~> 3.13"])
|
73
73
|
s.add_dependency(%q<hoe-gemspec>, ["~> 1.0"])
|
@@ -6,7 +6,7 @@ require 'little-plugger'
|
|
6
6
|
class ChefVault
|
7
7
|
# dynamic RSpec contexts for cookbooks that use chef-vault
|
8
8
|
class TestFixtures
|
9
|
-
VERSION = '0.1.
|
9
|
+
VERSION = '0.1.3'
|
10
10
|
|
11
11
|
extend LittlePlugger path: 'chef-vault/test_fixtures',
|
12
12
|
module: ChefVault::TestFixtures
|
@@ -43,16 +43,13 @@ class ChefVault
|
|
43
43
|
end
|
44
44
|
# stub chef-vault to return the fake vault, via both symbol
|
45
45
|
# and string forms of the data bag name
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
.with(vaultname.to_s, item.to_s)
|
54
|
-
.and_return(fakevault)
|
55
|
-
)
|
46
|
+
[ vaultname, vaultname.to_s ].each do |data_bag|
|
47
|
+
allow(ChefVault::Item).to(
|
48
|
+
receive(:load)
|
49
|
+
.with(data_bag, item.to_s)
|
50
|
+
.and_return(fakevault)
|
51
|
+
)
|
52
|
+
end
|
56
53
|
end
|
57
54
|
end
|
58
55
|
|
@@ -36,6 +36,11 @@ RSpec.describe ChefVault::TestFixtures do
|
|
36
36
|
ChefVault::TestFixtures.clear_context
|
37
37
|
end
|
38
38
|
|
39
|
+
after do
|
40
|
+
ChefVault::TestFixtures.clear_plugins
|
41
|
+
ChefVault::TestFixtures.clear_context
|
42
|
+
end
|
43
|
+
|
39
44
|
describe 'Generic functionality' do
|
40
45
|
it 'should be able to load plugins' do
|
41
46
|
expect(ChefVault::TestFixtures.plugins).to be_a(Hash)
|
@@ -73,52 +78,44 @@ RSpec.describe ChefVault::TestFixtures do
|
|
73
78
|
end
|
74
79
|
|
75
80
|
describe 'Stub a Vault' do
|
76
|
-
it '
|
77
|
-
ChefVault::TestFixtures.plugins
|
81
|
+
it 'should stub the foo/bar vault item' do
|
78
82
|
baz = ChefVault::Item.load('foo', 'bar')['baz']
|
79
83
|
expect(baz).to eq(2)
|
80
84
|
end
|
81
85
|
|
82
|
-
it '
|
83
|
-
ChefVault::TestFixtures.plugins
|
86
|
+
it 'should allow access to foo/bar via a symbol instead of a string' do
|
84
87
|
baz = ChefVault::Item.load(:foo, 'bar')['baz']
|
85
88
|
expect(baz).to eq(2)
|
86
89
|
end
|
87
90
|
|
88
|
-
it '
|
89
|
-
ChefVault::TestFixtures.plugins
|
91
|
+
it 'should stub the bar/foo vault item' do
|
90
92
|
baz = ChefVault::Item.load('bar', 'foo')['baz']
|
91
93
|
expect(baz).to eq(1)
|
92
94
|
end
|
93
95
|
|
94
96
|
it 'should allow access to the aliased bar/gzonk vault item' do
|
95
|
-
ChefVault::TestFixtures.plugins
|
96
97
|
item1 = ChefVault::Item.load('bar', 'foo')
|
97
98
|
item2 = ChefVault::Item.load('bar', 'gzonk')
|
98
99
|
expect(item1['baz']).to eq(item2['baz'])
|
99
100
|
end
|
100
101
|
|
101
102
|
it 'should allow access to the aliased bar/gzonk vault item via a symbol' do
|
102
|
-
ChefVault::TestFixtures.plugins
|
103
103
|
item1 = ChefVault::Item.load(:bar, 'foo')
|
104
104
|
item2 = ChefVault::Item.load(:bar, 'gzonk')
|
105
105
|
expect(item1['baz']).to eq(item2['baz'])
|
106
106
|
end
|
107
107
|
|
108
108
|
it 'should allow and ignore an attempt to change a vault' do
|
109
|
-
ChefVault::TestFixtures.plugins
|
110
109
|
item = ChefVault::Item.load('bar', 'foo')
|
111
110
|
item['foo'] = 'foo'
|
112
111
|
end
|
113
112
|
|
114
113
|
it 'should allow and ignore an attempt to set the clients' do
|
115
|
-
ChefVault::TestFixtures.plugins
|
116
114
|
item = ChefVault::Item.load('bar', 'foo')
|
117
115
|
item.clients('*:*')
|
118
116
|
end
|
119
117
|
|
120
118
|
it 'should allow and ignore an attempt to save' do
|
121
|
-
ChefVault::TestFixtures.plugins
|
122
119
|
item = ChefVault::Item.load('bar', 'foo')
|
123
120
|
item.save
|
124
121
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-vault-testfixtures
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James FitzGibbon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '11.
|
61
|
+
version: '11.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '11.
|
68
|
+
version: '11.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rdoc
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|