chef-vault-testfixtures 0.5.1 → 3.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
- SHA1:
3
- metadata.gz: fb82257127173edcb4dfe569cfd721c0e3af3923
4
- data.tar.gz: 1eca1e10f38dbc76f559a98ccbb6b9c7e751629c
2
+ SHA256:
3
+ metadata.gz: b6bd8405c21bb891bc7b84cf866394206a3422f472ddac71fc4d39cac75082a3
4
+ data.tar.gz: 3b65dd02d01384c0c77dcdb3f3816e3bca4f1f0e9ae4f06385ade7932a6f2a32
5
5
  SHA512:
6
- metadata.gz: c6fb5f77868845d5d9a0c8bd5faf5ffb4e929e03f23e8b13799b5872d59e5b083d2daacbdd757609e86606d9fef5743247a587a18f9f289491a310a52bcf631b
7
- data.tar.gz: 81747746d5c8ea6996227ecad1f6681cfa70d9a2508dd7e6c172cc6a8f7862c49f07276f6234e938e7d31029e0e7571ae6c5689d84fcc648ebacc041454fa629
6
+ metadata.gz: 3ef24219bd404f1a78a0346a7c85afb2b913e737c37f76af5c533731af2988d8f134f30f9727d1aaafc439eed3c548dd878ac501b531430fbb32b7e4416f8b61
7
+ data.tar.gz: 8e4d69a212bc6173b8437f55a6785a8361eb7a2ddb27ac9a1c1f762a7196b74843c52b327cfdef220de94548c361f1441433ac2c502040d3a04733a92c6f278d
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -1,81 +1,21 @@
1
- # -*- encoding: utf-8 -*-
2
- # stub: chef-vault-testfixtures 0.5.1.20160204143606 ruby lib
1
+ $:.unshift(File.dirname(__FILE__) + "/lib")
2
+ require "chef-vault/test_fixtures_version"
3
3
 
4
4
  Gem::Specification.new do |s|
5
- s.name = "chef-vault-testfixtures"
6
- s.version = "0.5.1.20160204143606"
5
+ s.name = "chef-vault-testfixtures"
6
+ s.version = ChefVault::TestFixtures::VERSION
7
7
 
8
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
- s.require_paths = ["lib"]
10
- s.authors = ["James FitzGibbon"]
11
- s.date = "2016-02-04"
12
- s.description = "chef-vault-testfixtures provides an RSpec shared context that\nstubs access to chef-vault encrypted data bags using the same\nfallback mechanism as the `chef_vault_item` helper from the\n[chef-vault cookbook](https://supermarket.chef.io/cookbooks/chef-vault)"
13
- s.email = ["james.i.fitzgibbon@nordstrom.com"]
14
- s.extra_rdoc_files = ["History.md", "Manifest.txt", "README.md"]
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"]
16
- s.homepage = "https://github.com/Nordstrom/chef-vault-testfixtures"
17
- s.licenses = ["apache2"]
18
- s.rdoc_options = ["--main", "README.md"]
19
- s.rubygems_version = "2.4.5.1"
20
- s.summary = "chef-vault-testfixtures provides an RSpec shared context that stubs access to chef-vault encrypted data bags using the same fallback mechanism as the `chef_vault_item` helper from the [chef-vault cookbook](https://supermarket.chef.io/cookbooks/chef-vault)"
8
+ s.require_paths = ["lib"]
9
+ s.authors = ["Thom May"]
10
+ s.email = ["thom@chef.io"]
11
+ s.homepage = "https://github.com/chef/chef-vault-testfixtures"
12
+ s.files = %w{LICENSE} + Dir.glob("*.gemspec") + `git ls-files`.split("\n").select { |f| f =~ %r{^(?:bin/|lib/)}i }
13
+ s.licenses = ["apache2"]
14
+ s.summary = "chef-vault-testfixtures provides an RSpec shared context that stubs access to chef-vault encrypted data bags using the same fallback mechanism as the `chef_vault_item` helper from the [chef-vault cookbook](https://supermarket.chef.io/cookbooks/chef-vault)"
15
+ s.description = s.summary
16
+ s.required_ruby_version = ">= 2.5"
21
17
 
