rspec-puppet 2.11.0 → 2.11.1

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
2
  SHA256:
3
- metadata.gz: 7a8f890c54b412a4d326895c3c3cd0ecae65f915049c69b9cb75c0a5c2811365
4
- data.tar.gz: 39407acdeb509d98797e23cdcb7e71c378d89186039538fba4cc25c6c1eb0bf1
3
+ metadata.gz: 841a21438e7d3927a8f136334b6ad6a189b1efa8e144eac94a55675d1a106cd1
4
+ data.tar.gz: fa95877eeb75e96db41ffc7025cc316de449884f7c1711d8ea0d5d6ae37d34d3
5
5
  SHA512:
6
- metadata.gz: 1105e0778581b90855d2d43511b1016cd0193fb088c0b4fbe7bf8de4947e3043a6a005bf1894fed0ac9fbdf87b283b9075997f47c2530ba82038db9c23d43e2f
7
- data.tar.gz: 719205730a4e0f4bd0b17378872e134de10eedf3e623f9584aaf85577665033ea36d393d5a3619a0b5eb9fd091530bc6071d394291d7d48094aad11d00836585
6
+ metadata.gz: 51981b62e91d5fe7be774b715215965216b118c87ef2d6f79e941dcfe961e113e38dec4adc88ddd6e042d7efdb3c333e493dc779c3bea842bd163d1d7f711c76
7
+ data.tar.gz: f0297af0f3738a0fc0ba1c8f69e18951839f46e70d5f4132c9d414b71f1ead89632a9a0aa8a0ef277cb06ccd530777564bd2cd4e68ab22d21f98bb32ab8b5c15
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
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.11.1]
6
+
7
+ ### Fixed
8
+ * Ensure FacterImpl consistency between example groups ([#19](https://github.com/puppetlabs/rspec-puppet/pull/19))
9
+
5
10
  ## [2.11.0]
6
11
 
7
12
  ### Added
@@ -565,7 +570,8 @@ Thanks to Adrien Thebo, Alex Harvey, Brian, Dan Bode, Dominic Cleal, Javier Pala
565
570
  ## 1.0.1 and earlier
566
571
  For changelog of versions 1.0.1 and earlier, see http://rspec-puppet.com/changelog/
567
572
 
568
- [2.x]: https://github.com/puppetlabs/rspec-puppet/compare/v2.11.0...master
573
+ [2.x]: https://github.com/puppetlabs/rspec-puppet/compare/v2.11.1...master
574
+ [2.11.1]: https://github.com/puppetlabs/rspec-puppet/compare/v2.11.0..v2.11.1
569
575
  [2.11.0]: https://github.com/puppetlabs/rspec-puppet/compare/v2.10.0...v2.11.0
570
576
  [2.10.0]: https://github.com/puppetlabs/rspec-puppet/compare/v2.9.0...v2.10.0
571
577
  [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
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.11.1
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: 2021-12-10 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