rspec-puppet 2.12.0 → 3.0.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +139 -483
  3. data/README.md +18 -5
  4. data/bin/rspec-puppet-init +4 -3
  5. data/lib/rspec-puppet/adapters.rb +67 -61
  6. data/lib/rspec-puppet/cache.rb +3 -2
  7. data/lib/rspec-puppet/consts.rb +16 -14
  8. data/lib/rspec-puppet/coverage.rb +37 -42
  9. data/lib/rspec-puppet/errors.rb +6 -6
  10. data/lib/rspec-puppet/example/application_example_group.rb +3 -1
  11. data/lib/rspec-puppet/example/class_example_group.rb +3 -1
  12. data/lib/rspec-puppet/example/define_example_group.rb +3 -1
  13. data/lib/rspec-puppet/example/function_example_group.rb +28 -23
  14. data/lib/rspec-puppet/example/host_example_group.rb +3 -1
  15. data/lib/rspec-puppet/example/provider_example_group.rb +2 -0
  16. data/lib/rspec-puppet/example/type_alias_example_group.rb +4 -2
  17. data/lib/rspec-puppet/example/type_example_group.rb +3 -1
  18. data/lib/rspec-puppet/example.rb +6 -7
  19. data/lib/rspec-puppet/facter_impl.rb +11 -10
  20. data/lib/rspec-puppet/matchers/allow_value.rb +10 -10
  21. data/lib/rspec-puppet/matchers/compile.rb +54 -61
  22. data/lib/rspec-puppet/matchers/count_generic.rb +18 -18
  23. data/lib/rspec-puppet/matchers/create_generic.rb +66 -78
  24. data/lib/rspec-puppet/matchers/dynamic_matchers.rb +13 -2
  25. data/lib/rspec-puppet/matchers/include_class.rb +5 -4
  26. data/lib/rspec-puppet/matchers/parameter_matcher.rb +11 -12
  27. data/lib/rspec-puppet/matchers/raise_error.rb +5 -1
  28. data/lib/rspec-puppet/matchers/run.rb +41 -44
  29. data/lib/rspec-puppet/matchers/type_matchers.rb +37 -48
  30. data/lib/rspec-puppet/matchers.rb +2 -0
  31. data/lib/rspec-puppet/monkey_patches/win32/registry.rb +7 -5
  32. data/lib/rspec-puppet/monkey_patches/win32/taskscheduler.rb +3 -1
  33. data/lib/rspec-puppet/monkey_patches/windows/taskschedulerconstants.rb +208 -205
  34. data/lib/rspec-puppet/monkey_patches.rb +56 -56
  35. data/lib/rspec-puppet/rake_task.rb +6 -4
  36. data/lib/rspec-puppet/raw_string.rb +2 -0
  37. data/lib/rspec-puppet/sensitive.rb +9 -7
  38. data/lib/rspec-puppet/setup.rb +43 -48
  39. data/lib/rspec-puppet/spec_helper.rb +2 -0
  40. data/lib/rspec-puppet/support.rb +133 -134
  41. data/lib/rspec-puppet/tasks/release_test.rb +8 -5
  42. data/lib/rspec-puppet/version.rb +5 -0
  43. data/lib/rspec-puppet.rb +43 -51
  44. metadata +11 -9
data/lib/rspec-puppet.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet'
2
4
  require 'rspec'
3
5
  require 'fileutils'
@@ -16,7 +18,7 @@ rescue LoadError
16
18
  end
17
19
 
18
20
  RSpec.configure do |c|
19
- c.add_setting :enable_pathname_stubbing, :default => false
21
+ c.add_setting :enable_pathname_stubbing, default: false
20
22
  end
21
23
 
22
24
  module RSpec::Puppet
@@ -32,34 +34,34 @@ end
32
34
  require 'rspec-puppet/monkey_patches'
33
35
 
34
36
  RSpec.configure do |c|
