chefspec-chef 9.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +30 -0
  3. data/LICENSE +22 -0
  4. data/Rakefile +85 -0
  5. data/chefspec-chef.gemspec +30 -0
  6. data/lib/chefspec/api/core.rb +217 -0
  7. data/lib/chefspec/api/described.rb +53 -0
  8. data/lib/chefspec/api/do_nothing.rb +26 -0
  9. data/lib/chefspec/api/include_any_recipe.rb +24 -0
  10. data/lib/chefspec/api/include_recipe.rb +28 -0
  11. data/lib/chefspec/api/link.rb +28 -0
  12. data/lib/chefspec/api/notifications.rb +40 -0
  13. data/lib/chefspec/api/reboot.rb +14 -0
  14. data/lib/chefspec/api/render_file.rb +37 -0
  15. data/lib/chefspec/api/state_attrs.rb +30 -0
  16. data/lib/chefspec/api/stubs.rb +183 -0
  17. data/lib/chefspec/api/stubs_for.rb +139 -0
  18. data/lib/chefspec/api/subscriptions.rb +37 -0
  19. data/lib/chefspec/api/user.rb +230 -0
  20. data/lib/chefspec/api.rb +39 -0
  21. data/lib/chefspec/berkshelf.rb +63 -0
  22. data/lib/chefspec/cacher.rb +64 -0
  23. data/lib/chefspec/coverage/filters.rb +82 -0
  24. data/lib/chefspec/coverage.rb +247 -0
  25. data/lib/chefspec/deprecations.rb +46 -0
  26. data/lib/chefspec/errors.rb +48 -0
  27. data/lib/chefspec/expect_exception.rb +51 -0
  28. data/lib/chefspec/extensions/chef/client.rb +21 -0
  29. data/lib/chefspec/extensions/chef/conditional.rb +16 -0
  30. data/lib/chefspec/extensions/chef/cookbook/gem_installer.rb +33 -0
  31. data/lib/chefspec/extensions/chef/cookbook_loader.rb +14 -0
  32. data/lib/chefspec/extensions/chef/cookbook_uploader.rb +12 -0
  33. data/lib/chefspec/extensions/chef/data_query.rb +49 -0
  34. data/lib/chefspec/extensions/chef/lwrp_base.rb +29 -0
  35. data/lib/chefspec/extensions/chef/provider.rb +39 -0
  36. data/lib/chefspec/extensions/chef/resource/freebsd_package.rb +17 -0
  37. data/lib/chefspec/extensions/chef/resource.rb +188 -0
  38. data/lib/chefspec/extensions/chef/run_context/cookbook_compiler.rb +84 -0
  39. data/lib/chefspec/extensions/chef/securable.rb +19 -0
  40. data/lib/chefspec/extensions/ohai/system.rb +11 -0
  41. data/lib/chefspec/extensions.rb +21 -0
  42. data/lib/chefspec/file_cache_path_proxy.rb +15 -0
  43. data/lib/chefspec/formatter.rb +282 -0
  44. data/lib/chefspec/librarian.rb +51 -0
  45. data/lib/chefspec/matchers/do_nothing_matcher.rb +52 -0
  46. data/lib/chefspec/matchers/include_any_recipe_matcher.rb +51 -0
  47. data/lib/chefspec/matchers/include_recipe_matcher.rb +46 -0
  48. data/lib/chefspec/matchers/link_to_matcher.rb +37 -0
  49. data/lib/chefspec/matchers/notifications_matcher.rb +143 -0
  50. data/lib/chefspec/matchers/render_file_matcher.rb +140 -0
  51. data/lib/chefspec/matchers/resource_matcher.rb +175 -0
  52. data/lib/chefspec/matchers/state_attrs_matcher.rb +71 -0
  53. data/lib/chefspec/matchers/subscribes_matcher.rb +72 -0
  54. data/lib/chefspec/matchers.rb +13 -0
  55. data/lib/chefspec/mixins/normalize.rb +22 -0
  56. data/lib/chefspec/policyfile.rb +69 -0
  57. data/lib/chefspec/renderer.rb +145 -0
  58. data/lib/chefspec/rspec.rb +21 -0
  59. data/lib/chefspec/runner.rb +8 -0
  60. data/lib/chefspec/server.rb +4 -0
  61. data/lib/chefspec/server_methods.rb +173 -0
  62. data/lib/chefspec/server_runner.rb +76 -0
  63. data/lib/chefspec/solo_runner.rb +516 -0
  64. data/lib/chefspec/stubs/command_registry.rb +11 -0
  65. data/lib/chefspec/stubs/command_stub.rb +37 -0
  66. data/lib/chefspec/stubs/data_bag_item_registry.rb +13 -0
  67. data/lib/chefspec/stubs/data_bag_item_stub.rb +25 -0
  68. data/lib/chefspec/stubs/data_bag_registry.rb +13 -0
  69. data/lib/chefspec/stubs/data_bag_stub.rb +23 -0
  70. data/lib/chefspec/stubs/registry.rb +32 -0
  71. data/lib/chefspec/stubs/search_registry.rb +13 -0
  72. data/lib/chefspec/stubs/search_stub.rb +25 -0
  73. data/lib/chefspec/stubs/stub.rb +38 -0
  74. data/lib/chefspec/util.rb +58 -0
  75. data/lib/chefspec/version.rb +3 -0
  76. data/lib/chefspec/zero_server.rb +142 -0
  77. data/lib/chefspec.rb +75 -0
  78. data/spec/spec_helper.rb +12 -0
  79. data/spec/support/hash.rb +35 -0
  80. data/spec/unit/cacher_spec.rb +70 -0
  81. data/spec/unit/coverage/filters_spec.rb +60 -0
  82. data/spec/unit/deprecations_spec.rb +52 -0
  83. data/spec/unit/errors_spec.rb +57 -0
  84. data/spec/unit/expect_exception_spec.rb +32 -0
  85. data/spec/unit/macros_spec.rb +119 -0
  86. data/spec/unit/matchers/do_nothing_matcher.rb +5 -0
  87. data/spec/unit/matchers/include_any_recipe_matcher_spec.rb +52 -0
  88. data/spec/unit/matchers/include_recipe_matcher_spec.rb +38 -0
  89. data/spec/unit/matchers/link_to_matcher_spec.rb +55 -0
  90. data/spec/unit/matchers/notifications_matcher_spec.rb +39 -0
  91. data/spec/unit/matchers/render_file_matcher_spec.rb +68 -0
  92. data/spec/unit/matchers/resource_matcher_spec.rb +5 -0
  93. data/spec/unit/matchers/state_attrs_matcher_spec.rb +68 -0
  94. data/spec/unit/matchers/subscribes_matcher_spec.rb +63 -0
  95. data/spec/unit/renderer_spec.rb +69 -0
  96. data/spec/unit/server_runner_spec.rb +28 -0
  97. data/spec/unit/solo_runner_spec.rb +171 -0
  98. data/spec/unit/stubs/command_registry_spec.rb +27 -0
  99. data/spec/unit/stubs/command_stub_spec.rb +61 -0
  100. data/spec/unit/stubs/data_bag_item_registry_spec.rb +39 -0
  101. data/spec/unit/stubs/data_bag_item_stub_spec.rb +36 -0
  102. data/spec/unit/stubs/data_bag_registry_spec.rb +39 -0
  103. data/spec/unit/stubs/data_bag_stub_spec.rb +35 -0
  104. data/spec/unit/stubs/registry_spec.rb +29 -0
  105. data/spec/unit/stubs/search_registry_spec.rb +39 -0
  106. data/spec/unit/stubs/search_stub_spec.rb +36 -0
  107. data/spec/unit/stubs/stub_spec.rb +64 -0
  108. data/templates/coverage/human.erb +22 -0
  109. data/templates/coverage/json.erb +8 -0
  110. data/templates/coverage/table.erb +14 -0
  111. data/templates/errors/cookbook_path_not_found.erb +3 -0
  112. data/templates/errors/erb_template_parse_error.erb +5 -0
  113. data/templates/errors/gem_load_error.erb +7 -0
  114. data/templates/errors/invalid_berkshelf_options.erb +4 -0
  115. data/templates/errors/may_need_to_specify_platform.erb +25 -0
  116. data/templates/errors/no_conversion_error.erb +1 -0
  117. data/templates/errors/not_stubbed.erb +7 -0
  118. data/templates/errors/shell_out_not_stubbed.erb +10 -0
  119. data/templates/errors/template_not_found.erb +9 -0
  120. metadata +221 -0