22
- if s.respond_to? :specification_version then
23
- s.specification_version = 4
24
-
25
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
- s.add_runtime_dependency(%q<rspec>, ["~> 3.1"])
27
- s.add_runtime_dependency(%q<chef-vault>, ["~> 2.5"])
28
- s.add_runtime_dependency(%q<hashie>, ["< 4.0", ">= 2.0"])
29
- s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
30
- s.add_development_dependency(%q<chef>, ["~> 12.0"])
31
- s.add_development_dependency(%q<hoe>, ["~> 3.13"])
32
- s.add_development_dependency(%q<hoe-gemspec>, ["~> 1.0"])
33
- s.add_development_dependency(%q<rake>, ["~> 10.3"])
34
- s.add_development_dependency(%q<guard>, ["~> 2.12"])
35
- s.add_development_dependency(%q<guard-rspec>, ["~> 4.2"])
36
- s.add_development_dependency(%q<guard-rake>, ["~> 0.0"])
37
- s.add_development_dependency(%q<guard-rubocop>, ["~> 1.2"])
38
- s.add_development_dependency(%q<chefspec>, ["~> 4.2"])
39
- s.add_development_dependency(%q<berkshelf>, ["~> 4.0"])
40
- s.add_development_dependency(%q<simplecov>, ["~> 0.9"])
41
- s.add_development_dependency(%q<simplecov-console>, ["~> 0.2"])
42
- s.add_development_dependency(%q<yard>, ["~> 0.8"])
43
- else
44
- s.add_dependency(%q<rspec>, ["~> 3.1"])
45
- s.add_dependency(%q<chef-vault>, ["~> 2.5"])
46
- s.add_dependency(%q<hashie>, ["< 4.0", ">= 2.0"])
47
- s.add_dependency(%q<rdoc>, ["~> 4.0"])
48
- s.add_dependency(%q<chef>, ["~> 12.0"])
49
- s.add_dependency(%q<hoe>, ["~> 3.13"])
50
- s.add_dependency(%q<hoe-gemspec>, ["~> 1.0"])
51
- s.add_dependency(%q<rake>, ["~> 10.3"])
52
- s.add_dependency(%q<guard>, ["~> 2.12"])
53
- s.add_dependency(%q<guard-rspec>, ["~> 4.2"])
54
- s.add_dependency(%q<guard-rake>, ["~> 0.0"])
55
- s.add_dependency(%q<guard-rubocop>, ["~> 1.2"])
56
- s.add_dependency(%q<chefspec>, ["~> 4.2"])
57
- s.add_dependency(%q<berkshelf>, ["~> 4.0"])
58
- s.add_dependency(%q<simplecov>, ["~> 0.9"])
59
- s.add_dependency(%q<simplecov-console>, ["~> 0.2"])
60
- s.add_dependency(%q<yard>, ["~> 0.8"])
61
- end
62
- else
63
- s.add_dependency(%q<rspec>, ["~> 3.1"])
64
- s.add_dependency(%q<chef-vault>, ["~> 2.5"])
65
- s.add_dependency(%q<hashie>, ["< 4.0", ">= 2.0"])
66
- s.add_dependency(%q<rdoc>, ["~> 4.0"])
67
- s.add_dependency(%q<chef>, ["~> 12.0"])
68
- s.add_dependency(%q<hoe>, ["~> 3.13"])
69
- s.add_dependency(%q<hoe-gemspec>, ["~> 1.0"])
70
- s.add_dependency(%q<rake>, ["~> 10.3"])
71
- s.add_dependency(%q<guard>, ["~> 2.12"])
72
- s.add_dependency(%q<guard-rspec>, ["~> 4.2"])
73
- s.add_dependency(%q<guard-rake>, ["~> 0.0"])
74
- s.add_dependency(%q<guard-rubocop>, ["~> 1.2"])
75
- s.add_dependency(%q<chefspec>, ["~> 4.2"])
76
- s.add_dependency(%q<berkshelf>, ["~> 4.0"])
77
- s.add_dependency(%q<simplecov>, ["~> 0.9"])
78
- s.add_dependency(%q<simplecov-console>, ["~> 0.2"])
79
- s.add_dependency(%q<yard>, ["~> 0.8"])
80
- end
18
+ s.add_runtime_dependency "rspec", "~> 3.4"
19
+ s.add_runtime_dependency "chef-vault", ">= 3", "< 5" # validate 5 if we release that
20
+ s.add_runtime_dependency "hashie", "< 5.0", ">= 2.0"
81
21
  end
@@ -6,13 +6,12 @@ require "rspec"
6
6
  require "rspec/core/shared_context"
7
7
  require "chef-vault"
8
8
 
9
+ require "chef-vault/test_fixtures_version"
10
+
9
11
  # chef-vault helps manage encrypted data bags using a node's public key
10
12
  class ChefVault
11
13
  # dynamic RSpec contexts for cookbooks that use chef-vault
12
14
  class TestFixtures
13
- # the version of the gem
14
- VERSION = "0.5.1"
15
-
16
15
  # dynamically creates a memoized RSpec shared context
17
16
  # that when included into an example group will stub
18
17
  # ChefVault::Item for each of the defined vaults. The
@@ -42,9 +41,15 @@ class ChefVault
42
41
  # @api private
43
42
  def find_vaults(stub_encrypted_data)
44
43
  dbdir = Pathname.new("test") + "integration" + "data_bags"
45
- dbdir.each_child do |vault|
46
- next unless vault.directory?
47
- stub_vault(stub_encrypted_data, vault)
44
+ smokedir = Pathname.new("test") + "smoke" + "default" + "data_bags"
45
+ [ dbdir, smokedir ].each do |dir|
46
+ next unless dir.directory?
47
+
48
+ dir.each_child do |vault|
49
+ next unless vault.directory?
50
+
51
+ stub_vault(stub_encrypted_data, vault)
52
+ end
48
53
  end
49
54
  end
50
55
 
@@ -61,8 +66,10 @@ class ChefVault
61
66
  db = {}
62
67
  vault.each_child do |e|
63
68
  next unless e.file?
69
+
64
70
  m = e.basename.to_s.downcase.match(/(.+)\.json/i)
