chefspec 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +1 -4
- data/features/server.feature +2 -2
- data/lib/chefspec/berkshelf.rb +1 -1
- data/lib/chefspec/librarian.rb +2 -2
- data/lib/chefspec/matchers/resource_matcher.rb +7 -3
- data/lib/chefspec/renderer.rb +1 -1
- data/lib/chefspec/rspec.rb +0 -1
- data/lib/chefspec/runner.rb +1 -1
- data/lib/chefspec/server.rb +6 -27
- data/lib/chefspec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b356cb25522616e55756a68cffb0fee6bbac9bb
|
4
|
+
data.tar.gz: 587c6da791e7fdac91ba470e47ba9ec182858874
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc83045236dca71e9627037bda4fb8288326daaaccae04d08ba09dfc30b02af46d2026b86cd7160752ad5c1f3968daa28455d6bdc5f0b732f526690e1e78b43b
|
7
|
+
data.tar.gz: 511164cffb5fa1e6b7f0f6ca1f3b2a24badd219448f4034e3b9b8c8f22d0b68d8c195a6d60084038ea92e4341e01c05d5e0bd31469a8ca28ca1fe3938006a114
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
CHANGELOG for ChefSpec
|
2
2
|
======================
|
3
3
|
|
4
|
+
## 4.0.1 (June 27, 2014)
|
5
|
+
Bugfixes:
|
6
|
+
- Fix class comparisons
|
7
|
+
- Update ChefZero API to work again
|
8
|
+
- Use proper cookbook in the template_finder
|
9
|
+
- Fix Ruby deprecations
|
10
|
+
- Various documentation updates
|
11
|
+
|
4
12
|
## 4.0.0 (June 2, 2014)
|
5
13
|
Breaking Changes:
|
6
14
|
- **Upgraded to RSpec 3!** RSpec 3 brings many new API changes and syntaxes
|
data/README.md
CHANGED
@@ -90,9 +90,6 @@ RSpec.configure do |config|
|
|
90
90
|
# the location of the calling spec file])
|
91
91
|
config.cookbook_path = '/var/cookbooks'
|
92
92
|
|
93
|
-
# Set the organization for Chef Zero (default: 'chefspec')
|
94
|
-
config.organization = 'sweetsauce'
|
95
|
-
|
96
93
|
# Specify the path for Chef Solo to find roles (default: [ascending search])
|
97
94
|
config.role_path = '/var/roles'
|
98
95
|
|
@@ -488,7 +485,7 @@ data_bag('users').each do |user|
|
|
488
485
|
end
|
489
486
|
```
|
490
487
|
|
491
|
-
ChefSpec will
|
488
|
+
ChefSpec will raise an error like:
|
492
489
|
|
493
490
|
```text
|
494
491
|
Real data_bags are disabled. Unregistered data_bag: data_bag(:users)
|
data/features/server.feature
CHANGED
@@ -6,10 +6,10 @@ Feature: The ChefSpec server
|
|
6
6
|
* I am using the "server" cookbook
|
7
7
|
|
8
8
|
Scenario Outline: Running specs
|
9
|
-
* I successfully run `rspec spec/<
|
9
|
+
* I successfully run `rspec spec/<Component>_spec.rb`
|
10
10
|
* the output should contain "0 failures"
|
11
11
|
Examples:
|
12
|
-
|
|
12
|
+
| Component |
|
13
13
|
| client |
|
14
14
|
| data_bag |
|
15
15
|
| environment |
|
data/lib/chefspec/berkshelf.rb
CHANGED
data/lib/chefspec/librarian.rb
CHANGED
@@ -38,8 +38,8 @@ module ChefSpec
|
|
38
38
|
def teardown!
|
39
39
|
env = ::Librarian::Chef::Environment.new(project_path: Dir.pwd)
|
40
40
|
env.config_db.local['path'] = @originalpath
|
41
|
-
|
42
|
-
FileUtils.rm_rf(@tmpdir) if File.
|
41
|
+
|
42
|
+
FileUtils.rm_rf(@tmpdir) if File.exist?(@tmpdir)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -111,11 +111,15 @@ module ChefSpec::Matchers
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def matches_parameter?(parameter, expected)
|
114
|
-
|
114
|
+
value = safe_send(parameter)
|
115
115
|
if parameter == :source
|
116
|
-
|
116
|
+
# Chef 11+ stores the source parameter internally as an Array
|
117
|
+
Array(expected) == Array(value)
|
118
|
+
elsif expected.kind_of?(Class)
|
119
|
+
# Ruby can't compare classes with ===
|
120
|
+
expected == value
|
117
121
|
else
|
118
|
-
expected ===
|
122
|
+
expected === value
|
119
123
|
end
|
120
124
|
end
|
121
125
|
|
data/lib/chefspec/renderer.rb
CHANGED
@@ -68,7 +68,7 @@ module ChefSpec
|
|
68
68
|
template_context = Chef::Mixin::Template::TemplateContext.new([])
|
69
69
|
template_context.update({
|
70
70
|
:node => chef_run.node,
|
71
|
-
:template_finder => template_finder(chef_run, cookbook_name),
|
71
|
+
:template_finder => template_finder(chef_run, template.cookbook_name),
|
72
72
|
}.merge(template.variables))
|
73
73
|
if template.respond_to?(:helper_modules) # Chef 11.4+
|
74
74
|
template.helper_modules.each do |helper_module|
|
data/lib/chefspec/rspec.rb
CHANGED
data/lib/chefspec/runner.rb
CHANGED
data/lib/chefspec/server.rb
CHANGED
@@ -152,8 +152,7 @@ module ChefSpec
|
|
152
152
|
|
153
153
|
#
|
154
154
|
# Create a new instance of the +ChefSpec::Server+ singleton. This method
|
155
|
-
# also starts the Chef Zero server in the background
|
156
|
-
# "chefspec".
|
155
|
+
# also starts the Chef Zero server in the background.
|
157
156
|
#
|
158
157
|
def initialize
|
159
158
|
@server = ChefZero::Server.new(
|
@@ -233,12 +232,12 @@ module ChefSpec
|
|
233
232
|
end
|
234
233
|
|
235
234
|
#
|
236
|
-
# The URL where ChefZero is listening
|
235
|
+
# The URL where ChefZero is listening.
|
237
236
|
#
|
238
237
|
# @return [String]
|
239
238
|
#
|
240
239
|
def chef_server_url
|
241
|
-
@chef_server_url ||= File.join(@server.url
|
240
|
+
@chef_server_url ||= File.join(@server.url)
|
242
241
|
end
|
243
242
|
|
244
243
|
#
|
@@ -257,7 +256,6 @@ module ChefSpec
|
|
257
256
|
#
|
258
257
|
def reset!
|
259
258
|
@server.clear_data
|
260
|
-
@server.data_store.create_dir(['organizations'], organization)
|
261
259
|
end
|
262
260
|
|
263
261
|
#
|
@@ -271,15 +269,6 @@ module ChefSpec
|
|
271
269
|
|
272
270
|
private
|
273
271
|
|
274
|
-
#
|
275
|
-
# The name of the Chef organization.
|
276
|
-
#
|
277
|
-
# @return [String]
|
278
|
-
#
|
279
|
-
def organization
|
280
|
-
RSpec.configuration.organization
|
281
|
-
end
|
282
|
-
|
283
272
|
#
|
284
273
|
# The directory where any cache information (such as private keys) should
|
285
274
|
# be stored. This cache is destroyed at the end of the run.
|
@@ -303,7 +292,7 @@ module ChefSpec
|
|
303
292
|
# to the server
|
304
293
|
#
|
305
294
|
def load_data(name, key, data = {})
|
306
|
-
@server.load_data({ key => { name => data } }
|
295
|
+
@server.load_data({ key => { name => data } })
|
307
296
|
end
|
308
297
|
|
309
298
|
#
|
@@ -311,22 +300,12 @@ module ChefSpec
|
|
311
300
|
#
|
312
301
|
def get(*args)
|
313
302
|
if args.size == 1
|
314
|
-
@server.data_store.list(
|
303
|
+
@server.data_store.list(args)
|
315
304
|
else
|
316
|
-
@server.data_store.get(
|
305
|
+
@server.data_store.get(args)
|
317
306
|
end
|
318
307
|
end
|
319
308
|
|
320
|
-
#
|
321
|
-
# Prefix the given args with the organization. This is used by the data
|
322
|
-
# store to fetch elements.
|
323
|
-
#
|
324
|
-
# @return [Array<String>]
|
325
|
-
#
|
326
|
-
def with_organization(*args)
|
327
|
-
['organizations', organization, *args]
|
328
|
-
end
|
329
|
-
|
330
309
|
#
|
331
310
|
# A randomly assigned, open port for run the Chef Zero server.
|
332
311
|
#
|
data/lib/chefspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chefspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Crump
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-06-
|
12
|
+
date: 2014-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef
|