rspec-puppet 5.0.0 → 5.0.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 +8 -0
- data/bin/rspec-puppet-init +1 -1
- data/lib/rspec-puppet/adapters.rb +7 -11
- data/lib/rspec-puppet/consts.rb +6 -6
- data/lib/rspec-puppet/coverage.rb +3 -5
- data/lib/rspec-puppet/example/function_example_group.rb +7 -9
- data/lib/rspec-puppet/example/type_example_group.rb +1 -1
- data/lib/rspec-puppet/matchers/allow_value.rb +1 -1
- data/lib/rspec-puppet/matchers/count_generic.rb +3 -3
- data/lib/rspec-puppet/matchers/create_generic.rb +13 -29
- data/lib/rspec-puppet/matchers/dynamic_matchers.rb +5 -5
- data/lib/rspec-puppet/matchers/raise_error.rb +2 -2
- data/lib/rspec-puppet/matchers/run.rb +1 -1
- data/lib/rspec-puppet/monkey_patches/windows/taskschedulerconstants.rb +2 -2
- data/lib/rspec-puppet/monkey_patches.rb +4 -4
- data/lib/rspec-puppet/setup.rb +1 -1
- data/lib/rspec-puppet/support.rb +14 -22
- data/lib/rspec-puppet/tasks/release_test.rb +1 -1
- data/lib/rspec-puppet/version.rb +1 -1
- metadata +21 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 90c80a0c8b7a303f9e8307598572f6501b91668b325b9ddf297a267ee24ef4d2
|
|
4
|
+
data.tar.gz: f73ec645dd29669a8749e8b8dd12e714109c4e613a4c94acb031524288052ff5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 378d47cb8c9a0c026185218f9925c08c804acf1dd3d417be41d44bc004045d433dcc1b21bc96d36ee16cbebb1508f7033a27aea34e85dc9a7e1e1c0ceb3084f2
|
|
7
|
+
data.tar.gz: 6a96f0c9a10fe84ba051defd74651c945036b5294aba6e0680a3cd1effc6a34981c8c9219c535607f404cefd1bc1d9a79d2a0d0117f481c8c93d678ce1f0dc94
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
|
|
6
6
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).
|
|
7
7
|
|
|
8
|
+
## [v5.0.1](https://github.com/puppetlabs/rspec-puppet/tree/v5.0.1) - 2026-09-03
|
|
9
|
+
|
|
10
|
+
[Full Changelog](https://github.com/puppetlabs/rspec-puppet/compare/v5.0.0...v5.0.1)
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- (CAT-2281) Remove puppet 7 infrastructure [#133](https://github.com/puppetlabs/rspec-puppet/pull/133) ([LukasAud](https://github.com/LukasAud))
|
|
15
|
+
|
|
8
16
|
## [v5.0.0](https://github.com/puppetlabs/rspec-puppet/tree/v5.0.0) - 2024-09-06
|
|
9
17
|
|
|
10
18
|
[Full Changelog](https://github.com/puppetlabs/rspec-puppet/compare/v4.0.2...v5.0.0)
|
data/bin/rspec-puppet-init
CHANGED
|
@@ -53,13 +53,11 @@ module RSpec::Puppet
|
|
|
53
53
|
[puppet_setting, get_setting(example_group, rspec_setting)]
|
|
54
54
|
end.flatten
|
|
55
55
|
default_hash = { confdir: '/dev/null', vardir: '/dev/null' }
|
|
56
|
-
if defined?(Puppet::Test::TestHelper) && Puppet::Test::TestHelper.respond_to?(:app_defaults_for_tests, true)
|
|
57
|
-
default_hash.merge!(Puppet::Test::TestHelper.send(:app_defaults_for_tests))
|
|
58
|
-
end
|
|
56
|
+
default_hash.merge!(Puppet::Test::TestHelper.send(:app_defaults_for_tests)) if defined?(Puppet::Test::TestHelper) && Puppet::Test::TestHelper.respond_to?(:app_defaults_for_tests, true)
|
|
59
57
|
settings_hash = default_hash.merge(Hash[*settings])
|
|
60
58
|
if Gem.win_platform?
|
|
61
59
|
settings_hash.each_with_object(settings_hash) do |(k, v), h|
|
|
62
|
-
h[k] = v == '/dev/null' ? 'c:/nul/' : v
|
|
60
|
+
h[k] = (v == '/dev/null') ? 'c:/nul/' : v
|
|
63
61
|
end
|
|
64
62
|
end
|
|
65
63
|
|
|
@@ -101,9 +99,9 @@ module RSpec::Puppet
|
|
|
101
99
|
{
|
|
102
100
|
environments: loader,
|
|
103
101
|
current_environment: env,
|
|
104
|
-
loaders: Puppet::Pops::Loaders.new(env)
|
|
102
|
+
loaders: Puppet::Pops::Loaders.new(env),
|
|
105
103
|
},
|
|
106
|
-
'Setup rspec-puppet environments'
|
|
104
|
+
'Setup rspec-puppet environments',
|
|
107
105
|
)
|
|
108
106
|
end
|
|
109
107
|
|
|
@@ -119,9 +117,7 @@ module RSpec::Puppet
|
|
|
119
117
|
node.environment = current_environment
|
|
120
118
|
# Override $::environment to workaround PUP-5835, where Puppet otherwise
|
|
121
119
|
# stores a symbol for the parameter
|
|
122
|
-
if node.parameters['environment'] != node.parameters['environment'].to_s
|
|
123
|
-
node.parameters['environment'] = current_environment.name.to_s
|
|
124
|
-
end
|
|
120
|
+
node.parameters['environment'] = current_environment.name.to_s if node.parameters['environment'] != node.parameters['environment'].to_s
|
|
125
121
|
|
|
126
122
|
catalog = if exported
|
|
127
123
|
# Use the compiler directly to skip the filtering done by the indirector
|
|
@@ -148,7 +144,7 @@ module RSpec::Puppet
|
|
|
148
144
|
%i[environmentpath environmentpath],
|
|
149
145
|
%i[hiera_config hiera_config],
|
|
150
146
|
%i[strict_variables strict_variables],
|
|
151
|
-
%i[vendormoduledir vendormoduledir]
|
|
147
|
+
%i[vendormoduledir vendormoduledir],
|
|
152
148
|
]
|
|
153
149
|
end
|
|
154
150
|
|
|
@@ -187,7 +183,7 @@ module RSpec::Puppet
|
|
|
187
183
|
|
|
188
184
|
def self.get
|
|
189
185
|
[
|
|
190
|
-
['7.11', Base]
|
|
186
|
+
['7.11', Base],
|
|
191
187
|
].each do |(version, klass)|
|
|
192
188
|
return klass.new if Puppet::Util::Package.versioncmp(Puppet.version, version) >= 0
|
|
193
189
|
end
|
data/lib/rspec-puppet/consts.rb
CHANGED
|
@@ -5,24 +5,24 @@ module RSpec::Puppet::Consts
|
|
|
5
5
|
posix: {
|
|
6
6
|
'File::PATH_SEPARATOR' => ':',
|
|
7
7
|
'File::ALT_SEPARATOR' => nil,
|
|
8
|
-
'Pathname::SEPARATOR_PAT' => /#{Regexp.quote('/')}
|
|
8
|
+
'Pathname::SEPARATOR_PAT' => /#{Regexp.quote('/')}/,
|
|
9
9
|
},
|
|
10
10
|
windows: {
|
|
11
11
|
'File::PATH_SEPARATOR' => ';',
|
|
12
12
|
'File::ALT_SEPARATOR' => '\\',
|
|
13
|
-
'Pathname::SEPARATOR_PAT' => /[#{Regexp.quote('\\')}#{Regexp.quote('/')}]
|
|
14
|
-
}
|
|
13
|
+
'Pathname::SEPARATOR_PAT' => /[#{Regexp.quote('\\')}#{Regexp.quote('/')}]/,
|
|
14
|
+
},
|
|
15
15
|
}.freeze
|
|
16
16
|
|
|
17
17
|
FEATURES = {
|
|
18
18
|
posix: {
|
|
19
19
|
posix: true,
|
|
20
|
-
microsoft_windows: false
|
|
20
|
+
microsoft_windows: false,
|
|
21
21
|
},
|
|
22
22
|
windows: {
|
|
23
23
|
posix: false,
|
|
24
|
-
microsoft_windows: true
|
|
25
|
-
}
|
|
24
|
+
microsoft_windows: true,
|
|
25
|
+
},
|
|
26
26
|
}.freeze
|
|
27
27
|
|
|
28
28
|
def self.stub_consts_for(platform)
|
|
@@ -232,9 +232,7 @@ module RSpec::Puppet
|
|
|
232
232
|
end
|
|
233
233
|
|
|
234
234
|
# This is not available on RSpec 2.x
|
|
235
|
-
if coverage_results.execution_result.respond_to?(:pending_message)
|
|
236
|
-
coverage_results.execution_result.pending_message = report[:text]
|
|
237
|
-
end
|
|
235
|
+
coverage_results.execution_result.pending_message = report[:text] if coverage_results.execution_result.respond_to?(:pending_message)
|
|
238
236
|
else
|
|
239
237
|
puts "The desired coverage must be 0 <= x <= 100, not '#{coverage_desired.inspect}'"
|
|
240
238
|
end
|
|
@@ -259,7 +257,7 @@ module RSpec::Puppet
|
|
|
259
257
|
text = [
|
|
260
258
|
"Total resources: #{report[:total]}",
|
|
261
259
|
"Touched resources: #{report[:touched]}",
|
|
262
|
-
"Resource coverage: #{report[:coverage]}%"
|
|
260
|
+
"Resource coverage: #{report[:coverage]}%",
|
|
263
261
|
]
|
|
264
262
|
|
|
265
263
|
if (report[:untouched]).positive?
|
|
@@ -341,7 +339,7 @@ module RSpec::Puppet
|
|
|
341
339
|
|
|
342
340
|
def to_hash
|
|
343
341
|
{
|
|
344
|
-
touched: touched
|
|
342
|
+
touched: touched?,
|
|
345
343
|
}
|
|
346
344
|
end
|
|
347
345
|
|
|
@@ -86,7 +86,7 @@ module RSpec::Puppet
|
|
|
86
86
|
|
|
87
87
|
def find_function(function_name = self.class.top_level_description)
|
|
88
88
|
with_vardir do
|
|
89
|
-
|
|
89
|
+
adapter.current_environment
|
|
90
90
|
|
|
91
91
|
context_overrides = compiler.context_overrides
|
|
92
92
|
func = nil
|
|
@@ -99,9 +99,7 @@ module RSpec::Puppet
|
|
|
99
99
|
|
|
100
100
|
return func if func.func
|
|
101
101
|
|
|
102
|
-
if Puppet::Parser::Functions.function(function_name)
|
|
103
|
-
V3FunctionWrapper.new(function_name, scope.method(:"function_#{function_name}"))
|
|
104
|
-
end
|
|
102
|
+
V3FunctionWrapper.new(function_name, scope.method(:"function_#{function_name}")) if Puppet::Parser::Functions.function(function_name)
|
|
105
103
|
end
|
|
106
104
|
end
|
|
107
105
|
|
|
@@ -148,7 +146,7 @@ module RSpec::Puppet
|
|
|
148
146
|
|
|
149
147
|
node_options = {
|
|
150
148
|
parameters: fact_values,
|
|
151
|
-
facts: node_facts
|
|
149
|
+
facts: node_facts,
|
|
152
150
|
}
|
|
153
151
|
|
|
154
152
|
stub_facts! fact_values
|
|
@@ -157,9 +155,9 @@ module RSpec::Puppet
|
|
|
157
155
|
|
|
158
156
|
Puppet.push_context(
|
|
159
157
|
{
|
|
160
|
-
trusted_information: Puppet::Context::TrustedInformation.new('remote', node_name, trusted_values)
|
|
158
|
+
trusted_information: Puppet::Context::TrustedInformation.new('remote', node_name, trusted_values),
|
|
161
159
|
},
|
|
162
|
-
'Context for spec trusted hash'
|
|
160
|
+
'Context for spec trusted hash',
|
|
163
161
|
)
|
|
164
162
|
|
|
165
163
|
compiler = Puppet::Parser::Compiler.new(node)
|
|
@@ -168,9 +166,9 @@ module RSpec::Puppet
|
|
|
168
166
|
Puppet.push_context(
|
|
169
167
|
{
|
|
170
168
|
loaders: loaders,
|
|
171
|
-
global_scope: compiler.context_overrides[:global_scope]
|
|
169
|
+
global_scope: compiler.context_overrides[:global_scope],
|
|
172
170
|
},
|
|
173
|
-
'set globals'
|
|
171
|
+
'set globals',
|
|
174
172
|
)
|
|
175
173
|
compiler
|
|
176
174
|
end
|
|
@@ -28,7 +28,7 @@ module RSpec::Puppet
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def failure_message
|
|
31
|
-
"expected that the type alias would #{description} but it raised the #{@error_msgs.length == 1 ? 'error' : 'errors'} #{@error_msgs.join(', ')}"
|
|
31
|
+
"expected that the type alias would #{description} but it raised the #{(@error_msgs.length == 1) ? 'error' : 'errors'} #{@error_msgs.join(', ')}"
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def failure_message_when_negated
|
|
@@ -6,7 +6,7 @@ module RSpec::Puppet
|
|
|
6
6
|
DEFAULT_RESOURCES = [
|
|
7
7
|
'Class[main]',
|
|
8
8
|
'Class[Settings]',
|
|
9
|
-
'Stage[main]'
|
|
9
|
+
'Stage[main]',
|
|
10
10
|
].freeze
|
|
11
11
|
|
|
12
12
|
attr_reader :resource_type
|
|
@@ -46,10 +46,10 @@ module RSpec::Puppet
|
|
|
46
46
|
|
|
47
47
|
desc << "contain exactly #{@expected_number}"
|
|
48
48
|
if @type == 'class'
|
|
49
|
-
desc << (@expected_number == 1 ? 'class' : 'classes').to_s
|
|
49
|
+
desc << ((@expected_number == 1) ? 'class' : 'classes').to_s
|
|
50
50
|
else
|
|
51
51
|
desc << @resource_type.to_s unless @type == 'resource'
|
|
52
|
-
desc << (@expected_number == 1 ? 'resource' : 'resources').to_s
|
|
52
|
+
desc << ((@expected_number == 1) ? 'resource' : 'resources').to_s
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
desc.join(' ')
|
|
@@ -30,10 +30,10 @@ module RSpec::Puppet
|
|
|
30
30
|
self
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
def only_with(*args, &
|
|
33
|
+
def only_with(*args, &)
|
|
34
34
|
params = args.shift
|
|
35
35
|
@expected_params_count = (@expected_params_count || 0) + params.compact.size
|
|
36
|
-
with(params, &
|
|
36
|
+
with(params, &)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def without(*args)
|
|
@@ -62,7 +62,7 @@ module RSpec::Puppet
|
|
|
62
62
|
self
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
def method_missing(method, *args, &
|
|
65
|
+
def method_missing(method, *args, &)
|
|
66
66
|
case method.to_s
|
|
67
67
|
when /^with_/
|
|
68
68
|
param = method.to_s.gsub(/^with_/, '')
|
|
@@ -83,7 +83,6 @@ module RSpec::Puppet
|
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
def matches?(catalogue)
|
|
86
|
-
ret = true
|
|
87
86
|
@catalogue = catalogue.is_a?(Puppet::Resource::Catalog) ? catalogue : catalogue.call
|
|
88
87
|
resource = @catalogue.resource(@referenced_type, @title)
|
|
89
88
|
|
|
@@ -104,14 +103,9 @@ module RSpec::Puppet
|
|
|
104
103
|
'name'
|
|
105
104
|
end
|
|
106
105
|
|
|
107
|
-
if @expected_params.none? { |param| param.first.to_s == namevar } && rsrc_hsh.key?(namevar.to_sym)
|
|
108
|
-
rsrc_hsh.delete(namevar.to_sym)
|
|
109
|
-
end
|
|
106
|
+
rsrc_hsh.delete(namevar.to_sym) if @expected_params.none? { |param| param.first.to_s == namevar } && rsrc_hsh.key?(namevar.to_sym)
|
|
110
107
|
|
|
111
|
-
if @expected_params_count && rsrc_hsh.size != @expected_params_count
|
|
112
|
-
ret = false
|
|
113
|
-
(@errors ||= []) << "exactly #{@expected_params_count} parameters but the catalogue contains #{rsrc_hsh.size}"
|
|
114
|
-
end
|
|
108
|
+
(@errors ||= []) << "exactly #{@expected_params_count} parameters but the catalogue contains #{rsrc_hsh.size}" if @expected_params_count && rsrc_hsh.size != @expected_params_count
|
|
115
109
|
|
|
116
110
|
check_params(rsrc_hsh, @expected_params, :should) if @expected_params.any?
|
|
117
111
|
check_params(rsrc_hsh, @expected_undef_params, :not) if @expected_undef_params.any?
|
|
@@ -207,12 +201,12 @@ module RSpec::Puppet
|
|
|
207
201
|
output = []
|
|
208
202
|
list.each do |param, value|
|
|
209
203
|
if value.nil?
|
|
210
|
-
output << "#{param} #{type == :not ? 'un' : ''}defined"
|
|
204
|
+
output << "#{param} #{(type == :not) ? 'un' : ''}defined"
|
|
211
205
|
else
|
|
212
|
-
a = type == :not ? '!' : '='
|
|
206
|
+
a = (type == :not) ? '!' : '='
|
|
213
207
|
b = value.is_a?(Regexp) ? '~' : '>'
|
|
214
208
|
output << if (param.to_s == 'content') && value.is_a?(String)
|
|
215
|
-
"#{param} #{type == :not ? 'not ' : ''} supplied string"
|
|
209
|
+
"#{param} #{(type == :not) ? 'not ' : ''} supplied string"
|
|
216
210
|
else
|
|
217
211
|
"#{param} #{a}#{b} #{value.inspect}"
|
|
218
212
|
end
|
|
@@ -223,33 +217,25 @@ module RSpec::Puppet
|
|
|
223
217
|
|
|
224
218
|
def check_befores(_catalogue, resource)
|
|
225
219
|
@befores.each do |ref|
|
|
226
|
-
unless precedes?(resource, canonicalize_resource(ref))
|
|
227
|
-
@errors << BeforeRelationshipError.new(resource.to_ref, ref)
|
|
228
|
-
end
|
|
220
|
+
@errors << BeforeRelationshipError.new(resource.to_ref, ref) unless precedes?(resource, canonicalize_resource(ref))
|
|
229
221
|
end
|
|
230
222
|
end
|
|
231
223
|
|
|
232
224
|
def check_requires(_catalogue, resource)
|
|
233
225
|
@requires.each do |ref|
|
|
234
|
-
unless precedes?(canonicalize_resource(ref), resource)
|
|
235
|
-
@errors << RequireRelationshipError.new(resource.to_ref, ref)
|
|
236
|
-
end
|
|
226
|
+
@errors << RequireRelationshipError.new(resource.to_ref, ref) unless precedes?(canonicalize_resource(ref), resource)
|
|
237
227
|
end
|
|
238
228
|
end
|
|
239
229
|
|
|
240
230
|
def check_notifies(_catalogue, resource)
|
|
241
231
|
@notifies.each do |ref|
|
|
242
|
-
unless notifies?(resource, canonicalize_resource(ref))
|
|
243
|
-
@errors << NotifyRelationshipError.new(resource.to_ref, ref)
|
|
244
|
-
end
|
|
232
|
+
@errors << NotifyRelationshipError.new(resource.to_ref, ref) unless notifies?(resource, canonicalize_resource(ref))
|
|
245
233
|
end
|
|
246
234
|
end
|
|
247
235
|
|
|
248
236
|
def check_subscribes(_catalogue, resource)
|
|
249
237
|
@subscribes.each do |ref|
|
|
250
|
-
unless notifies?(canonicalize_resource(ref), resource)
|
|
251
|
-
@errors << SubscribeRelationshipError.new(resource.to_ref, ref)
|
|
252
|
-
end
|
|
238
|
+
@errors << SubscribeRelationshipError.new(resource.to_ref, ref) unless notifies?(canonicalize_resource(ref), resource)
|
|
253
239
|
end
|
|
254
240
|
end
|
|
255
241
|
|
|
@@ -334,9 +320,7 @@ module RSpec::Puppet
|
|
|
334
320
|
before_refs = relationship_refs(u, :before) + relationship_refs(u, :notify)
|
|
335
321
|
require_refs = relationship_refs(v, :require) + relationship_refs(u, :subscribe)
|
|
336
322
|
|
|
337
|
-
if before_refs.include?(v.to_ref) || require_refs.include?(u.to_ref) || (
|
|
338
|
-
return true
|
|
339
|
-
end
|
|
323
|
+
return true if before_refs.include?(v.to_ref) || require_refs.include?(u.to_ref) || before_refs.intersect?(require_refs)
|
|
340
324
|
end
|
|
341
325
|
end
|
|
342
326
|
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
module RSpec::Puppet
|
|
4
4
|
module ManifestMatchers
|
|
5
|
-
def method_missing(method, *args, &
|
|
5
|
+
def method_missing(method, *args, &)
|
|
6
6
|
if /^(create|contain)_/.match?(method.to_s)
|
|
7
7
|
return RSpec::Puppet::ManifestMatchers::CreateGeneric.new(method, *args,
|
|
8
|
-
&
|
|
8
|
+
&)
|
|
9
9
|
end
|
|
10
10
|
if /^have_.+_count$/.match?(method.to_s)
|
|
11
11
|
return RSpec::Puppet::ManifestMatchers::CountGeneric.new(nil, args[0],
|
|
@@ -18,7 +18,7 @@ module RSpec::Puppet
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
module FunctionMatchers
|
|
21
|
-
def method_missing(method, *args, &
|
|
21
|
+
def method_missing(method, *args, &)
|
|
22
22
|
return RSpec::Puppet::FunctionMatchers::Run.new if method == :run
|
|
23
23
|
|
|
24
24
|
super
|
|
@@ -26,8 +26,8 @@ module RSpec::Puppet
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
module TypeMatchers
|
|
29
|
-
def method_missing(method,
|
|
30
|
-
return RSpec::Puppet::TypeMatchers::CreateGeneric.new(method,
|
|
29
|
+
def method_missing(method, ...)
|
|
30
|
+
return RSpec::Puppet::TypeMatchers::CreateGeneric.new(method, ...) if method == :be_valid_type
|
|
31
31
|
|
|
32
32
|
super
|
|
33
33
|
end
|
|
@@ -19,9 +19,9 @@ module RSpec::Puppet
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def raise_error(
|
|
22
|
-
error = defined?(RSpec::Matchers::BuiltIn::RaiseError::UndefinedValue) ? RSpec::Matchers::BuiltIn::RaiseError::UndefinedValue : nil, message = nil, &
|
|
22
|
+
error = defined?(RSpec::Matchers::BuiltIn::RaiseError::UndefinedValue) ? RSpec::Matchers::BuiltIn::RaiseError::UndefinedValue : nil, message = nil, &
|
|
23
23
|
)
|
|
24
|
-
RaiseError.new(error, message, &
|
|
24
|
+
RaiseError.new(error, message, &)
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
end
|
|
@@ -143,7 +143,7 @@ module RSpec::Puppet
|
|
|
143
143
|
|
|
144
144
|
def failure_message_generic(type, _func_obj)
|
|
145
145
|
# message is mutable
|
|
146
|
-
message =
|
|
146
|
+
message = "expected #{func_name}(#{func_params}) to "
|
|
147
147
|
message << 'not ' if type == :should_not
|
|
148
148
|
|
|
149
149
|
if @has_expected_return
|
|
@@ -5,7 +5,7 @@ module RSpec
|
|
|
5
5
|
module Windows
|
|
6
6
|
module TaskSchedulerConstants
|
|
7
7
|
SYSTEM_USERS = ['NT AUTHORITY\SYSTEM', 'SYSTEM', 'NT AUTHORITY\LOCALSERVICE', 'NT AUTHORITY\NETWORKSERVICE',
|
|
8
|
-
'BUILTIN\USERS', 'USERS'].freeze
|
|
8
|
+
'BUILTIN\USERS', 'USERS',].freeze
|
|
9
9
|
|
|
10
10
|
# Triggers
|
|
11
11
|
|
|
@@ -221,7 +221,7 @@ module RSpec
|
|
|
221
221
|
CLSCTX_INPROC_SERVER = 0x1
|
|
222
222
|
CLSID_CTask = [0x148BD520, 0xA2AB, 0x11CE, 0xB1, 0x1F, 0x00, 0xAA, 0x00, 0x53, 0x05, 0x03].pack('LSSC8')
|
|
223
223
|
CLSID_CTaskScheduler = [0x148BD52A, 0xA2AB, 0x11CE, 0xB1, 0x1F, 0x00, 0xAA, 0x00, 0x53, 0x05,
|
|
224
|
-
0x03].pack('LSSC8')
|
|
224
|
+
0x03,].pack('LSSC8')
|
|
225
225
|
IID_ITaskScheduler = [0x148BD527, 0xA2AB, 0x11CE, 0xB1, 0x1F, 0x00, 0xAA, 0x00, 0x53, 0x05, 0x03].pack('LSSC8')
|
|
226
226
|
IID_ITask = [0x148BD524, 0xA2AB, 0x11CE, 0xB1, 0x1F, 0x00, 0xAA, 0x00, 0x53, 0x05, 0x03].pack('LSSC8')
|
|
227
227
|
IID_IPersistFile = [0x0000010b, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46].pack('LSSC8')
|
|
@@ -175,7 +175,7 @@ module Puppet
|
|
|
175
175
|
module_function :windows?
|
|
176
176
|
|
|
177
177
|
def actual_platform
|
|
178
|
-
@actual_platform ||= !!File::ALT_SEPARATOR ? :windows : :posix
|
|
178
|
+
@actual_platform ||= (!!File::ALT_SEPARATOR) ? :windows : :posix
|
|
179
179
|
end
|
|
180
180
|
module_function :actual_platform
|
|
181
181
|
|
|
@@ -366,7 +366,7 @@ end
|
|
|
366
366
|
# defined. This check only makes sense when applying the catalogue to a host
|
|
367
367
|
# and so can be safely stubbed out for unit testing.
|
|
368
368
|
Puppet::Type.type(:file).provide(:windows).class_eval do
|
|
369
|
-
|
|
369
|
+
instance_method(:supports_acl?) if respond_to?(:supports_acl?)
|
|
370
370
|
|
|
371
371
|
def supports_acl?(_path)
|
|
372
372
|
if RSpec::Puppet.rspec_puppet_example?
|
|
@@ -376,7 +376,7 @@ Puppet::Type.type(:file).provide(:windows).class_eval do
|
|
|
376
376
|
end
|
|
377
377
|
end
|
|
378
378
|
|
|
379
|
-
|
|
379
|
+
instance_method(:manages_symlinks?) if respond_to?(:manages_symlinks?)
|
|
380
380
|
|
|
381
381
|
def manages_symlinks?
|
|
382
382
|
if RSpec::Puppet.rspec_puppet_example?
|
|
@@ -394,7 +394,7 @@ module Kernel
|
|
|
394
394
|
alias old_require require
|
|
395
395
|
def require(path)
|
|
396
396
|
return if ['puppet/util/windows',
|
|
397
|
-
'win32/registry'].include?(path) && RSpec::Puppet.rspec_puppet_example? && Puppet::Util::Platform.pretend_windows?
|
|
397
|
+
'win32/registry',].include?(path) && RSpec::Puppet.rspec_puppet_example? && Puppet::Util::Platform.pretend_windows?
|
|
398
398
|
|
|
399
399
|
old_require(path)
|
|
400
400
|
end
|
data/lib/rspec-puppet/setup.rb
CHANGED
|
@@ -55,7 +55,7 @@ module RSpec::Puppet
|
|
|
55
55
|
File.join('spec', 'hosts'),
|
|
56
56
|
File.join('spec', 'fixtures'),
|
|
57
57
|
File.join('spec', 'fixtures', 'manifests'),
|
|
58
|
-
File.join('spec', 'fixtures', 'modules')
|
|
58
|
+
File.join('spec', 'fixtures', 'modules'),
|
|
59
59
|
].each { |dir| safe_mkdir(dir, verbose) }
|
|
60
60
|
|
|
61
61
|
target = File.join('spec', 'fixtures', 'modules', module_name)
|
data/lib/rspec-puppet/support.rb
CHANGED
|
@@ -102,11 +102,11 @@ module RSpec::Puppet
|
|
|
102
102
|
trusted_external_data: trusted_external_data_hash,
|
|
103
103
|
ignored_cache_params: {
|
|
104
104
|
hiera_data_value: hiera_data_value,
|
|
105
|
-
rspec_config_values: rspec_config_values
|
|
106
|
-
}
|
|
105
|
+
rspec_config_values: rspec_config_values,
|
|
106
|
+
},
|
|
107
107
|
)
|
|
108
108
|
|
|
109
|
-
test_module = type == :host ? nil : class_name.split('::').first
|
|
109
|
+
test_module = (type == :host) ? nil : class_name.split('::').first
|
|
110
110
|
if type == :define
|
|
111
111
|
RSpec::Puppet::Coverage.add_filter(class_name, title)
|
|
112
112
|
else
|
|
@@ -128,7 +128,7 @@ module RSpec::Puppet
|
|
|
128
128
|
File.read(path)
|
|
129
129
|
elsif File.directory?(path)
|
|
130
130
|
# Read and concatenate all .pp files.
|
|
131
|
-
Dir[File.join(path, '*.pp')].
|
|
131
|
+
Dir[File.join(path, '*.pp')].map do |f|
|
|
132
132
|
File.read(f)
|
|
133
133
|
end.join("\n")
|
|
134
134
|
else
|
|
@@ -205,14 +205,14 @@ module RSpec::Puppet
|
|
|
205
205
|
def facts_hash(node)
|
|
206
206
|
base_facts = {
|
|
207
207
|
'clientversion' => Puppet::PUPPETVERSION,
|
|
208
|
-
'environment' => environment.to_s
|
|
208
|
+
'environment' => environment.to_s,
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
node_facts = {
|
|
212
212
|
'hostname' => node.split('.').first,
|
|
213
213
|
'fqdn' => node,
|
|
214
214
|
'domain' => node.split('.', 2).last,
|
|
215
|
-
'clientcert' => node
|
|
215
|
+
'clientcert' => node,
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
# Puppet 6.9.0 started setting a `serverip6` server fact which is set
|
|
@@ -220,14 +220,12 @@ module RSpec::Puppet
|
|
|
220
220
|
# by FacterDB don't have an `ipaddress6` fact set, then the normal Facter
|
|
221
221
|
# fact will be resolved, which can result in Ruby trying to load Windows
|
|
222
222
|
# only gems on Linux. This is only a problem if facter is used.
|
|
223
|
-
if RSpec.configuration.facter_implementation.to_sym == :facter
|
|
224
|
-
node_facts['ipaddress6'] = 'FE80:0000:0000:0000:AAAA:AAAA:AAAA'
|
|
225
|
-
end
|
|
223
|
+
node_facts['ipaddress6'] = 'FE80:0000:0000:0000:AAAA:AAAA:AAAA' if RSpec.configuration.facter_implementation.to_sym == :facter
|
|
226
224
|
|
|
227
225
|
networking_facts = {
|
|
228
226
|
'hostname' => node_facts['hostname'],
|
|
229
227
|
'fqdn' => node_facts['fqdn'],
|
|
230
|
-
'domain' => node_facts['domain']
|
|
228
|
+
'domain' => node_facts['domain'],
|
|
231
229
|
}
|
|
232
230
|
|
|
233
231
|
result_facts = if RSpec.configuration.default_facts.any?
|
|
@@ -275,9 +273,7 @@ module RSpec::Puppet
|
|
|
275
273
|
def trusted_facts_hash(_node_name)
|
|
276
274
|
extensions = {}
|
|
277
275
|
|
|
278
|
-
if RSpec.configuration.default_trusted_facts.any?
|
|
279
|
-
extensions.merge!(munge_facts(RSpec.configuration.default_trusted_facts))
|
|
280
|
-
end
|
|
276
|
+
extensions.merge!(munge_facts(RSpec.configuration.default_trusted_facts)) if RSpec.configuration.default_trusted_facts.any?
|
|
281
277
|
|
|
282
278
|
extensions.merge!(munge_facts(trusted_facts)) if respond_to?(:trusted_facts)
|
|
283
279
|
extensions
|
|
@@ -286,9 +282,7 @@ module RSpec::Puppet
|
|
|
286
282
|
def trusted_external_data_hash
|
|
287
283
|
external_data = {}
|
|
288
284
|
|
|
289
|
-
if RSpec.configuration.default_trusted_external_data.any?
|
|
290
|
-
external_data.merge!(munge_facts(RSpec.configuration.default_trusted_external_data))
|
|
291
|
-
end
|
|
285
|
+
external_data.merge!(munge_facts(RSpec.configuration.default_trusted_external_data)) if RSpec.configuration.default_trusted_external_data.any?
|
|
292
286
|
|
|
293
287
|
external_data.merge!(munge_facts(trusted_external_data)) if respond_to?(:trusted_external_data)
|
|
294
288
|
external_data
|
|
@@ -381,7 +375,7 @@ module RSpec::Puppet
|
|
|
381
375
|
code: code,
|
|
382
376
|
exported: exported,
|
|
383
377
|
node_params: node_params,
|
|
384
|
-
trusted_external: {}
|
|
378
|
+
trusted_external: {},
|
|
385
379
|
})
|
|
386
380
|
end
|
|
387
381
|
|
|
@@ -421,9 +415,9 @@ module RSpec::Puppet
|
|
|
421
415
|
trusted_info.push(trusted_external_data)
|
|
422
416
|
Puppet.push_context(
|
|
423
417
|
{
|
|
424
|
-
trusted_information: Puppet::Context::TrustedInformation.new(*trusted_info)
|
|
418
|
+
trusted_information: Puppet::Context::TrustedInformation.new(*trusted_info),
|
|
425
419
|
},
|
|
426
|
-
'Context for spec trusted hash'
|
|
420
|
+
'Context for spec trusted hash',
|
|
427
421
|
)
|
|
428
422
|
|
|
429
423
|
node_obj.add_server_facts(server_facts_hash)
|
|
@@ -476,9 +470,7 @@ module RSpec::Puppet
|
|
|
476
470
|
Find.prune if %w[modules work-dir].any? do |dir|
|
|
477
471
|
file.relative_path_from(path).to_s.start_with?("spec/fixtures/#{dir}")
|
|
478
472
|
end
|
|
479
|
-
if file.basename.to_s.eql?(Puppet::Pops::Lookup::HieraConfig::CONFIG_FILE_NAME)
|
|
480
|
-
return @@fixture_hiera_configs[mod.name] = file.to_s
|
|
481
|
-
end
|
|
473
|
+
return @@fixture_hiera_configs[mod.name] = file.to_s if file.basename.to_s.eql?(Puppet::Pops::Lookup::HieraConfig::CONFIG_FILE_NAME)
|
|
482
474
|
end
|
|
483
475
|
end
|
|
484
476
|
@@fixture_hiera_configs[mod.name]
|
data/lib/rspec-puppet/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-puppet
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.0.
|
|
4
|
+
version: 5.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tim Sharpe
|
|
8
8
|
- Puppet, Inc.
|
|
9
9
|
- Community Contributors
|
|
10
|
-
autorequire:
|
|
10
|
+
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2026-09-03 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rspec
|
|
@@ -26,6 +26,20 @@ dependencies:
|
|
|
26
26
|
- - "~>"
|
|
27
27
|
- !ruby/object:Gem::Version
|
|
28
28
|
version: '3.0'
|
|
29
|
+
- !ruby/object:Gem::Dependency
|
|
30
|
+
name: voxpupuli-rubocop
|
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
|
32
|
+
requirements:
|
|
33
|
+
- - "~>"
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: 3.0.0
|
|
36
|
+
type: :development
|
|
37
|
+
prerelease: false
|
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
39
|
+
requirements:
|
|
40
|
+
- - "~>"
|
|
41
|
+
- !ruby/object:Gem::Version
|
|
42
|
+
version: 3.0.0
|
|
29
43
|
description: " RSpec tests for your Puppet manifests.\n"
|
|
30
44
|
email:
|
|
31
45
|
- tim@sharpe.id.au
|
|
@@ -82,7 +96,7 @@ homepage: https://github.com/puppetlabs/rspec-puppet/
|
|
|
82
96
|
licenses:
|
|
83
97
|
- MIT
|
|
84
98
|
metadata: {}
|
|
85
|
-
post_install_message:
|
|
99
|
+
post_install_message:
|
|
86
100
|
rdoc_options: []
|
|
87
101
|
require_paths:
|
|
88
102
|
- lib
|
|
@@ -90,15 +104,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
90
104
|
requirements:
|
|
91
105
|
- - ">="
|
|
92
106
|
- !ruby/object:Gem::Version
|
|
93
|
-
version:
|
|
107
|
+
version: 3.1.0
|
|
94
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
109
|
requirements:
|
|
96
110
|
- - ">="
|
|
97
111
|
- !ruby/object:Gem::Version
|
|
98
112
|
version: '0'
|
|
99
113
|
requirements: []
|
|
100
|
-
rubygems_version: 3.
|
|
101
|
-
signing_key:
|
|
114
|
+
rubygems_version: 3.4.19
|
|
115
|
+
signing_key:
|
|
102
116
|
specification_version: 4
|
|
103
117
|
summary: RSpec tests for your Puppet manifests
|
|
104
118
|
test_files: []
|