chefspec 7.3.0 → 7.3.1
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/CHANGELOG.md +4 -0
- data/examples/spec_attributes/spec/default_spec.rb +9 -0
- data/lib/chefspec/api/core.rb +37 -15
- data/lib/chefspec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e61ac80763278adaab322cc1801df9673c5ea2d49df59bc7c26977a9e3405923
|
4
|
+
data.tar.gz: e64079926befe6e129ebfa265f9aa3c9c942f628ea8365cf5bd627ecb09c25ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 014e1bbaa47b6a88e6cb5f488d5ea25ff012694c0f7f97d18c12048d7377a9f204cb114ff9e68c7e4d4a575293bed12cc432ac623f516028db48c72cb090dfb8
|
7
|
+
data.tar.gz: e7d54267e71d29d6fb57a1518d38ba4df4959fc6e49b967dc9860f2dbaedc39fcb12fb15704846b544daf3d017514a91ff7526849d1b13bc1869f4f193b84d06
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# CHANGELOG for ChefSpec
|
2
2
|
|
3
|
+
## 7.3.1 (September 1, 2018)
|
4
|
+
|
5
|
+
- Add additional hooks for customizing the runner creation process.
|
6
|
+
|
3
7
|
## 7.3.0 (August 30, 2018)
|
4
8
|
|
5
9
|
- Major syntax overhaul and update. Check out the [README](/README.md) for examples of the updated syntax. The older syntax is still present and will be supported at least until ChefSpec 8.0, but documentation has been moved to [README_old](/README_old.md).
|
@@ -51,4 +51,13 @@ describe 'spec_attributes' do
|
|
51
51
|
it { is_expected.to write_log('thing1=un thing2=two version=3.0') }
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
context 'before attributes' do
|
56
|
+
before do
|
57
|
+
chefspec_default_attributes['myapp'] ||= {}
|
58
|
+
chefspec_default_attributes['myapp']['version'] = '4.0'
|
59
|
+
end
|
60
|
+
|
61
|
+
it { is_expected.to write_log('version=4.0') }
|
62
|
+
end
|
54
63
|
end
|
data/lib/chefspec/api/core.rb
CHANGED
@@ -14,27 +14,33 @@ module ChefSpec
|
|
14
14
|
# Only run the preload if a platform is configured via the new system
|
15
15
|
# since otherwise it will spam warnings about the platform not being
|
16
16
|
# set.
|
17
|
-
|
17
|
+
chef_runner_instance.preload! if chefspec_platform
|
18
18
|
ex.run
|
19
19
|
ensure
|
20
20
|
$CHEFSPEC_MODE = old_chefspec_mode
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
# Let variables to set
|
24
|
+
# Let variables to set data in a scoped way. Used below by
|
25
25
|
# {ClassMethods#platform}.
|
26
|
+
let(:chefspec_default_attributes) { chefspec_attributes(:default_attributes) }
|
27
|
+
let(:chefspec_normal_attributes) { chefspec_attributes(:normal_attributes) }
|
28
|
+
let(:chefspec_override_attributes) { chefspec_attributes(:override_attributes) }
|
29
|
+
let(:chefspec_automatic_attributes) { chefspec_attributes(:automatic_attributes) }
|
26
30
|
let(:chefspec_platform) { nil }
|
27
31
|
let(:chefspec_platform_version) { nil }
|
28
32
|
|
29
|
-
#
|
30
|
-
#
|
31
|
-
|
33
|
+
# Compute the options for the runner.
|
34
|
+
#
|
35
|
+
# @abstract
|
36
|
+
# @return [Hash<Symbol, Object>]
|
37
|
+
def chef_runner_options
|
32
38
|
options = {
|
33
39
|
step_into: chefspec_ancestor_gather([], :step_into) {|memo, val| memo | val },
|
34
|
-
default_attributes:
|
35
|
-
normal_attributes:
|
36
|
-
override_attributes:
|
37
|
-
automatic_attributes:
|
40
|
+
default_attributes: chefspec_default_attributes,
|
41
|
+
normal_attributes: chefspec_normal_attributes,
|
42
|
+
override_attributes: chefspec_override_attributes,
|
43
|
+
automatic_attributes: chefspec_automatic_attributes,
|
38
44
|
spec_declaration_locations: self.class.declaration_locations.last[0],
|
39
45
|
}
|
40
46
|
# Only specify these if set in the example so we don't override the
|
@@ -43,16 +49,32 @@ module ChefSpec
|
|
43
49
|
options[:version] = chefspec_platform_version if chefspec_platform_version
|
44
50
|
# Merge in any final overrides.
|
45
51
|
options.update(chefspec_attributes(:chefspec_options).symbolize_keys)
|
46
|
-
|
47
|
-
# because someone will complain.
|
48
|
-
ChefSpec::SoloRunner.new(options)
|
52
|
+
options
|
49
53
|
end
|
50
54
|
|
51
|
-
#
|
52
|
-
|
53
|
-
|
55
|
+
# Class of runner to use.
|
56
|
+
#
|
57
|
+
# @abstract
|
58
|
+
# @return [Class]
|
59
|
+
def chef_runner_class
|
60
|
+
ChefSpec::SoloRunner
|
61
|
+
end
|
62
|
+
|
63
|
+
# Create an instance of the runner.
|
64
|
+
#
|
65
|
+
# This should only be used in cases where the `let()` cache would be a problem.
|
66
|
+
#
|
67
|
+
# @return [ChefSpec::SoloRunner]
|
68
|
+
def chef_runner_instance
|
69
|
+
chef_runner_class.new(chef_runner_options)
|
54
70
|
end
|
55
71
|
|
72
|
+
# Set up the runner object but don't actually run anything yet.
|
73
|
+
let(:chef_runner) { chef_runner_instance }
|
74
|
+
|
75
|
+
# By default, run the recipe in the base `describe` block.
|
76
|
+
let(:chef_run) { chef_runner.converge(described_recipe) }
|
77
|
+
|
56
78
|
# Helper method for some of the nestable test value methods like
|
57
79
|
# {ClassMethods#default_attributes} and {ClassMethods#step_into}.
|
58
80
|
#
|
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: 7.3.
|
4
|
+
version: 7.3.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: 2018-
|
12
|
+
date: 2018-09-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef
|