65
71
  next unless m
72
+
66
73
  content = JSON.parse(e.read)
67
74
  vaultname = vault.basename.to_s
68
75
  stub_vault_item(vaultname, m[1], content, db)
@@ -89,12 +96,21 @@ class ChefVault
89
96
  # stub vault lookup of each of the vault item keys
90
97
  content.each do |k, v|
91
98
  next if "id" == k
99
+
92
100
  allow(vi).to receive(:[]).with(k).and_return(v)
93
101
  end
94
102
 
103
+ # stub hash conversion as a stopgap to other hash methods
104
+ allow(vi).to receive(:to_h).with(no_args).and_return(content)
105
+ allow(vi).to receive(:to_hash).with(no_args).and_return(content)
106
+
95
107
  # stub ChefVault and Chef::DataBag to return the doubles
96
108
  # via both symbol and string forms of the data bag name
97
109
  [vault, vault.to_sym].each do |dbname|
110
+ allow(ChefVault::Item).to(
111
+ receive(:vault?).with(dbname, item).and_return(true)
112
+ )
113
+
98
114
  allow(ChefVault::Item).to(
99
115
  receive(:load)
100
116
  .with(dbname, item)
@@ -124,14 +140,13 @@ class ChefVault
124
140
  dbi["raw_data"] = content
125
141
  content.each_key do |k|
126
142
  next if "id" == k
143
+
127
144
  dbi[k] = { "encrypted_data" => "..." }
128
145
  end
129
146
 
130
147
  [vault, vault.to_sym].each do |dbname|
131
148
  allow(Chef::DataBagItem).to(
132
- receive(:load)
133
- .with(dbname, item)
134
- .and_return(dbi)
149
+ receive(:load).with(dbname, item).and_return(dbi)
135
150
  )
136
151
  end
137
152
  end
@@ -0,0 +1,7 @@
1
+ class ChefVault
2
+ # dynamic RSpec contexts for cookbooks that use chef-vault
3
+ class TestFixtures
4
+ # the version of the gem
5
+ VERSION = "3.1.2".freeze
6
+ end
7
+ 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.5.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
- - James FitzGibbon
7
+ - Thom May
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-04 00:00:00.000000000 Z
11
+ date: 2021-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -16,295 +16,87 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.1'
19
+ version: '3.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.1'
26
+ version: '3.4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: chef-vault
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '2.5'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.5'
41
- - !ruby/object:Gem::Dependency
42
- name: hashie
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - ">="
46
32
  - !ruby/object:Gem::Version
47
- version: '2.0'
33
+ version: '3'
48
34
  - - "<"
49
35
  - !ruby/object:Gem::Version
50
- version: '4.0'
36
+ version: '5'
51
37
  type: :runtime
52
38
  prerelease: false
53
39
  version_requirements: !ruby/object:Gem::Requirement
54
40
  requirements:
55
41
  - - ">="
56
42
  - !ruby/object:Gem::Version
57
- version: '2.0'
43
+ version: '3'
58
44
  - - "<"
59
45
  - !ruby/object:Gem::Version
60
- version: '4.0'
61
- - !ruby/object:Gem::Dependency
62
- name: rdoc
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '4.0'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '4.0'
75
- - !ruby/object:Gem::Dependency
76
- name: chef
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '12.0'
82
- type: :development
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '12.0'
89
- - !ruby/object:Gem::Dependency
90
- name: hoe
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - "~>"
94
- - !ruby/object:Gem::Version
95
- version: '3.13'
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: '3.13'
103
- - !ruby/object:Gem::Dependency
104
- name: hoe-gemspec
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: '1.0'
110
- type: :development
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - "~>"
115
- - !ruby/object:Gem::Version
116
- version: '1.0'
46
+ version: '5'
117
47
  - !ruby/object:Gem::Dependency
118
- name: rake
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - "~>"
122
- - !ruby/object:Gem::Version
123
- version: '10.3'
124
- type: :development
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - "~>"
129
- - !ruby/object:Gem::Version
130
- version: '10.3'
131
- - !ruby/object:Gem::Dependency
132
- name: guard
133
- requirement: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - "~>"
136
- - !ruby/object:Gem::Version
137
- version: '2.12'
138
- type: :development
139
- prerelease: false
140
- version_requirements: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - "~>"
143
- - !ruby/object:Gem::Version
144
- version: '2.12'
145
- - !ruby/object:Gem::Dependency
146
- name: guard-rspec
147
- requirement: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - "~>"
150
- - !ruby/object:Gem::Version
151
- version: '4.2'
152
- type: :development
153
- prerelease: false
154
- version_requirements: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - "~>"
157
- - !ruby/object:Gem::Version
158
- version: '4.2'
159
- - !ruby/object:Gem::Dependency
160
- name: guard-rake
161
- requirement: !ruby/object:Gem::Requirement
162
- requirements:
163
- - - "~>"
164
- - !ruby/object:Gem::Version
165
- version: '0.0'
166
- type: :development
167
- prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- requirements:
170
- - - "~>"
171
- - !ruby/object:Gem::Version
172
- version: '0.0'
173
- - !ruby/object:Gem::Dependency
174
- name: guard-rubocop
175
- requirement: !ruby/object:Gem::Requirement
176
- requirements:
177
- - - "~>"
178
- - !ruby/object:Gem::Version
179
- version: '1.2'
180
- type: :development
181
- prerelease: false
182
- version_requirements: !ruby/object:Gem::Requirement
183
- requirements:
184
- - - "~>"
185
- - !ruby/object:Gem::Version
186
- version: '1.2'
187
- - !ruby/object:Gem::Dependency
188
- name: chefspec
189
- requirement: !ruby/object:Gem::Requirement
190
- requirements:
191
- - - "~>"
192
- - !ruby/object:Gem::Version
193
- version: '4.2'
194
- type: :development
195
- prerelease: false
196
- version_requirements: !ruby/object:Gem::Requirement
197
- requirements:
198
- - - "~>"
199
- - !ruby/object:Gem::Version
200
- version: '4.2'
201
- - !ruby/object:Gem::Dependency
202
- name: berkshelf
203
- requirement: !ruby/object:Gem::Requirement
204
- requirements:
205
- - - "~>"
206
- - !ruby/object:Gem::Version
207
- version: '4.0'
208
- type: :development
209
- prerelease: false
210
- version_requirements: !ruby/object:Gem::Requirement
211
- requirements:
212
- - - "~>"
213
- - !ruby/object:Gem::Version
214
- version: '4.0'
215
- - !ruby/object:Gem::Dependency
216
- name: simplecov
48
+ name: hashie
217
49
  requirement: !ruby/object:Gem::Requirement
218
50
  requirements:
219
- - - "~>"
220
- - !ruby/object:Gem::Version
221
- version: '0.9'
222
- type: :development
223
- prerelease: false
224
- version_requirements: !ruby/object:Gem::Requirement
225
- requirements:
226
- - - "~>"
51
+ - - "<"
227
52
  - !ruby/object:Gem::Version
228
- version: '0.9'
229
- - !ruby/object:Gem::Dependency
230
- name: simplecov-console
231
- requirement: !ruby/object:Gem::Requirement
232
- requirements:
233
- - - "~>"
53
+ version: '5.0'
54
+ - - ">="
234
55
  - !ruby/object:Gem::Version
235
- version: '0.2'
236
- type: :development
56
+ version: '2.0'
57
+ type: :runtime
237
58
  prerelease: false
238
59
  version_requirements: !ruby/object:Gem::Requirement
239
60
  requirements:
240
- - - "~>"
241
- - !ruby/object:Gem::Version
242
- version: '0.2'
243
- - !ruby/object:Gem::Dependency
244
- name: yard
245
- requirement: !ruby/object:Gem::Requirement
246
- requirements:
247
- - - "~>"
61
+ - - "<"
248
62
  - !ruby/object:Gem::Version
249
- version: '0.8'
250
- type: :development
251
- prerelease: false
252
- version_requirements: !ruby/object:Gem::Requirement
253
- requirements:
254
- - - "~>"
63
+ version: '5.0'
64
+ - - ">="
255
65
  - !ruby/object:Gem::Version
256
- version: '0.8'
257
- description: |-
258
- chef-vault-testfixtures provides an RSpec shared context that
259
- stubs access to chef-vault encrypted data bags using the same
260
- fallback mechanism as the `chef_vault_item` helper from the
261
- [chef-vault cookbook](https://supermarket.chef.io/cookbooks/chef-vault)
66
+ version: '2.0'
67
+ description: chef-vault-testfixtures provides an RSpec shared context that stubs access
68
+ to chef-vault encrypted data bags using the same fallback mechanism as the `chef_vault_item`
69
+ helper from the [chef-vault cookbook](https://supermarket.chef.io/cookbooks/chef-vault)
262
70
  email:
263
- - james.i.fitzgibbon@nordstrom.com
71
+ - thom@chef.io
264
72
  executables: []
265
73
  extensions: []
266
- extra_rdoc_files:
267
- - History.md
268
- - Manifest.txt
269
- - README.md
74
+ extra_rdoc_files: []
270
75
  files:
271
- - ".rspec"
272
- - ".rubocop.yml"
273
- - ".yardopts"
274
- - Gemfile
275
- - Guardfile
276
- - History.md
277
- - Manifest.txt
278
- - README.md
279
- - Rakefile
76
+ - LICENSE
280
77
  - chef-vault-testfixtures.gemspec
281
78
  - lib/chef-vault/test_fixtures.rb
282
- - lib/hoe/markdown.rb
283
- - spec/lib/chef-vault/test_fixtures_spec.rb
284
- - spec/spec_helper.rb
285
- homepage: https://github.com/Nordstrom/chef-vault-testfixtures
79
+ - lib/chef-vault/test_fixtures_version.rb
80
+ homepage: https://github.com/chef/chef-vault-testfixtures
286
81
  licenses:
287
82
  - apache2
288
83
  metadata: {}
289
84
  post_install_message:
290
- rdoc_options:
291
- - "--main"
292
- - README.md
85
+ rdoc_options: []
293
86
  require_paths:
294
87
  - lib
295
88
  required_ruby_version: !ruby/object:Gem::Requirement
296
89
  requirements:
297
90
  - - ">="
298
91
  - !ruby/object:Gem::Version
299
- version: '0'
92
+ version: '2.5'
300
93
  required_rubygems_version: !ruby/object:Gem::Requirement
301
94
  requirements:
302
95
  - - ">="
303
96
  - !ruby/object:Gem::Version
304
97
  version: '0'
305
98
  requirements: []
306
- rubyforge_project:
307
- rubygems_version: 2.4.5.1
99
+ rubygems_version: 3.1.4
308
100
  signing_key:
309
101
  specification_version: 4
310
102
  summary: chef-vault-testfixtures provides an RSpec shared context that stubs access
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,15 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- - '**/Gemfile'
4
- - '**/*.gemspec'
5
- - 'pkg/**/*'
6
-
7
- Style/RegexpLiteral:
8
- Exclude:
9
- - '**/Guardfile'
10
-
11
- Style/Documentation:
12
- Exclude:
13
- - 'spec/**/*.rb'
14
- - lib/chef-vault/test_fixtures/version.rb
15
- - lib/hoe/markdown.rb
data/.yardopts DELETED
@@ -1,4 +0,0 @@
1
- -
2
- README.rdoc
3
- History.rdoc
4
- lib/**/*.rb
data/Gemfile DELETED
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org/'
2
-
3
- gem "chefstyle", git: "https://github.com/chef/chefstyle.git"
4
-
5
- gemspec
data/Guardfile DELETED
@@ -1,17 +0,0 @@
1
- # prevent dropping into pry when nothing is happening
2
- interactor :off
3
-
4
- guard :rubocop, all_on_start: true, cli: ['-D'] do
5
- watch(%r{bin/.+$})
6
- watch(%r{.+\.rb$})
7
- watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
8
- watch('Gemfile')
9
- watch('Rakefile')
10
- end
11
-
12
- guard :rspec, all_on_start: true, cmd: 'bundle exec rspec' do
13
- watch(%r{^spec/recipes/.+_spec\.rb$})
14
- watch(%r{^spec/(.+)_spec\.rb$})
15
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
16
- watch(%r{^spec/spec_helper.*\.rb$}) { 'spec' }
17
- end
data/History.md DELETED
@@ -1,47 +0,0 @@
1
- # Changelog for chef-vault-testfixtures
2
-
3
- ## 0.5.1
4
-
5
- * Bump hashie dependency for compatibility with latest chefdk (Thanks to
6
- dougireton and dwmarshall)
7
-
8
- ## 0.5.0
9
-
10
- * breaking change: by default, only stub calls to `ChefVault::Item.load(bag, item)` and `Chef::DataBag.load(bag).key?(item_keys)`. This allows people who are using the JSON files in test/integration/data_bags to stub unencrypted data bag to do so. See the README for details of how to continue to stub `ChefVault::DataBagItem.load(bag, item)` and return a fake hash. Reported by [Dru Goradia](https://github.com/dgoradia-atlas))
11
-
12
- ## 0.4.1
13
-
14
- * fix bug where only the last item for a given vault was stubbed
15
-
16
- ## 0.4.0
17
-
18
- * add stubs for Chef::DataBagItem.load and Chef::DataBag.load for compatibility with code that probes the data bag to determine if it is a vault (e.g. chef-vault cookbook ~> 1.3)
19
-
20
- ## 0.3.0
21
-
22
- * completely re-work to use JSON data bag files in test/integration for compatibility with the fallback mechanism in the chef-vault cookbook
23
-
24
- ## 0.2.0
25
-
26
- * move chef dependency out of runtime and into development - rubygems 1.8.x (which chef-client shipped with prior to 11.8.0) has major problems now that Chef v11 and v12 are both available
27
-
28
- ## 0.1.3
29
-
30
- * change chef runtime dependency from >= 11.14 to >= 11.0
31
- * clean up some test ordering problems related to not clearing the blacklist properly
32
-
33
- ## 0.1.2
34
-
35
- * allow access to the data bag via the symbol form as well as the string form
36
- * re-organize the README to make the summary extracted by Hoe smaller
37
- * add Travis-CI integration and badging
38
- * add Code Climate integration and badging
39
-
40
- ## 0.1.1
41
-
42
- * fix disconnect between docs and code for shared context method
43
- * remove Hoe test plugin so we don't double up on test runs
44
-
45
- ## 0.1.0
46
-
47
- * initial version
data/Manifest.txt DELETED
@@ -1,14 +0,0 @@
1
- .rspec
2
- .rubocop.yml
3
- .yardopts
4
- Gemfile
5
- Guardfile
6
- History.md
7
- Manifest.txt
8
- README.md
9
- Rakefile
10
- chef-vault-testfixtures.gemspec
11
- lib/chef-vault/test_fixtures.rb
12
- lib/hoe/markdown.rb
13
- spec/lib/chef-vault/test_fixtures_spec.rb
14
- spec/spec_helper.rb
data/README.md DELETED
@@ -1,201 +0,0 @@
1
- # chef-vault-testfixtures
2
-
3
- * home :: https://github.com/Nordstrom/chef-vault-testfixtures
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)
8
-
9
- ## DESCRIPTION
10
-
11
- chef-vault-testfixtures provides an RSpec shared context that
12
- stubs access to chef-vault encrypted data bags using the same
13
- fallback mechanism as the `chef_vault_item` helper from the
14
- [chef-vault cookbook](https://supermarket.chef.io/cookbooks/chef-vault)
15
-
16
- ## USAGE
17
-
18
- [chef-vault](https://github.com/Nordstrom/chef-vault) is a gem to manage
19
- distribution and control of keys to decrypt Chef encrypted data bags.
20
-
21
- When testing a cookbook that uses chef-vault, encryption is generally
22
- out of scope, which results in a large number of stubs or mocks so that
23
- you can get back fixture data without performing decryption.
24
-
25
- Chef created the [chef-vault cookbook](https://supermarket.chef.io/cookbooks/chef-vault)
26
- to make integration testing easier. If you use the `chef_vault_item`
27
- helper provided by that cookbook, then failing to load the vault
28
- causes the helper to fall back to a normal JSON data bag in the
29
- directory `test/integration/data_bags`.
30
-
31
- This gem makes the unit test side of cookbook testing with ChefSpec
32
- easier by dynamically stubbing attempts to access vault data to
33
- use the same JSON data bags as the helper. This allows you to provide
34
- one source of stubbing data that works for both unit and integration
35
- test.
36
-
37
- ## USAGE
38
-
39
- In the file `test/integration/data_bags/foo/bar.json`:
40
-
41
- { "password": "sekrit" }
42
-
43
- In your cookbook Gemfile:
44
-
45
- gem 'chef-vault-testfixtures', '~> 0.3'
46
-
47
- In your cookbook `spec/spec_helper.rb`:
48
-
49
- require 'chef-vault/test_fixtures'
50
-
51
- In a cookbook example:
52
-
53
- RSpec.describe 'my_cookbook::default' do
54
- include ChefVault::TestFixtures.rspec_shared_context
55
-
56
- let(:chef_run) { ChefSpec::SoloRunner.new.converge(described_recipe) }
57
-
58
- it 'should converge' do
59
- expect(chef_run).to include_recipe(described_recipe)
60
- end
61
- end
62
-
63
- The recipe that the example tests:
64
-
65
- include_recipe 'chef-vault'
66
- item = chef_vault_item('foo', 'bar')
67
- file '/tmp/foo' do
68
- contents item['password']
69
- end
70
-
71
- The helper will call `ChefVault::Item.load`, which will be stubbed using
72
- the data bag from the test/integration/data_bags directory.
73
-
74
- ## VAULT PROBING
75
-
76
- Some recipes and helpers attempt to determine if a data bag is a vault
77
- by checking the raw data bag item to see if one of the values contains
78
- encrypted data, then checking for the existence of the `_keys` data bag
79
- item to go along with the normal item. The [sensu cookbook](https://github.com/sensu/sensu-chef/blob/35ee3aa6fa4ad578cdf751fe6822e3d2b3890d94/libraries/sensu_helpers.rb#L39-55) is a good example
80
- of this:
81
-
82
- ```
83
- raw_hash = Chef::DataBagItem.load(data_bag_name, item)
84
- encrypted = raw_hash.detect do |key, value|
85
- if value.is_a?(Hash)
86
- value.has_key?("encrypted_data")
87
- end
88
- end
89
- if encrypted
90
- if Chef::DataBag.load(data_bag_name).key? "#{item}_keys"
91
- chef_vault_item(data_bag_name, item)
92
- else
93
- secret = Chef::EncryptedDataBagItem.load_secret
94
- Chef::EncryptedDataBagItem.new(raw_hash, secret)
95
- end
96
- else
97
- raw_hash
98
- end
99
- ```
100
-
101
- chef-vault-testfixtures also stubs `Chef::DataBag` so that for every JSON
102
- file in your test directory, it will think that there is a side-along
103
- item suffixed with `_keys`. This satisfies the probes that the chef-vault
104
- cookbook helper uses. To address the check for the `encrypted_data` key
105
- that the sensu cookbook uses, pass a true value to `rspec_shared_context`:
106
-
107
- ```
108
- RSpec.describe 'my_cookbook::default' do
109
- include ChefVault::TestFixtures.rspec_shared_context(true)
110
- end
111
- ```
112
-
113
- Now, when your recipe calls `Chef::DataBagItem.load`, it will
114
- get back a hash with the same keys as the JSON file, but values which are
115
- hashes of the form:
116
-
117
- ```
118
- {
119
- encrypted_data => '...'
120
- }
121
- ```
122
-
123
- This is not a valid data bag obviously, but it will satisfy the probe
124
- and cause code like that in the sensu cookbook to call `ChefVault::Item.load`,
125
- which is stubbed to return valid data.
126
-
127
- ## STUBBING UNENCRYPTED DATA BAGS
128
-
129
- This technique is not a part of this gem, but was brought to my attention
130
- in an issue. Credit to Dru Goradia for the approach. This will let you
131
- populate an unencrypted data bag from the same JSON files:
132
-
133
- In `spec/spec_helper.rb`:
134
-
135
- ```
136
- require 'chef-vault/test_fixtures'
137
- require 'json'
138
-
139
- def parse_data_bag (path)
140
- data_bags_path = File.expand_path(File.join(File.dirname(__FILE__), '../test/integration/data_bags'))
141
- return JSON.parse(File.read("#{data_bags_path}/#{path}"))
142
- end
143
- ```
144
-
145
- In your test:
146
-
147
- ```
148
- describe 'my_cookbook::default' do
149
- include ChefVault::TestFixtures.rspec_shared_context
150
-
151
- let(:chef_run) do
152
- ChefSpec::ServerRunner.new() do |node, server|
153
- server.create_data_bag('foo', {
154
- 'bar' => parse_data_bag('foo/bar.json')
155
- })
156
- end.converge(described_recipe)
157
- end
158
-
159
- it 'should converge' do
160
- expect(chef_run).to include_recipe(described_recipe)
161
- end
162
- end
163
- ```
164
-
165
- ## DEPENDENCIES
166
-
167
- It may seem strange that chef isn't a runtime dependency of this gem.
168
- This is due to idiosyncracies in the way that old versions of rubygems
169
- (such as those that ship with chef-client prior to 11.18.0) process
170
- dependencies.
171
-
172
- If we include chef as a dependency, even with a relaxed requirement
173
- like '>= 11.0', rubygems v1.8.x will still try to pull in chef-12.0.3,
174
- even if the --conservative switch is used. This in turn pulls in
175
- Ohai 8.1.x, which doesn't work under Ruby 1.9.3 (which is what chef-client
176
- 11 embeds).
177
-
178
- rubygems v2.x.x do not suffer from this problem. The net takeaway is that
179
- attempting to install this gem on a system that does not have chef installed
180
- will fail. I expect the instances of people trying to do this to be
181
- small.
182
-
183
- ## AUTHOR
184
-
185
- James FitzGibbon - james.i.fitzgibbon@nordstrom.com - @jf647
186
-
187
- ## LICENSE
188
-
189
- Copyright 2015 Nordstrom, Inc.
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
data/Rakefile DELETED
@@ -1,89 +0,0 @@
1
- require "chef-vault/test_fixtures"
2
-
3
- begin
4
- require "hoe"
5
- require "hoe/markdown"
6
- Hoe.plugin :gemspec
7
- Hoe.plugin :markdown
8
- Hoe.plugins.delete :test
9
- Hoe.spec "chef-vault-testfixtures" do |s|
10
- s.version = ChefVault::TestFixtures::VERSION
11
- developer "James FitzGibbon", "james.i.fitzgibbon@nordstrom.com"
12
- license "apache2"
13
- extra_deps << ["rspec", "~> 3.1"]
14
- extra_deps << ["chef-vault", "~> 2.5"]
15
- extra_deps << ["hashie", ">= 2.0", "< 4.0"]
16
- extra_dev_deps << ["chef", "~> 12.0"]
17
- extra_dev_deps << ["hoe", "~> 3.13"]
18
- extra_dev_deps << ["hoe-gemspec", "~> 1.0"]
19
- extra_dev_deps << ["rake", "~> 10.3"]
20
- extra_dev_deps << ["rspec", "~> 3.1"]
21
- extra_dev_deps << ["guard", "~> 2.12"]
22
- extra_dev_deps << ["guard-rspec", "~> 4.2"]
23
- extra_dev_deps << ["guard-rake", "~> 0.0"]
24
- extra_dev_deps << ["guard-rubocop", "~> 1.2"]
25
- extra_dev_deps << ["chefspec", "~> 4.2"]
26
- extra_dev_deps << ["berkshelf", "~> 4.0"]
27
- extra_dev_deps << ["simplecov", "~> 0.9"]
28
- extra_dev_deps << ["simplecov-console", "~> 0.2"]
29
- extra_dev_deps << ["yard", "~> 0.8"]
30
- end
31
- # re-generate our gemspec before packaging
32
- task package: "gem:spec"
33
- rescue LoadError
34
- puts "hoe not available; disabling tasks"
35
- end
36
-
37
- # Style Tests
38
- begin
39
- require "chefstyle"
40
- require "rubocop/rake_task"
41
- RuboCop::RakeTask.new do |t|
42
- t.formatters = ["progress"]
43
- t.options = ["-D"]
44
- t.patterns = %w{
45
- bin/*
46
- lib/**/*.rb
47
- spec/**/*.rb
48
- ./Rakefile
49
- }
50
- end
51
- desc "Run Style Tests"
52
- task style: [:rubocop]
53
- rescue LoadError
54
- puts "rubocop not available; disabling tasks"
55
- end
56
-
57
- # Unit Tests
58
- begin
59
- require "rspec/core/rake_task"
60
- RSpec::Core::RakeTask.new
61
-
62
- # Coverage
63
- desc "Generate unit test coverage report"
64
- task :coverage do
65
- ENV["COVERAGE"] = "true"
66
- Rake::Task[:test].invoke
67
- end
68
-
69
- # test is an alias for spec
70
- desc "runs unit tests"
71
- task test: :spec
72
-
73
- # default is to test everything
74
- desc "runs all tests"
75
- task default: :test
76
- rescue LoadError
77
- puts "rspec not available; disabling tasks"
78
- end
79
-
80
- # Documentation
81
- begin
82
- require "yard"
83
- require "yard/rake/yardoc_task"
84
- YARD::Rake::YardocTask.new(:doc) do |t|
85
- t.stats_options = ["--list-undoc"]
86
- end
87
- rescue LoadError
88
- puts "yard not available; disabling tasks"
89
- end
data/lib/hoe/markdown.rb DELETED
@@ -1,12 +0,0 @@
1
- class Hoe
2
- module Markdown
3
- def initialize_markdown
4
- self.readme_file = readme_file.sub(/\.txt$/, ".md")
5
- self.history_file = history_file.sub(/\.txt$/, ".md")
6
- end
7
-
8
- def define_markdown_tasks
9
- # do nothing
10
- end
11
- end
12
- end
@@ -1,82 +0,0 @@
1
- require "chef-vault/test_fixtures"
2
-
3
- RSpec.describe ChefVault::TestFixtures do
4
- describe "without the encrypted_data stub" do
5
- ChefVault::TestFixtures.clear_context
6
- include ChefVault::TestFixtures.rspec_shared_context(false)
7
-
8
- it "can create an RSpec shared context" do
9
- sc = ChefVault::TestFixtures.rspec_shared_context
10
- expect(sc).to be_a(Module)
11
- expect(sc).to be_a(RSpec::Core::SharedContext)
12
- end
13
-
14
- it "should only create one shared context" do
15
- mod1 = ChefVault::TestFixtures.rspec_shared_context
16
- mod2 = ChefVault::TestFixtures.rspec_shared_context
17
- expect(mod2).to be(mod1)
18
- end
19
-
20
- it "should stub the foo/bar vault item" do
21
- baz = ChefVault::Item.load("foo", "bar")["baz"]
22
- expect(baz).to eq(2)
23
- end
24
-
25
- it "should allow access to foo/bar via a symbol instead of a string" do
26
- baz = ChefVault::Item.load(:foo, "bar")["baz"]
27
- expect(baz).to eq(2)
28
- end
29
-
30
- it "should stub the bar/foo vault item" do
31
- baz = ChefVault::Item.load("bar", "foo")["baz"]
32
- expect(baz).to eq(1)
33
- end
34
-
35
- it "should allow access to the bar/gzonk vault item" do
36
- item1 = ChefVault::Item.load("bar", "foo")
37
- item2 = ChefVault::Item.load("bar", "gzonk")
38
- expect(item1["baz"]).to eq(item2["baz"])
39
- end
40
-
41
- it "should allow access to the bar/gzonk vault item via a symbol" do
42
- item1 = ChefVault::Item.load(:bar, "foo")
43
- item2 = ChefVault::Item.load(:bar, "gzonk")
44
- expect(item1["baz"]).to eq(item2["baz"])
45
- end
46
-
47
- it "should allow and ignore an attempt to change a vault" do
48
- item = ChefVault::Item.load("bar", "foo")
49
- item["foo"] = "foo"
50
- end
51
-
52
- it "should allow and ignore an attempt to set the clients" do
53
- item = ChefVault::Item.load("bar", "foo")
54
- item.clients("*:*")
55
- end
56
-
57
- it "should allow and ignore an attempt to save" do
58
- item = ChefVault::Item.load("bar", "foo")
59
- item.save
60
- end
61
-
62
- it "should stub the _keys data bag item" do
63
- db = Chef::DataBag.load("foo")
64
- expect(db.key?("bar_keys")).to be_truthy
65
- end
66
- end
67
- end
68
-
69
- RSpec.describe ChefVault::TestFixtures do
70
- describe "with the encrypted_data stub" do
71
- ChefVault::TestFixtures.clear_context
72
- include ChefVault::TestFixtures.rspec_shared_context(true)
73
-
74
- it "should present the foo/bar data bag item as encrypted" do
75
- dbi = Chef::DataBagItem.load("foo", "bar")
76
- encrypted = dbi.detect do |_, v|\
77
- v.is_a?(Hash) && v.key?("encrypted_data")
78
- end
79
- expect(encrypted).to be_truthy
80
- end
81
- end
82
- end
data/spec/spec_helper.rb DELETED
@@ -1,34 +0,0 @@
1
- if ENV["COVERAGE"]
2
- require "simplecov"
3
- require "simplecov-console"
4
- SimpleCov.formatters = [
5
- SimpleCov::Formatter::HTMLFormatter,
6
- SimpleCov::Formatter::Console,
7
- ]
8
- SimpleCov.start
9
- end
10
-
11
- RSpec.configure do |config|
12
- config.expect_with :rspec do |expectations|
13
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
14
- end
15
-
16
- config.mock_with :rspec do |mocks|
17
- mocks.verify_partial_doubles = true
18
- end
19
-
20
- config.disable_monkey_patching!
21
- config.order = :random
22
- Kernel.srand config.seed
23
- end
24
-
25
- # a helper to clear the context between examples
26
- class ChefVault
27
- class TestFixtures
28
- class << self
29
- def clear_context
30
- @context = nil
31
- end
32
- end
33
- end
34
- end