chef-vault-testfixtures 0.1.1 → 0.1.2
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 +4 -4
- data/History.md +7 -0
- data/README.md +6 -1
- data/chef-vault-testfixtures.gemspec +4 -4
- data/lib/chef-vault/test_fixtures.rb +8 -2
- data/spec/lib/chef-vault/test_fixtures_spec.rb +13 -0
- metadata +2 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7080da29fc74e42e55d2741c15612b27a5b5483d
|
4
|
+
data.tar.gz: aa5df94b9ffd8bbfca1419d7b3343f01506a5d43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8961fa32299cd899afde5fae477d1dc4426d9bf9fc5833ae6cf5329170bad767824d60142315ea694a45db948308234a99ea7ff481a06b095424e16be523bac4
|
7
|
+
data.tar.gz: 0f457f5ff779ada7d85c62d9c695f35c85cb7914703a927560bf8527054d23ce2310d4618e66008cb29d95d322ced67985607355e87c7b601eba27d9aef4d392
|
data/History.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog for chef-vault-testfixtures
|
2
2
|
|
3
|
+
## 0.1.2
|
4
|
+
|
5
|
+
* allow access to the data bag via the symbol form as well as the string form
|
6
|
+
* re-organize the README to make the summary extracted by Hoe smaller
|
7
|
+
* add Travis-CI integration and badging
|
8
|
+
* add Code Climate integration and badging
|
9
|
+
|
3
10
|
## 0.1.1
|
4
11
|
|
5
12
|
* fix disconnect between docs and code for shared context method
|
data/README.md
CHANGED
@@ -2,12 +2,17 @@
|
|
2
2
|
|
3
3
|
* home :: https://github.com/Nordstrom/chef-vault-testfixtures
|
4
4
|
* license :: [Apache2](http://www.apache.org/licenses/LICENSE-2.0)
|
5
|
+
* gem version :: [](http://badge.fury.io/rb/chef-vault-testfixtures)
|
6
|
+
* build status :: [](https://travis-ci.org/Nordstrom/chef-vault-testfixtures)
|
7
|
+
* code climate :: [](https://codeclimate.com/github/Nordstrom/chef-vault-testfixtures)
|
5
8
|
|
6
9
|
## DESCRIPTION
|
7
10
|
|
8
11
|
chef-vault-testfixtures provides an RSpec shared context that
|
9
12
|
dynamically stubs access to chef-vault encrypted data bags.
|
10
13
|
|
14
|
+
## USAGE
|
15
|
+
|
11
16
|
chef-vault is a gem to manage distribution and control of keys to
|
12
17
|
decrypt Chef encrypted data bags.
|
13
18
|
|
@@ -32,7 +37,7 @@ Attempts to access secrets that would not be available to a node
|
|
32
37
|
during a real chef-client run will not be mocked, which will cause
|
33
38
|
the double to raise an 'unexpected message received' error.
|
34
39
|
|
35
|
-
##
|
40
|
+
## USAGE
|
36
41
|
|
37
42
|
In the file `spec/support/chef-vault/test_fixtures/foo.rb`:
|
38
43
|
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: chef-vault-testfixtures 0.1.
|
2
|
+
# stub: chef-vault-testfixtures 0.1.2.20150224090711 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.2.20150224090711"
|
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
11
|
s.date = "2015-02-24"
|
12
|
-
s.description = "chef-vault-testfixtures provides an RSpec shared context that\ndynamically stubs access to chef-vault encrypted data bags
|
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"]
|
15
15
|
s.files = [".rspec", ".rubocop.yml", ".yardopts", "Gemfile", "Guardfile", "History.md", "Manifest.txt", "README.md", "Rakefile", "chef-vault-testfixtures.gemspec", "lib/chef-vault/test_fixtures.rb", "lib/hoe/markdown.rb", "spec/lib/chef-vault/test_fixtures_spec.rb", "spec/spec_helper.rb", "spec/support/chef-vault/test_fixtures/bar.rb", "spec/support/chef-vault/test_fixtures/foo.rb"]
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.licenses = ["apache2"]
|
18
18
|
s.rdoc_options = ["--main", "README.md"]
|
19
19
|
s.rubygems_version = "2.4.4"
|
20
|
-
s.summary = "chef-vault-testfixtures provides an RSpec shared context that dynamically stubs access to chef-vault encrypted data bags"
|
20
|
+
s.summary = "chef-vault-testfixtures provides an RSpec shared context that dynamically stubs access to chef-vault encrypted data bags."
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
s.specification_version = 4
|
@@ -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.2'
|
10
10
|
|
11
11
|
extend LittlePlugger path: 'chef-vault/test_fixtures',
|
12
12
|
module: ChefVault::TestFixtures
|
@@ -41,7 +41,13 @@ class ChefVault
|
|
41
41
|
plugin.send(item).each do |k, v|
|
42
42
|
allow(fakevault).to receive(:[]).with(k).and_return(v)
|
43
43
|
end
|
44
|
-
# stub chef-vault to return the fake vault
|
44
|
+
# stub chef-vault to return the fake vault, via both symbol
|
45
|
+
# and string forms of the data bag name
|
46
|
+
allow(ChefVault::Item).to(
|
47
|
+
receive(:load)
|
48
|
+
.with(vaultname, item.to_s)
|
49
|
+
.and_return(fakevault)
|
50
|
+
)
|
45
51
|
allow(ChefVault::Item).to(
|
46
52
|
receive(:load)
|
47
53
|
.with(vaultname.to_s, item.to_s)
|
@@ -79,6 +79,12 @@ RSpec.describe ChefVault::TestFixtures do
|
|
79
79
|
expect(baz).to eq(2)
|
80
80
|
end
|
81
81
|
|
82
|
+
it 'it should allow access to foo/bar via a symbol instead of a string' do
|
83
|
+
ChefVault::TestFixtures.plugins
|
84
|
+
baz = ChefVault::Item.load(:foo, 'bar')['baz']
|
85
|
+
expect(baz).to eq(2)
|
86
|
+
end
|
87
|
+
|
82
88
|
it 'it should stub the bar/foo vault item' do
|
83
89
|
ChefVault::TestFixtures.plugins
|
84
90
|
baz = ChefVault::Item.load('bar', 'foo')['baz']
|
@@ -92,6 +98,13 @@ RSpec.describe ChefVault::TestFixtures do
|
|
92
98
|
expect(item1['baz']).to eq(item2['baz'])
|
93
99
|
end
|
94
100
|
|
101
|
+
it 'should allow access to the aliased bar/gzonk vault item via a symbol' do
|
102
|
+
ChefVault::TestFixtures.plugins
|
103
|
+
item1 = ChefVault::Item.load(:bar, 'foo')
|
104
|
+
item2 = ChefVault::Item.load(:bar, 'gzonk')
|
105
|
+
expect(item1['baz']).to eq(item2['baz'])
|
106
|
+
end
|
107
|
+
|
95
108
|
it 'should allow and ignore an attempt to change a vault' do
|
96
109
|
ChefVault::TestFixtures.plugins
|
97
110
|
item = ChefVault::Item.load('bar', 'foo')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James FitzGibbon
|
@@ -279,30 +279,6 @@ dependencies:
|
|
279
279
|
description: |-
|
280
280
|
chef-vault-testfixtures provides an RSpec shared context that
|
281
281
|
dynamically stubs access to chef-vault encrypted data bags.
|
282
|
-
|
283
|
-
chef-vault is a gem to manage distribution and control of keys to
|
284
|
-
decrypt Chef encrypted data bags.
|
285
|
-
|
286
|
-
When testing a cookbook that uses chef-vault, encryption is generally
|
287
|
-
out of scope, which results in a large amount of stubs or mocks so that you get back fixture data without performing decryption.
|
288
|
-
|
289
|
-
This gem makes testing Chef cookbooks easier using ChefSpec by
|
290
|
-
dynamically stubbing attempts to access vault data to return invalid
|
291
|
-
(i.e. not real passwords for any of your environments) that are properly
|
292
|
-
formatted (e.g. a vault item containing an RSA key really contains one)
|
293
|
-
|
294
|
-
The intended use case is that for each group of distinct secrets
|
295
|
-
(e.g. an application stack, or a development team) you create one or
|
296
|
-
more plugins. The plugins contain data that is specific to your
|
297
|
-
application.
|
298
|
-
|
299
|
-
Since plugins can be whitelisted or blacklisted when the shared
|
300
|
-
context is created, this makes it easy to only include the appropriate
|
301
|
-
secrets in a given cookbook's tests.
|
302
|
-
|
303
|
-
Attempts to access secrets that would not be available to a node
|
304
|
-
during a real chef-client run will not be mocked, which will cause
|
305
|
-
the double to raise an 'unexpected message received' error.
|
306
282
|
email:
|
307
283
|
- james.i.fitzgibbon@nordstrom.com
|
308
284
|
executables: []
|
@@ -354,5 +330,5 @@ rubygems_version: 2.4.4
|
|
354
330
|
signing_key:
|
355
331
|
specification_version: 4
|
356
332
|
summary: chef-vault-testfixtures provides an RSpec shared context that dynamically
|
357
|
-
stubs access to chef-vault encrypted data bags
|
333
|
+
stubs access to chef-vault encrypted data bags.
|
358
334
|
test_files: []
|