rspec-puppet 2.11.0 → 2.12.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a8f890c54b412a4d326895c3c3cd0ecae65f915049c69b9cb75c0a5c2811365
4
- data.tar.gz: 39407acdeb509d98797e23cdcb7e71c378d89186039538fba4cc25c6c1eb0bf1
3
+ metadata.gz: c0983cc8fe444bc2035b1e58df39027ab7589cbeae175ace159a384dea8ef2cf
4
+ data.tar.gz: 8d91008e48102d7053911236a0173daa8daf64e94274a5f6046a45656770c8fa
5
5
  SHA512:
6
- metadata.gz: 1105e0778581b90855d2d43511b1016cd0193fb088c0b4fbe7bf8de4947e3043a6a005bf1894fed0ac9fbdf87b283b9075997f47c2530ba82038db9c23d43e2f
7
- data.tar.gz: 719205730a4e0f4bd0b17378872e134de10eedf3e623f9584aaf85577665033ea36d393d5a3619a0b5eb9fd091530bc6071d394291d7d48094aad11d00836585
6
+ metadata.gz: 5c2a790b3d4e4f7dc14dce67ba3c1e2c635534962acfa8523390aa2b07389c216c7ffb1cbddccd5ebd0e627372267dad4f07c59293e5fd36ce3d659b9d0c35bd
7
+ data.tar.gz: 7c9d11d0c5047af4ad2dd7a7743c2e5ff341257f9f2036beabd4b23a88294bf22e8d7e282f1a95cef230a66e7b6e5e5f2c429fb95a265116dd341bc38698aaa7
data/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
  All notable changes to this project will be documented in this file. This
3
3
  project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [2.12.0]
6
+
7
+ ### Added
8
+ * Handle nil autorequire results ([#22](https://github.com/puppetlabs/rspec-puppet/pull/22))
9
+ * Add the ability to use kind_of matchers ([#24](https://github.com/puppetlabs/rspec-puppet/pull/24))
10
+
11
+ ## [2.11.1]
12
+
13
+ ### Fixed
14
+ * Ensure FacterImpl consistency between example groups ([#19](https://github.com/puppetlabs/rspec-puppet/pull/19))
15
+
5
16
  ## [2.11.0]
6
17
 
7
18
  ### Added
@@ -565,7 +576,8 @@ Thanks to Adrien Thebo, Alex Harvey, Brian, Dan Bode, Dominic Cleal, Javier Pala
565
576
  ## 1.0.1 and earlier
566
577
  For changelog of versions 1.0.1 and earlier, see http://rspec-puppet.com/changelog/
567
578
 
568
- [2.x]: https://github.com/puppetlabs/rspec-puppet/compare/v2.11.0...master
579
+ [2.x]: https://github.com/puppetlabs/rspec-puppet/compare/v2.11.1...master
580
+ [2.11.1]: https://github.com/puppetlabs/rspec-puppet/compare/v2.11.0..v2.11.1
569
581
  [2.11.0]: https://github.com/puppetlabs/rspec-puppet/compare/v2.10.0...v2.11.0
570
582
  [2.10.0]: https://github.com/puppetlabs/rspec-puppet/compare/v2.9.0...v2.10.0
571
583
  [2.9.0]: https://github.com/puppetlabs/rspec-puppet/compare/v2.8.0...v2.9.0
@@ -113,12 +113,16 @@ module RSpec::Puppet
113
113
  #
114
114
  # @api private
115
115
  #
116
- # Set the FacterImpl constant to the given Facter implementation.
117
- # The method noops if the constant is already set
116
+ # Set the FacterImpl constant to the given Facter implementation or noop
117
+ # if the constant is already set. If a proc is given, it will only be
118
+ # called if FacterImpl is not defined.
118
119
  #
119
- # @param impl [Object]
120
+ # @param impl [Object, Proc] An object or a proc that implements the Facter API
120
121
  def set_facter_impl(impl)
121
- Object.send(:const_set, :FacterImpl, impl) unless defined? FacterImpl
122
+ return if defined?(FacterImpl)
123
+
124
+ impl = impl.call if impl.is_a?(Proc)
125
+ Object.send(:const_set, :FacterImpl, impl)
122
126
  end
123
127
 
124
128
  def setup_puppet(example_group)
@@ -237,11 +241,13 @@ module RSpec::Puppet
237
241
  case RSpec.configuration.facter_implementation.to_sym
238
242
  when :rspec
239
243
  if supports_facter_runtime?
240
- Puppet.runtime[:facter] = proc { RSpec::Puppet::FacterTestImpl.new }
241
- set_facter_impl(Puppet.runtime[:facter])
244
+ # Lazily instantiate FacterTestImpl here to optimize memory
245
+ # allocation, as the proc will only be called if FacterImpl is unset
246
+ set_facter_impl(proc { RSpec::Puppet::FacterTestImpl.new })
247
+ Puppet.runtime[:facter] = FacterImpl
242
248
  else
243
249
  warn "Facter runtime implementations are not supported in Puppet #{Puppet.version}, continuing with facter_implementation 'facter'"
244
- RSpec.configuration.facter_implementation = 'facter'
250
+ RSpec.configuration.facter_implementation = :facter
245
251
  set_facter_impl(Facter)
246
252
  end
247
253
  when :facter
@@ -313,6 +313,8 @@ module RSpec::Puppet
313
313
  if resource.resource_type.respond_to?(func)
314
314
  resource.resource_type.send(func) do |t, b|
315
315
  Array(resource.to_ral.instance_eval(&b)).each do |dep|
316
+ next if dep.nil?
317
+
316
318
  res = "#{t.to_s.capitalize}[#{dep}]"
317
319
  if r = relationship_refs(res, type, visited)
318
320
  results << res
@@ -35,6 +35,8 @@ module RSpec::Puppet
35
35
  case @expected_return
36
36
  when Regexp
37
37
  return !!(@actual_return =~ @expected_return)
38
+ when RSpec::Mocks::ArgumentMatchers::KindOf, RSpec::Matchers::AliasedMatcher
39
+ return @expected_return === @actual_return
38
40
  else
39
41
  return @actual_return == @expected_return
40
42
  end
data/lib/rspec-puppet.rb CHANGED
@@ -43,7 +43,7 @@ RSpec.configure do |c|
43
43
  c.add_setting :default_node_params, :default => {}
44
44
  c.add_setting :default_trusted_facts, :default => {}
45
45
  c.add_setting :default_trusted_external_data, :default => {}
46
- c.add_setting :facter_implementation, :default => 'facter'
46
+ c.add_setting :facter_implementation, :default => :facter
47
47
  c.add_setting :hiera_config, :default => Puppet::Util::Platform.actually_windows? ? 'c:/nul/' : '/dev/null'
48
48
  c.add_setting :parser, :default => 'current'
49
49
  c.add_setting :trusted_node_data, :default => false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.0
4
+ version: 2.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Sharpe
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-11-10 00:00:00.000000000 Z
13
+ date: 2022-07-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -96,8 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  requirements: []
99
- rubyforge_project:
100
- rubygems_version: 2.7.6.2
99
+ rubygems_version: 3.1.6
101
100
  signing_key:
102
101
  specification_version: 4
103
102
  summary: RSpec tests for your Puppet manifests