35
- c.add_setting :environmentpath, :default => Puppet::Util::Platform.actually_windows? ? 'c:/nul/' : '/dev/null'
36
- c.add_setting :module_path, :default => nil
37
- c.add_setting :manifest_dir, :default => nil
38
- c.add_setting :manifest, :default => nil
39
- c.add_setting :template_dir, :default => nil
40
- c.add_setting :config, :default => nil
41
- c.add_setting :confdir, :default => Puppet::Util::Platform.actually_windows? ? 'c:/nul/' : '/dev/null'
42
- c.add_setting :default_facts, :default => {}
43
- c.add_setting :default_node_params, :default => {}
44
- c.add_setting :default_trusted_facts, :default => {}
45
- c.add_setting :default_trusted_external_data, :default => {}
46
- c.add_setting :facter_implementation, :default => :facter
47
- c.add_setting :hiera_config, :default => Puppet::Util::Platform.actually_windows? ? 'c:/nul/' : '/dev/null'
48
- c.add_setting :parser, :default => 'current'
49
- c.add_setting :trusted_node_data, :default => false
50
- c.add_setting :ordering, :default => 'title-hash'
51
- c.add_setting :stringify_facts, :default => true
52
- c.add_setting :strict_variables, :default => false
53
- c.add_setting :setup_fixtures, :default => true
54
- c.add_setting :derive_node_facts_from_nodename, :default => true
37
+ c.add_setting :environmentpath, default: Puppet::Util::Platform.actually_windows? ? 'c:/nul/' : '/dev/null'
38
+ c.add_setting :module_path, default: nil
39
+ c.add_setting :manifest_dir, default: nil
40
+ c.add_setting :manifest, default: nil
41
+ c.add_setting :template_dir, default: nil
42
+ c.add_setting :config, default: nil
43
+ c.add_setting :confdir, default: Puppet::Util::Platform.actually_windows? ? 'c:/nul/' : '/dev/null'
44
+ c.add_setting :default_facts, default: {}
45
+ c.add_setting :default_node_params, default: {}
46
+ c.add_setting :default_trusted_facts, default: {}
47
+ c.add_setting :default_trusted_external_data, default: {}
48
+ c.add_setting :facter_implementation, default: :facter
49
+ c.add_setting :hiera_config, default: Puppet::Util::Platform.actually_windows? ? 'c:/nul/' : '/dev/null'
50
+ c.add_setting :parser, default: 'current'
51
+ c.add_setting :trusted_node_data, default: false
52
+ c.add_setting :ordering, default: 'title-hash'
53
+ c.add_setting :stringify_facts, default: true
54
+ c.add_setting :strict_variables, default: false
55
+ c.add_setting :setup_fixtures, default: true
56
+ c.add_setting :derive_node_facts_from_nodename, default: true
55
57
  c.add_setting :adapter
56
- c.add_setting :platform, :default => Puppet::Util::Platform.actual_platform
57
- c.add_setting :vendormoduledir, :default => Puppet::Util::Platform.actually_windows? ? 'c:/nul/' : '/dev/null'
58
- c.add_setting :basemodulepath, :default => Puppet::Util::Platform.actually_windows? ? 'c:/nul/' : '/dev/null'
59
- c.add_setting :disable_module_hiera, :default => false
60
- c.add_setting :fixture_hiera_configs, :default => {}
61
- c.add_setting :use_fixture_spec_hiera, :default => false
62
- c.add_setting :fallback_to_default_hiera, :default => true
58
+ c.add_setting :platform, default: Puppet::Util::Platform.actual_platform
59
+ c.add_setting :vendormoduledir, default: Puppet::Util::Platform.actually_windows? ? 'c:/nul/' : '/dev/null'
60
+ c.add_setting :basemodulepath, default: Puppet::Util::Platform.actually_windows? ? 'c:/nul/' : '/dev/null'
61
+ c.add_setting :disable_module_hiera, default: false
62
+ c.add_setting :fixture_hiera_configs, default: {}
63
+ c.add_setting :use_fixture_spec_hiera, default: false
64
+ c.add_setting :fallback_to_default_hiera, default: true
63
65
 
64
66
  c.instance_eval do
65
67
  def trusted_server_facts
@@ -68,14 +70,12 @@ RSpec.configure do |c|
68
70
 
69
71
  def trusted_server_facts=(value)
70
72
  @trusted_server_facts = value