@@ -0,0 +1,25 @@
1
+ It appears that Chef could not find the resource on the given platform. As of
2
+ Chef 12.4, Chef conditionally loads resources based on the operating system
3
+ being provisioned. Double-check the error below and ensure you did not make any
4
+ typographical errors, and then continue reading.
5
+
6
+ The default operating system for ChefSpec is "chefspec", which means Chef will
7
+ not load many resources by default. For example, "dpkg_package" is not a
8
+ resource that is available on the "chefspec" operating system just like
9
+ "freebsd_package" is not available on the Windows operating system. As such,
10
+ you may get a Chef::Exceptions::NoSuchResourceType when using ChefSpec's default
11
+ options.
12
+
13
+ You can specify the platform and version you would like ChefSpec to act like
14
+ by specifying the platform and version like so:
15
+
16
+ ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04')
17
+
18
+ You can read more information in ChefSpec's README or the Fauxhai project:
19
+
20
+ https://github.com/chefspec/chefspec#configuration
21
+ https://github.com/chefspec/fauxhai
22
+
23
+ Here is the original error:
24
+
25
+ <%= @original_error %>
@@ -0,0 +1 @@
1
+ You called a deprecated method without a backwards compatible replacement.
@@ -0,0 +1,7 @@
1
+ Executing a real <%= @type %> is disabled. Unregistered <%= @type %>:
2
+
3
+ <%= @signature %>
4
+
5
+ You can stub this <%= @type %> with:
6
+
7
+ <%= @stub %>
@@ -0,0 +1,10 @@
1
+ Executing a real shell_out in <%= @resource %> is not allowed:
2
+
3
+ shell_out(<%= @args.inspect[1..-2] %>)
4
+
5
+ You can stub this with:
6
+
7
+ stubs_for_<%= @type %>(<%= @resource.to_s.inspect %>) do |<%= @type %>|
8
+ allow(<%= @type %>).to receive_shell_out(<%= @args.inspect[1..-2] %>)
9
+ end
10
+
@@ -0,0 +1,9 @@
1
+ The template specified cannot be found.
2
+
3
+ The template for a Coverage.report!
4
+ cannot be found given the following path:
5
+
6
+ <%= @path %>
7
+
8
+ please check your set_template parameters.
9
+
metadata ADDED
@@ -0,0 +1,221 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chefspec-chef
3
+ version: !ruby/object:Gem::Version
4
+ version: 9.3.4
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Crump
8
+ - Seth Vargo
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2022-06-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: chef
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '15'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '15'
28
+ - !ruby/object:Gem::Dependency
29
+ name: chef-cli
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: fauxhai-chef
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '9.3'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '9.3'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.0'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '3.0'
70
+ description: ChefSpec is a unit testing and resource coverage (code coverage) framework
71
+ for testing Chef cookbooks ChefSpec makes it easy to write examples and get fast
72
+ feedback on cookbook changes without the need for virtual machines or cloud servers.
73
+ email:
74
+ - andrew.crump@ieee.org
75
+ - sethvargo@gmail.com
76
+ executables: []
77
+ extensions: []
78
+ extra_rdoc_files: []
79
+ files:
80
+ - Gemfile
81
+ - LICENSE
82
+ - Rakefile
83
+ - chefspec-chef.gemspec
84
+ - lib/chefspec.rb
85
+ - lib/chefspec/api.rb
86
+ - lib/chefspec/api/core.rb
87
+ - lib/chefspec/api/described.rb
88
+ - lib/chefspec/api/do_nothing.rb
89
+ - lib/chefspec/api/include_any_recipe.rb
90
+ - lib/chefspec/api/include_recipe.rb
91
+ - lib/chefspec/api/link.rb
92
+ - lib/chefspec/api/notifications.rb
93
+ - lib/chefspec/api/reboot.rb
94
+ - lib/chefspec/api/render_file.rb
95
+ - lib/chefspec/api/state_attrs.rb
96
+ - lib/chefspec/api/stubs.rb
97
+ - lib/chefspec/api/stubs_for.rb
98
+ - lib/chefspec/api/subscriptions.rb
99
+ - lib/chefspec/api/user.rb
100
+ - lib/chefspec/berkshelf.rb
101
+ - lib/chefspec/cacher.rb
102
+ - lib/chefspec/coverage.rb
103
+ - lib/chefspec/coverage/filters.rb
104
+ - lib/chefspec/deprecations.rb
105
+ - lib/chefspec/errors.rb
106
+ - lib/chefspec/expect_exception.rb
107
+ - lib/chefspec/extensions.rb
108
+ - lib/chefspec/extensions/chef/client.rb
109
+ - lib/chefspec/extensions/chef/conditional.rb
110
+ - lib/chefspec/extensions/chef/cookbook/gem_installer.rb
111
+ - lib/chefspec/extensions/chef/cookbook_loader.rb
112
+ - lib/chefspec/extensions/chef/cookbook_uploader.rb
113
+ - lib/chefspec/extensions/chef/data_query.rb
114
+ - lib/chefspec/extensions/chef/lwrp_base.rb
115
+ - lib/chefspec/extensions/chef/provider.rb
116
+ - lib/chefspec/extensions/chef/resource.rb
117
+ - lib/chefspec/extensions/chef/resource/freebsd_package.rb
118
+ - lib/chefspec/extensions/chef/run_context/cookbook_compiler.rb
119
+ - lib/chefspec/extensions/chef/securable.rb
120
+ - lib/chefspec/extensions/ohai/system.rb
121
+ - lib/chefspec/file_cache_path_proxy.rb
122
+ - lib/chefspec/formatter.rb
123
+ - lib/chefspec/librarian.rb
124
+ - lib/chefspec/matchers.rb
125
+ - lib/chefspec/matchers/do_nothing_matcher.rb
126
+ - lib/chefspec/matchers/include_any_recipe_matcher.rb
127
+ - lib/chefspec/matchers/include_recipe_matcher.rb
128
+ - lib/chefspec/matchers/link_to_matcher.rb
129
+ - lib/chefspec/matchers/notifications_matcher.rb
130
+ - lib/chefspec/matchers/render_file_matcher.rb
131
+ - lib/chefspec/matchers/resource_matcher.rb
132
+ - lib/chefspec/matchers/state_attrs_matcher.rb
133
+ - lib/chefspec/matchers/subscribes_matcher.rb
134
+ - lib/chefspec/mixins/normalize.rb
135
+ - lib/chefspec/policyfile.rb
136
+ - lib/chefspec/renderer.rb
137
+ - lib/chefspec/rspec.rb
138
+ - lib/chefspec/runner.rb
139
+ - lib/chefspec/server.rb
140
+ - lib/chefspec/server_methods.rb
141
+ - lib/chefspec/server_runner.rb
142
+ - lib/chefspec/solo_runner.rb
143
+ - lib/chefspec/stubs/command_registry.rb
144
+ - lib/chefspec/stubs/command_stub.rb
145
+ - lib/chefspec/stubs/data_bag_item_registry.rb
146
+ - lib/chefspec/stubs/data_bag_item_stub.rb
147
+ - lib/chefspec/stubs/data_bag_registry.rb
148
+ - lib/chefspec/stubs/data_bag_stub.rb
149
+ - lib/chefspec/stubs/registry.rb
150
+ - lib/chefspec/stubs/search_registry.rb
151
+ - lib/chefspec/stubs/search_stub.rb
152
+ - lib/chefspec/stubs/stub.rb
153
+ - lib/chefspec/util.rb
154
+ - lib/chefspec/version.rb
155
+ - lib/chefspec/zero_server.rb
156
+ - spec/spec_helper.rb
157
+ - spec/support/hash.rb
158
+ - spec/unit/cacher_spec.rb
159
+ - spec/unit/coverage/filters_spec.rb
160
+ - spec/unit/deprecations_spec.rb
161
+ - spec/unit/errors_spec.rb
162
+ - spec/unit/expect_exception_spec.rb
163
+ - spec/unit/macros_spec.rb
164
+ - spec/unit/matchers/do_nothing_matcher.rb
165
+ - spec/unit/matchers/include_any_recipe_matcher_spec.rb
166
+ - spec/unit/matchers/include_recipe_matcher_spec.rb
167
+ - spec/unit/matchers/link_to_matcher_spec.rb
168
+ - spec/unit/matchers/notifications_matcher_spec.rb
169
+ - spec/unit/matchers/render_file_matcher_spec.rb
170
+ - spec/unit/matchers/resource_matcher_spec.rb
171
+ - spec/unit/matchers/state_attrs_matcher_spec.rb
172
+ - spec/unit/matchers/subscribes_matcher_spec.rb
173
+ - spec/unit/renderer_spec.rb
174
+ - spec/unit/server_runner_spec.rb
175
+ - spec/unit/solo_runner_spec.rb
176
+ - spec/unit/stubs/command_registry_spec.rb
177
+ - spec/unit/stubs/command_stub_spec.rb
178
+ - spec/unit/stubs/data_bag_item_registry_spec.rb
179
+ - spec/unit/stubs/data_bag_item_stub_spec.rb
180
+ - spec/unit/stubs/data_bag_registry_spec.rb
181
+ - spec/unit/stubs/data_bag_stub_spec.rb
182
+ - spec/unit/stubs/registry_spec.rb
183
+ - spec/unit/stubs/search_registry_spec.rb
184
+ - spec/unit/stubs/search_stub_spec.rb
185
+ - spec/unit/stubs/stub_spec.rb
186
+ - templates/coverage/human.erb
187
+ - templates/coverage/json.erb
188
+ - templates/coverage/table.erb
189
+ - templates/errors/cookbook_path_not_found.erb
190
+ - templates/errors/erb_template_parse_error.erb
191
+ - templates/errors/gem_load_error.erb
192
+ - templates/errors/invalid_berkshelf_options.erb
193
+ - templates/errors/may_need_to_specify_platform.erb
194
+ - templates/errors/no_conversion_error.erb
195
+ - templates/errors/not_stubbed.erb
196
+ - templates/errors/shell_out_not_stubbed.erb
197
+ - templates/errors/template_not_found.erb
198
+ homepage: https://github.com/chef/chefspec
199
+ licenses:
200
+ - MIT
201
+ metadata: {}
202
+ post_install_message:
203
+ rdoc_options: []
204
+ require_paths:
205
+ - lib
206
+ required_ruby_version: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - ">="
209
+ - !ruby/object:Gem::Version
210
+ version: '2.5'
211
+ required_rubygems_version: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ requirements: []
217
+ rubygems_version: 3.1.4
218
+ signing_key:
219
+ specification_version: 4
220
+ summary: Write RSpec examples and generate coverage reports for Chef recipes!
221
+ test_files: []