chef-vault-testfixtures 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40a722deedcbf099b45c88908a5a220547084dc6
4
- data.tar.gz: aa04d1e8e99a94b72ee12fba6e3541b81f3cc21b
3
+ metadata.gz: 7080da29fc74e42e55d2741c15612b27a5b5483d
4
+ data.tar.gz: aa5df94b9ffd8bbfca1419d7b3343f01506a5d43
5
5
  SHA512:
6
- metadata.gz: 33644416bda7fda97172ba9e79216d0ba7c2f930cbcf3ed1ee3b75dcf2938bb753ad49ef75089ae3dd7a18bda7064f9e14051c695f66135b24edc89e0e7e4552
7
- data.tar.gz: a81fc11dac06193f59aee78a88f9ea2ae1ae9eb7ecdf0f4d03c0da0d76a03bf94f19bf2910e79421f1f4e82bfb4c1d140668d2f71bad0072dbdaaae75b21c941
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 :: [![Gem Version](https://badge.fury.io/rb/chef-vault-testfixtures.png)](http://badge.fury.io/rb/chef-vault-testfixtures)
6
+ * build status :: [![Build Status](https://travis-ci.org/Nordstrom/chef-vault-testfixtures.png?branch=master)](https://travis-ci.org/Nordstrom/chef-vault-testfixtures)
7
+ * code climate :: [![Code Climate](https://codeclimate.com/github/Nordstrom/chef-vault-testfixtures/badges/gpa.svg)](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
- ## SYNOPSIS
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.1.20150223230658 ruby lib
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.1.20150223230658"
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.\n\nchef-vault is a gem to manage distribution and control of keys to\ndecrypt Chef encrypted data bags.\n\nWhen testing a cookbook that uses chef-vault, encryption is generally\nout of scope, which results in a large amount of stubs or mocks so that you get back fixture data without performing decryption.\n\nThis gem makes testing Chef cookbooks easier using ChefSpec by\ndynamically stubbing attempts to access vault data to return invalid\n(i.e. not real passwords for any of your environments) that are properly\nformatted (e.g. a vault item containing an RSA key really contains one)\n\nThe intended use case is that for each group of distinct secrets\n(e.g. an application stack, or a development team) you create one or\nmore plugins. The plugins contain data that is specific to your\napplication.\n\nSince plugins can be whitelisted or blacklisted when the shared\ncontext is created, this makes it easy to only include the appropriate\nsecrets in a given cookbook's tests.\n\nAttempts to access secrets that would not be available to a node\nduring a real chef-client run will not be mocked, which will cause\nthe double to raise an 'unexpected message received' error."
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.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.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: []