71
- adapter.setup_puppet(RSpec::Puppet.current_example) unless adapter.nil?
73
+ adapter&.setup_puppet(RSpec::Puppet.current_example)
72
74
  end
73
75
  end
74
76
 
75
77
  c.before(:all) do
76
- if RSpec.configuration.setup_fixtures?
77
- RSpec::Puppet::Setup.safe_setup_directories(nil, false)
78
- end
78
+ RSpec::Puppet::Setup.safe_setup_directories(nil, false) if RSpec.configuration.setup_fixtures?
79
79
  end
80
80
 
81
81
  if defined?(Puppet::Test::TestHelper)
@@ -86,33 +86,25 @@ RSpec.configure do |c|
86
86
  end
87
87
 
88
88
  c.before :all do
89
- begin
90
- Puppet::Test::TestHelper.before_all_tests
91
- rescue
92
- end
89
+ Puppet::Test::TestHelper.before_all_tests
90
+ rescue StandardError
93
91
  end
94
92
 
95
93
  c.after :all do
96
- begin
97
- Puppet::Test::TestHelper.after_all_tests
98
- rescue
99
- end
94
+ Puppet::Test::TestHelper.after_all_tests
95
+ rescue StandardError
100
96
  end
101
97
 
102
98
  c.before :each do
103
- begin
104
- Puppet::Test::TestHelper.before_each_test
105
- rescue Puppet::Context::DuplicateRollbackMarkError
106
- Puppet::Test::TestHelper.send(:initialize_settings_before_each)
107
- rescue
108
- end
99
+ Puppet::Test::TestHelper.before_each_test
100
+ rescue Puppet::Context::DuplicateRollbackMarkError
101
+ Puppet::Test::TestHelper.send(:initialize_settings_before_each)
102
+ rescue StandardError
109
103
  end
110
104
 
111
105
  c.after :each do
112
- begin
113
- Puppet::Test::TestHelper.after_each_test
114
- rescue
115
- end
106
+ Puppet::Test::TestHelper.after_each_test
107
+ rescue StandardError
116
108
  end
117
109
  end
118
110
 
@@ -127,7 +119,7 @@ RSpec.configure do |c|
127
119
  c.before :each do |example|
128
120
  if RSpec::Puppet.rspec_puppet_example?
129
121
  Puppet::Util::Platform.pretend_to_be RSpec.configuration.platform
130
- stub_file_consts(example) if self.respond_to?(:stub_file_consts)
122
+ stub_file_consts(example) if respond_to?(:stub_file_consts)
131
123
 
132
124
  if defined?(Selinux)
133
125
  if respond_to?(:allow)
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: 2.12.0
4
+ version: 3.0.0.rc.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: 2022-07-21 00:00:00.000000000 Z
13
+ date: 2023-04-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -77,11 +77,13 @@ files:
77
77
  - lib/rspec-puppet/spec_helper.rb
78
78
  - lib/rspec-puppet/support.rb
79
79
  - lib/rspec-puppet/tasks/release_test.rb
80
+ - lib/rspec-puppet/version.rb
80
81
  homepage: https://github.com/puppetlabs/rspec-puppet/
81
82
  licenses:
82
83
  - MIT
83
- metadata: {}
84
- post_install_message:
84
+ metadata:
85
+ rubygems_mfa_required: 'true'
86
+ post_install_message:
85
87
  rdoc_options: []
86
88
  require_paths:
87
89
  - lib
@@ -89,15 +91,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
91
  requirements:
90
92
  - - ">="
91
93
  - !ruby/object:Gem::Version
92
- version: '0'
94
+ version: 2.7.0
93
95
  required_rubygems_version: !ruby/object:Gem::Requirement
94
96
  requirements:
95
- - - ">="
97
+ - - ">"
96
98
  - !ruby/object:Gem::Version
97
- version: '0'
99
+ version: 1.3.1
98
100
  requirements: []
99
101
  rubygems_version: 3.1.6
100
- signing_key:
102
+ signing_key:
101
103
  specification_version: 4
102
104
  summary: RSpec tests for your Puppet manifests
103
105
  test_files: []