chef 12.13.37-universal-mingw32 → 12.14.60-universal-mingw32

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.
Files changed (338) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +48 -95
  3. data/Gemfile +6 -1
  4. data/README.md +9 -11
  5. data/VERSION +1 -1
  6. data/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +0 -1
  7. data/acceptance/Gemfile +4 -7
  8. data/acceptance/Gemfile.lock +59 -92
  9. data/acceptance/basics/test/integration/helpers/serverspec/Gemfile +8 -0
  10. data/acceptance/data-collector/test/integration/helpers/serverspec/Gemfile +8 -0
  11. data/acceptance/fips/test/integration/fips-integration/serverspec/Gemfile +6 -0
  12. data/acceptance/fips/test/integration/fips-unit-functional/serverspec/Gemfile +4 -0
  13. data/chef.gemspec +3 -2
  14. data/lib/chef/application/client.rb +4 -4
  15. data/lib/chef/application/solo.rb +2 -2
  16. data/lib/chef/chef_fs/command_line.rb +36 -34
  17. data/lib/chef/chef_fs/data_handler/data_handler_base.rb +2 -2
  18. data/lib/chef/chef_fs/file_pattern.rb +1 -1
  19. data/lib/chef/chef_fs/file_system.rb +139 -137
  20. data/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb +2 -6
  21. data/lib/chef/cookbook/cookbook_version_loader.rb +27 -22
  22. data/lib/chef/cookbook/metadata.rb +1 -1
  23. data/lib/chef/cookbook/synchronizer.rb +3 -3
  24. data/lib/chef/cookbook_site_streaming_uploader.rb +3 -3
  25. data/lib/chef/cookbook_uploader.rb +1 -1
  26. data/lib/chef/cookbook_version.rb +6 -6
  27. data/lib/chef/dsl/powershell.rb +1 -1
  28. data/lib/chef/event_dispatch/base.rb +2 -2
  29. data/lib/chef/exceptions.rb +1 -1
  30. data/lib/chef/file_cache.rb +1 -1
  31. data/lib/chef/formatters/base.rb +2 -2
  32. data/lib/chef/formatters/doc.rb +2 -2
  33. data/lib/chef/http.rb +48 -18
  34. data/lib/chef/http/auth_credentials.rb +1 -1
  35. data/lib/chef/http/basic_client.rb +11 -2
  36. data/lib/chef/http/socketless_chef_zero_client.rb +2 -2
  37. data/lib/chef/key.rb +55 -56
  38. data/lib/chef/knife.rb +70 -61
  39. data/lib/chef/knife/client_delete.rb +2 -2
  40. data/lib/chef/knife/cookbook_bulk_delete.rb +1 -1
  41. data/lib/chef/knife/cookbook_show.rb +1 -1
  42. data/lib/chef/knife/core/gem_glob_loader.rb +3 -3
  43. data/lib/chef/knife/search.rb +2 -2
  44. data/lib/chef/knife/ssh.rb +19 -21
  45. data/lib/chef/knife/status.rb +2 -2
  46. data/lib/chef/mixin/command/unix.rb +2 -2
  47. data/lib/chef/mixin/powershell_type_coercions.rb +1 -1
  48. data/lib/chef/mixin/properties.rb +3 -0
  49. data/lib/chef/mixin/securable.rb +2 -2
  50. data/lib/chef/mixin/shell_out.rb +30 -0
  51. data/lib/chef/mixin/uris.rb +2 -1
  52. data/lib/chef/mixin/windows_architecture_helper.rb +3 -4
  53. data/lib/chef/monkey_patches/webrick-utils.rb +2 -2
  54. data/lib/chef/monologger.rb +1 -1
  55. data/lib/chef/node.rb +2 -2
  56. data/lib/chef/node/attribute.rb +3 -3
  57. data/lib/chef/platform/provider_mapping.rb +5 -2
  58. data/lib/chef/property.rb +14 -3
  59. data/lib/chef/provider/apt_repository.rb +3 -7
  60. data/lib/chef/provider/apt_update.rb +4 -6
  61. data/lib/chef/provider/cron.rb +1 -2
  62. data/lib/chef/provider/dsc_script.rb +4 -4
  63. data/lib/chef/provider/group/usermod.rb +1 -1
  64. data/lib/chef/provider/link.rb +10 -3
  65. data/lib/chef/provider/osx_profile.rb +10 -10
  66. data/lib/chef/provider/package.rb +2 -12
  67. data/lib/chef/provider/package/rubygems.rb +17 -16
  68. data/lib/chef/provider/package/windows.rb +2 -0
  69. data/lib/chef/provider/package/windows/exe.rb +1 -1
  70. data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +0 -2
  71. data/lib/chef/provider/package/yum/rpm_utils.rb +8 -8
  72. data/lib/chef/provider/package/yum/yum_cache.rb +1 -1
  73. data/lib/chef/provider/remote_file/ftp.rb +2 -2
  74. data/lib/chef/provider/remote_file/sftp.rb +2 -2
  75. data/lib/chef/provider/service/debian.rb +2 -2
  76. data/lib/chef/provider/service/simple.rb +4 -3
  77. data/lib/chef/provider/service/solaris.rb +1 -1
  78. data/lib/chef/provider/service/systemd.rb +2 -2
  79. data/lib/chef/provider/service/upstart.rb +8 -5
  80. data/lib/chef/provider/support/yum_repo.erb +125 -0
  81. data/lib/chef/provider/systemd_unit.rb +11 -2
  82. data/lib/chef/provider/template_finder.rb +1 -1
  83. data/lib/chef/provider/user.rb +20 -16
  84. data/lib/chef/provider/user/aix.rb +5 -2
  85. data/lib/chef/provider/user/dscl.rb +1 -0
  86. data/lib/chef/provider/user/linux.rb +128 -0
  87. data/lib/chef/provider/user/pw.rb +2 -1
  88. data/lib/chef/provider/user/solaris.rb +3 -2
  89. data/lib/chef/provider/user/useradd.rb +5 -4
  90. data/lib/chef/provider/user/windows.rb +1 -1
  91. data/lib/chef/provider/windows_script.rb +5 -2
  92. data/lib/chef/provider/yum_repository.rb +121 -0
  93. data/lib/chef/providers.rb +4 -2
  94. data/lib/chef/resource.rb +7 -9
  95. data/lib/chef/resource/conditional.rb +9 -1
  96. data/lib/chef/resource/launchd.rb +1 -1
  97. data/lib/chef/resource/user.rb +3 -3
  98. data/lib/chef/resource/user/aix_user.rb +31 -0
  99. data/lib/chef/resource/user/dscl_user.rb +31 -0
  100. data/lib/chef/resource/user/linux_user.rb +51 -0
  101. data/lib/chef/resource/user/pw_user.rb +31 -0
  102. data/lib/chef/resource/user/solaris_user.rb +31 -0
  103. data/lib/chef/resource/user/windows_user.rb +31 -0
  104. data/lib/chef/resource/yum_package.rb +13 -12
  105. data/lib/chef/resource/yum_repository.rb +76 -0
  106. data/lib/chef/resource_builder.rb +1 -1
  107. data/lib/chef/resource_collection/stepable_iterator.rb +1 -3
  108. data/lib/chef/resource_reporter.rb +5 -5
  109. data/lib/chef/resources.rb +7 -0
  110. data/lib/chef/run_context.rb +5 -3
  111. data/lib/chef/run_context/cookbook_compiler.rb +3 -2
  112. data/lib/chef/run_list.rb +2 -2
  113. data/lib/chef/search/query.rb +11 -8
  114. data/lib/chef/shell/ext.rb +2 -2
  115. data/lib/chef/shell/shell_session.rb +1 -1
  116. data/lib/chef/util/dsc/configuration_generator.rb +1 -1
  117. data/lib/chef/util/powershell/cmdlet.rb +5 -2
  118. data/lib/chef/util/selinux.rb +1 -1
  119. data/lib/chef/version.rb +1 -1
  120. data/lib/chef/version_class.rb +2 -2
  121. data/lib/chef/version_constraint.rb +2 -2
  122. data/lib/chef/win32/api/error.rb +2 -2
  123. data/lib/chef/win32/api/net.rb +1 -1
  124. data/lib/chef/win32/eventlog.rb +1 -1
  125. data/lib/chef/win32/net.rb +1 -1
  126. data/lib/chef/win32/security/sid.rb +1 -1
  127. data/spec/functional/assets/testchefsubsys +2 -3
  128. data/spec/functional/event_loggers/windows_eventlog_spec.rb +11 -8
  129. data/spec/functional/file_content_management/deploy_strategies_spec.rb +1 -1
  130. data/spec/functional/http/simple_spec.rb +2 -2
  131. data/spec/functional/knife/cookbook_delete_spec.rb +5 -5
  132. data/spec/functional/knife/exec_spec.rb +6 -6
  133. data/spec/functional/knife/ssh_spec.rb +4 -4
  134. data/spec/functional/notifications_spec.rb +2 -2
  135. data/spec/functional/provider/whyrun_safe_ruby_block_spec.rb +2 -2
  136. data/spec/functional/rebooter_spec.rb +5 -5
  137. data/spec/functional/resource/bash_spec.rb +2 -2
  138. data/spec/functional/resource/deploy_revision_spec.rb +1 -1
  139. data/spec/functional/resource/dpkg_package_spec.rb +2 -2
  140. data/spec/functional/resource/dsc_resource_spec.rb +5 -5
  141. data/spec/functional/resource/dsc_script_spec.rb +27 -22
  142. data/spec/functional/resource/env_spec.rb +4 -4
  143. data/spec/functional/resource/execute_spec.rb +4 -4
  144. data/spec/functional/resource/group_spec.rb +20 -8
  145. data/spec/functional/resource/link_spec.rb +34 -0
  146. data/spec/functional/resource/ohai_spec.rb +6 -6
  147. data/spec/functional/resource/reboot_spec.rb +2 -2
  148. data/spec/functional/resource/remote_file_spec.rb +16 -7
  149. data/spec/functional/resource/user/dscl_spec.rb +3 -3
  150. data/spec/functional/resource/user/useradd_spec.rb +32 -26
  151. data/spec/functional/resource/windows_service_spec.rb +15 -15
  152. data/spec/functional/rest_spec.rb +2 -2
  153. data/spec/functional/run_lock_spec.rb +9 -9
  154. data/spec/functional/tiny_server_spec.rb +9 -8
  155. data/spec/functional/win32/crypto_spec.rb +1 -1
  156. data/spec/functional/win32/security_spec.rb +8 -8
  157. data/spec/integration/client/client_spec.rb +6 -4
  158. data/spec/integration/knife/chef_repo_path_spec.rb +70 -1
  159. data/spec/integration/knife/upload_spec.rb +1 -1
  160. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +6 -6
  161. data/spec/integration/recipes/noop_resource_spec.rb +4 -4
  162. data/spec/integration/recipes/provider_choice.rb +3 -3
  163. data/spec/integration/recipes/recipe_dsl_spec.rb +318 -317
  164. data/spec/integration/recipes/resource_action_spec.rb +50 -54
  165. data/spec/integration/recipes/resource_converge_if_changed_spec.rb +34 -34
  166. data/spec/integration/recipes/resource_load_spec.rb +24 -24
  167. data/spec/integration/solo/solo_spec.rb +21 -30
  168. data/spec/scripts/ssl-serve.rb +1 -1
  169. data/spec/spec_helper.rb +1 -0
  170. data/spec/stress/win32/security_spec.rb +4 -4
  171. data/spec/support/chef_helpers.rb +22 -0
  172. data/spec/support/platform_helpers.rb +5 -1
  173. data/spec/support/shared/context/client.rb +3 -2
  174. data/spec/support/shared/functional/file_resource.rb +5 -4
  175. data/spec/support/shared/functional/http.rb +16 -16
  176. data/spec/support/shared/functional/securable_resource.rb +5 -5
  177. data/spec/support/shared/functional/win32_service.rb +5 -7
  178. data/spec/support/shared/integration/app_server_support.rb +1 -3
  179. data/spec/support/shared/integration/knife_support.rb +0 -2
  180. data/spec/support/shared/shared_examples.rb +2 -2
  181. data/spec/support/shared/unit/api_versioning.rb +2 -2
  182. data/spec/support/shared/unit/application_dot_d.rb +9 -6
  183. data/spec/support/shared/unit/provider/file.rb +2 -2
  184. data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +49 -80
  185. data/spec/support/shared/unit/resource/static_provider_resolution.rb +2 -2
  186. data/spec/support/shared/unit/script_resource.rb +4 -4
  187. data/spec/support/shared/unit/user_and_client_shared.rb +4 -4
  188. data/spec/tiny_server.rb +51 -66
  189. data/spec/unit/api_client_v1_spec.rb +2 -2
  190. data/spec/unit/application_spec.rb +1 -1
  191. data/spec/unit/audit/audit_event_proxy_spec.rb +34 -27
  192. data/spec/unit/audit/audit_reporter_spec.rb +32 -23
  193. data/spec/unit/audit/control_group_data_spec.rb +19 -14
  194. data/spec/unit/chef_class_spec.rb +1 -1
  195. data/spec/unit/chef_fs/data_handler/group_handler_spec.rb +1 -1
  196. data/spec/unit/chef_fs/diff_spec.rb +4 -4
  197. data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +4 -4
  198. data/spec/unit/chef_fs/file_system_spec.rb +2 -2
  199. data/spec/unit/chef_fs/parallelizer.rb +5 -7
  200. data/spec/unit/cookbook/metadata_spec.rb +98 -98
  201. data/spec/unit/cookbook/synchronizer_spec.rb +7 -0
  202. data/spec/unit/cookbook_loader_spec.rb +24 -24
  203. data/spec/unit/cookbook_version_file_specificity_spec.rb +8 -8
  204. data/spec/unit/daemon_spec.rb +1 -1
  205. data/spec/unit/data_bag_item_spec.rb +18 -18
  206. data/spec/unit/data_bag_spec.rb +2 -2
  207. data/spec/unit/data_collector/messages/helpers_spec.rb +9 -9
  208. data/spec/unit/data_collector/messages_spec.rb +2 -2
  209. data/spec/unit/data_collector_spec.rb +19 -19
  210. data/spec/unit/dsl/audit_spec.rb +3 -3
  211. data/spec/unit/dsl/data_query_spec.rb +3 -2
  212. data/spec/unit/dsl/declare_resource_spec.rb +10 -10
  213. data/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb +3 -2
  214. data/spec/unit/encrypted_data_bag_item_spec.rb +3 -2
  215. data/spec/unit/environment_spec.rb +6 -6
  216. data/spec/unit/event_dispatch/dispatcher_spec.rb +2 -2
  217. data/spec/unit/file_access_control_spec.rb +3 -3
  218. data/spec/unit/file_content_management/tempfile_spec.rb +2 -2
  219. data/spec/unit/formatters/error_inspectors/api_error_formatting_spec.rb +2 -2
  220. data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +2 -2
  221. data/spec/unit/http/basic_client_spec.rb +20 -0
  222. data/spec/unit/http/validate_content_length_spec.rb +8 -8
  223. data/spec/unit/http_spec.rb +14 -0
  224. data/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb +2 -2
  225. data/spec/unit/knife/bootstrap/client_builder_spec.rb +2 -2
  226. data/spec/unit/knife/bootstrap_spec.rb +8 -6
  227. data/spec/unit/knife/client_bulk_delete_spec.rb +8 -8
  228. data/spec/unit/knife/client_edit_spec.rb +2 -2
  229. data/spec/unit/knife/configure_client_spec.rb +2 -2
  230. data/spec/unit/knife/cookbook_metadata_spec.rb +4 -4
  231. data/spec/unit/knife/cookbook_site_install_spec.rb +6 -5
  232. data/spec/unit/knife/cookbook_site_share_spec.rb +2 -2
  233. data/spec/unit/knife/core/hashed_command_loader_spec.rb +5 -4
  234. data/spec/unit/knife/core/node_editor_spec.rb +3 -3
  235. data/spec/unit/knife/core/ui_spec.rb +2 -2
  236. data/spec/unit/knife/data_bag_from_file_spec.rb +4 -3
  237. data/spec/unit/knife/data_bag_show_spec.rb +3 -2
  238. data/spec/unit/knife/key_create_spec.rb +14 -14
  239. data/spec/unit/knife/key_delete_spec.rb +2 -2
  240. data/spec/unit/knife/key_edit_spec.rb +16 -16
  241. data/spec/unit/knife/key_list_spec.rb +6 -6
  242. data/spec/unit/knife/key_show_spec.rb +4 -4
  243. data/spec/unit/knife/status_spec.rb +3 -2
  244. data/spec/unit/knife/user_create_spec.rb +4 -4
  245. data/spec/unit/knife_spec.rb +7 -6
  246. data/spec/unit/lwrp_spec.rb +6 -6
  247. data/spec/unit/mixin/api_version_request_handling_spec.rb +2 -2
  248. data/spec/unit/mixin/command_spec.rb +17 -14
  249. data/spec/unit/mixin/deprecation_spec.rb +1 -1
  250. data/spec/unit/mixin/homebrew_user_spec.rb +2 -2
  251. data/spec/unit/mixin/params_validate_spec.rb +53 -52
  252. data/spec/unit/mixin/powershell_out_spec.rb +2 -2
  253. data/spec/unit/mixin/powershell_type_coercions_spec.rb +2 -2
  254. data/spec/unit/mixin/shell_out_spec.rb +1 -1
  255. data/spec/unit/mixin/xml_escape_spec.rb +3 -3
  256. data/spec/unit/node_spec.rb +2 -2
  257. data/spec/unit/platform/query_helpers_spec.rb +3 -3
  258. data/spec/unit/property_spec.rb +4 -4
  259. data/spec/unit/provider/cookbook_file_spec.rb +4 -4
  260. data/spec/unit/provider/cron/unix_spec.rb +4 -4
  261. data/spec/unit/provider/cron_spec.rb +2 -2
  262. data/spec/unit/provider/deploy_spec.rb +8 -8
  263. data/spec/unit/provider/dsc_resource_spec.rb +11 -10
  264. data/spec/unit/provider/dsc_script_spec.rb +9 -9
  265. data/spec/unit/provider/env/windows_spec.rb +8 -8
  266. data/spec/unit/provider/file/content_spec.rb +6 -6
  267. data/spec/unit/provider/file_spec.rb +4 -4
  268. data/spec/unit/provider/launchd_spec.rb +2 -1
  269. data/spec/unit/provider/link_spec.rb +155 -0
  270. data/spec/unit/provider/mount/mount_spec.rb +5 -5
  271. data/spec/unit/provider/mount/solaris_spec.rb +48 -48
  272. data/spec/unit/provider/osx_profile_spec.rb +6 -0
  273. data/spec/unit/provider/package/chocolatey_spec.rb +4 -4
  274. data/spec/unit/provider/package/freebsd/port_spec.rb +4 -4
  275. data/spec/unit/provider/package/rubygems_spec.rb +50 -44
  276. data/spec/unit/provider/package/windows/exe_spec.rb +9 -0
  277. data/spec/unit/provider/package/yum_spec.rb +61 -60
  278. data/spec/unit/provider/package_spec.rb +2 -2
  279. data/spec/unit/provider/powershell_script_spec.rb +4 -4
  280. data/spec/unit/provider/remote_directory_spec.rb +1 -1
  281. data/spec/unit/provider/remote_file/ftp_spec.rb +4 -4
  282. data/spec/unit/provider/remote_file/local_file_spec.rb +4 -2
  283. data/spec/unit/provider/remote_file/sftp_spec.rb +4 -4
  284. data/spec/unit/provider/remote_file_spec.rb +4 -4
  285. data/spec/unit/provider/script_spec.rb +4 -4
  286. data/spec/unit/provider/service/debian_service_spec.rb +4 -4
  287. data/spec/unit/provider/service/freebsd_service_spec.rb +12 -8
  288. data/spec/unit/provider/service/openbsd_service_spec.rb +12 -8
  289. data/spec/unit/provider/service/systemd_service_spec.rb +4 -4
  290. data/spec/unit/provider/service/upstart_service_spec.rb +27 -12
  291. data/spec/unit/provider/service/windows_spec.rb +10 -10
  292. data/spec/unit/provider/systemd_unit_spec.rb +2 -2
  293. data/spec/unit/provider/template/content_spec.rb +8 -8
  294. data/spec/unit/provider/template_spec.rb +8 -8
  295. data/spec/unit/provider/user/dscl_spec.rb +51 -51
  296. data/spec/unit/provider/user/linux_spec.rb +76 -0
  297. data/spec/unit/provider/user/pw_spec.rb +3 -6
  298. data/spec/unit/provider/user/solaris_spec.rb +5 -5
  299. data/spec/unit/provider/user/windows_spec.rb +3 -3
  300. data/spec/unit/provider/user_spec.rb +2 -2
  301. data/spec/unit/provider/yum_repository_spec.rb +35 -0
  302. data/spec/unit/provider_resolver_spec.rb +306 -264
  303. data/spec/unit/recipe_spec.rb +8 -7
  304. data/spec/unit/resource/apt_repository_spec.rb +4 -4
  305. data/spec/unit/resource/apt_update_spec.rb +4 -4
  306. data/spec/unit/resource/conditional_spec.rb +46 -0
  307. data/spec/unit/resource/dsc_resource_spec.rb +8 -8
  308. data/spec/unit/resource/dsc_script_spec.rb +4 -4
  309. data/spec/unit/resource/freebsd_package_spec.rb +6 -6
  310. data/spec/unit/resource/launchd_spec.rb +3 -2
  311. data/spec/unit/resource/osx_profile_spec.rb +3 -2
  312. data/spec/unit/resource/remote_file_spec.rb +6 -6
  313. data/spec/unit/resource/service_spec.rb +14 -14
  314. data/spec/unit/resource/user_spec.rb +1 -1
  315. data/spec/unit/resource/yum_repository_spec.rb +49 -0
  316. data/spec/unit/resource_collection_spec.rb +4 -4
  317. data/spec/unit/resource_definition_spec.rb +11 -11
  318. data/spec/unit/resource_reporter_spec.rb +4 -4
  319. data/spec/unit/resource_resolver_spec.rb +6 -6
  320. data/spec/unit/resource_spec.rb +36 -16
  321. data/spec/unit/run_context/child_run_context_spec.rb +4 -4
  322. data/spec/unit/run_context/cookbook_compiler_spec.rb +43 -1
  323. data/spec/unit/run_context_spec.rb +8 -8
  324. data/spec/unit/run_list/run_list_expansion_spec.rb +2 -2
  325. data/spec/unit/runner_spec.rb +2 -2
  326. data/spec/unit/search/query_spec.rb +15 -14
  327. data/spec/unit/user_v1_spec.rb +8 -8
  328. data/spec/unit/util/dsc/configuration_generator_spec.rb +12 -12
  329. data/spec/unit/util/dsc/local_configuration_manager_spec.rb +12 -9
  330. data/spec/unit/util/dsc/resource_store.rb +8 -6
  331. data/spec/unit/util/editor_spec.rb +6 -6
  332. data/spec/unit/util/powershell/cmdlet_spec.rb +10 -10
  333. data/tasks/bin/bundle-platform +1 -0
  334. data/tasks/bin/bundler_patch.rb +27 -0
  335. data/tasks/cbgb.rb +2 -2
  336. data/tasks/maintainers.rb +2 -2
  337. metadata +37 -8
  338. data/spec/unit/provider/user/useradd_spec.rb +0 -51
@@ -1064,7 +1064,7 @@ EOM
1064
1064
 
1065
1065
  when_the_repository "has a modified, extra and missing file for the cookbook" do
1066
1066
  before do
1067
- file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0", '#modified')
1067
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0", "#modified")
1068
1068
  file "cookbooks/x-1.0.0/y.rb", "hi"
1069
1069
  end
1070
1070
 
@@ -38,9 +38,9 @@ describe "LWRPs with inline resources" do
38
38
 
39
39
  it "this is totally a bug, but for backcompat purposes, it adds the resources to the main resource collection and does not get marked updated" do
40
40
  r = nil
41
- expect_recipe {
41
+ expect_recipe do
42
42
  r = lwrp_inline_resources_test "hi"
43
- }.to have_updated("ruby_block[run a]", :run)
43
+ end.to have_updated("ruby_block[run a]", :run)
44
44
  expect(r.ran_a).to eq "ran a"
45
45
  end
46
46
  end
@@ -64,11 +64,11 @@ describe "LWRPs with inline resources" do
64
64
  # https://github.com/chef/chef/issues/4334
65
65
  it "does not warn spuriously" do
66
66
  expect(Chef::Log).to_not receive(:warn).with(/is declared in both/)
67
- expect_recipe {
67
+ expect_recipe do
68
68
  lwrp_shadowed_property_test "fnord" do
69
69
  action :fiddle
70
70
  end
71
- }
71
+ end
72
72
  end
73
73
  end
74
74
 
@@ -104,11 +104,11 @@ describe "LWRPs with inline resources" do
104
104
 
105
105
  it "resources declared in b are executed immediately inline" do
106
106
  r = nil
107
- expect_recipe {
107
+ expect_recipe do
108
108
  r = lwrp_inline_resources_test2 "hi" do
109
109
  action :b
110
110
  end
111
- }.to have_updated("lwrp_inline_resources_test2[hi]", :b).
111
+ end.to have_updated("lwrp_inline_resources_test2[hi]", :b).
112
112
  and have_updated("ruby_block[run a]", :run).
113
113
  and have_updated("ruby_block[run b]", :run)
114
114
  expect(r.ran_b).to eq "ran b: ran_a value was \"ran a\""
@@ -4,20 +4,20 @@ describe "Resources with a no-op provider" do
4
4
  include IntegrationSupport
5
5
 
6
6
  context "with noop provider providing foo" do
7
- before(:context) {
7
+ before(:context) do
8
8
  class NoOpFoo < Chef::Resource
9
9
  resource_name "hi_there"
10
10
  default_action :update
11
11
  end
12
12
  Chef::Provider::Noop.provides :hi_there
13
- }
13
+ end
14
14
 
15
15
  it "does not blow up a run with a noop'd resource" do
16
- recipe = converge {
16
+ recipe = converge do
17
17
  hi_there "blah" do
18
18
  action :update
19
19
  end
20
- }
20
+ end
21
21
  expect(recipe.logged_warnings).to eq ""
22
22
  end
23
23
  end
@@ -26,9 +26,9 @@ describe "Recipe DSL methods" do
26
26
  end
27
27
 
28
28
  it "provider_thingy 'blah' runs the provider and warns" do
29
- recipe = converge {
30
- provider_thingy "blah" do; end
31
- }
29
+ recipe = converge do
30
+ provider_thingy("blah") {}
31
+ end
32
32
  expect(recipe.logged_warnings).to match /hello from Chef::Provider::ProviderThingy/
33
33
  expect(recipe.logged_warnings).to match /you must use 'provides' to provide DSL/i
34
34
  end
@@ -12,7 +12,7 @@ describe "Recipe DSL methods" do
12
12
  before { Namer.current_index += 1 }
13
13
 
14
14
  context "with resource 'base_thingy' declared as BaseThingy" do
15
- before(:context) {
15
+ before(:context) do
16
16
 
17
17
  class BaseThingy < Chef::Resource
18
18
  resource_name "base_thingy"
@@ -43,7 +43,7 @@ describe "Recipe DSL methods" do
43
43
  module RecipeDSLSpecNamespace; end
44
44
  module RecipeDSLSpecNamespace::Bar; end
45
45
 
46
- }
46
+ end
47
47
 
48
48
  before :each do
49
49
  BaseThingy.created_resource = nil
@@ -51,26 +51,26 @@ describe "Recipe DSL methods" do
51
51
  end
52
52
 
53
53
  it "creates base_thingy when you call base_thingy in a recipe" do
54
- recipe = converge {
55
- base_thingy "blah" do; end
56
- }
54
+ recipe = converge do
55
+ base_thingy("blah") {}
56
+ end
57
57
  expect(recipe.logged_warnings).to eq ""
58
58
  expect(BaseThingy.created_name).to eq "blah"
59
59
  expect(BaseThingy.created_resource).to eq BaseThingy
60
60
  end
61
61
 
62
62
  it "errors out when you call base_thingy do ... end in a recipe" do
63
- expect_converge {
64
- base_thingy do; end
65
- }.to raise_error(ArgumentError, "You must supply a name when declaring a base_thingy resource")
63
+ expect_converge do
64
+ base_thingy { ; }
65
+ end.to raise_error(ArgumentError, "You must supply a name when declaring a base_thingy resource")
66
66
  end
67
67
 
68
68
  it "emits a warning when you call base_thingy 'foo', 'bar' do ... end in a recipe" do
69
69
  Chef::Config[:treat_deprecation_warnings_as_errors] = false
70
- recipe = converge {
70
+ recipe = converge do
71
71
  base_thingy "foo", "bar" do
72
72
  end
73
- }
73
+ end
74
74
  expect(recipe.logged_warnings).to match(/Cannot create resource base_thingy with more than one argument. All arguments except the name \("foo"\) will be ignored. This will cause an error in Chef 13. Arguments: \["foo", "bar"\]/)
75
75
  expect(BaseThingy.created_name).to eq "foo"
76
76
  expect(BaseThingy.created_resource).to eq BaseThingy
@@ -82,7 +82,7 @@ describe "Recipe DSL methods" do
82
82
  end
83
83
 
84
84
  context "with a resource 'backcompat_thingy' declared in Chef::Resource and Chef::Provider" do
85
- before(:context) {
85
+ before(:context) do
86
86
 
87
87
  class Chef::Resource::BackcompatThingy < Chef::Resource
88
88
  default_action :create
@@ -97,30 +97,30 @@ describe "Recipe DSL methods" do
97
97
  end
98
98
  end
99
99
 
100
- }
100
+ end
101
101
 
102
102
  it "backcompat_thingy creates a Chef::Resource::BackcompatThingy" do
103
- recipe = converge {
104
- backcompat_thingy "blah" do; end
105
- }
103
+ recipe = converge do
104
+ backcompat_thingy("blah") {}
105
+ end
106
106
  expect(BaseThingy.created_resource).to eq Chef::Resource::BackcompatThingy
107
107
  expect(BaseThingy.created_provider).to eq Chef::Provider::BackcompatThingy
108
108
  end
109
109
 
110
110
  context "and another resource 'backcompat_thingy' in BackcompatThingy with 'provides'" do
111
- before(:context) {
111
+ before(:context) do
112
112
 
113
113
  class RecipeDSLSpecNamespace::BackcompatThingy < BaseThingy
114
114
  provides :backcompat_thingy
115
115
  resource_name :backcompat_thingy
116
116
  end
117
117
 
118
- }
118
+ end
119
119
 
120
120
  it "backcompat_thingy creates a BackcompatThingy" do
121
- recipe = converge {
122
- backcompat_thingy "blah" do; end
123
- }
121
+ recipe = converge do
122
+ backcompat_thingy("blah") {}
123
+ end
124
124
  expect(recipe.logged_warnings).to match(/Class Chef::Provider::BackcompatThingy does not declare 'provides :backcompat_thingy'./)
125
125
  expect(BaseThingy.created_resource).not_to be_nil
126
126
  end
@@ -128,86 +128,86 @@ describe "Recipe DSL methods" do
128
128
  end
129
129
 
130
130
  context "with a resource named RecipeDSLSpecNamespace::Bar::BarThingy" do
131
- before(:context) {
131
+ before(:context) do
132
132
 
133
133
  class RecipeDSLSpecNamespace::Bar::BarThingy < BaseThingy
134
134
  end
135
135
 
136
- }
136
+ end
137
137
 
138
138
  it "bar_thingy does not work" do
139
- expect_converge {
140
- bar_thingy "blah" do; end
141
- }.to raise_error(NoMethodError)
139
+ expect_converge do
140
+ bar_thingy("blah") {}
141
+ end.to raise_error(NoMethodError)
142
142
  end
143
143
  end
144
144
 
145
145
  context "with a resource named Chef::Resource::NoNameThingy with resource_name nil" do
146
- before(:context) {
146
+ before(:context) do
147
147
 
148
148
  class Chef::Resource::NoNameThingy < BaseThingy
149
149
  resource_name nil
150
150
  end
151
151
 
152
- }
152
+ end
153
153
 
154
154
  it "no_name_thingy does not work" do
155
- expect_converge {
156
- no_name_thingy "blah" do; end
157
- }.to raise_error(NoMethodError)
155
+ expect_converge do
156
+ no_name_thingy("blah") {}
157
+ end.to raise_error(NoMethodError)
158
158
  end
159
159
  end
160
160
 
161
161
  context "with a resource named AnotherNoNameThingy with resource_name :another_thingy_name" do
162
- before(:context) {
162
+ before(:context) do
163
163
 
164
164
  class AnotherNoNameThingy < BaseThingy
165
165
  resource_name :another_thingy_name
166
166
  end
167
167
 
168
- }
168
+ end
169
169
 
170
170
  it "another_no_name_thingy does not work" do
171
- expect_converge {
172
- another_no_name_thingy "blah" do; end
173
- }.to raise_error(NoMethodError)
171
+ expect_converge do
172
+ another_no_name_thingy("blah") {}
173
+ end.to raise_error(NoMethodError)
174
174
  end
175
175
 
176
176
  it "another_thingy_name works" do
177
- recipe = converge {
178
- another_thingy_name "blah" do; end
179
- }
177
+ recipe = converge do
178
+ another_thingy_name("blah") {}
179
+ end
180
180
  expect(recipe.logged_warnings).to eq ""
181
181
  expect(BaseThingy.created_resource).to eq(AnotherNoNameThingy)
182
182
  end
183
183
  end
184
184
 
185
185
  context "with a resource named AnotherNoNameThingy2 with resource_name :another_thingy_name2; resource_name :another_thingy_name3" do
186
- before(:context) {
186
+ before(:context) do
187
187
 
188
188
  class AnotherNoNameThingy2 < BaseThingy
189
189
  resource_name :another_thingy_name2
190
190
  resource_name :another_thingy_name3
191
191
  end
192
192
 
193
- }
193
+ end
194
194
 
195
195
  it "another_no_name_thingy does not work" do
196
- expect_converge {
197
- another_no_name_thingy2 "blah" do; end
198
- }.to raise_error(NoMethodError)
196
+ expect_converge do
197
+ another_no_name_thingy2("blah") {}
198
+ end.to raise_error(NoMethodError)
199
199
  end
200
200
 
201
201
  it "another_thingy_name2 does not work" do
202
- expect_converge {
203
- another_thingy_name2 "blah" do; end
204
- }.to raise_error(NoMethodError)
202
+ expect_converge do
203
+ another_thingy_name2("blah") {}
204
+ end.to raise_error(NoMethodError)
205
205
  end
206
206
 
207
207
  it "yet_another_thingy_name3 works" do
208
- recipe = converge {
209
- another_thingy_name3 "blah" do; end
210
- }
208
+ recipe = converge do
209
+ another_thingy_name3("blah") {}
210
+ end
211
211
  expect(recipe.logged_warnings).to eq ""
212
212
  expect(BaseThingy.created_resource).to eq(AnotherNoNameThingy2)
213
213
  end
@@ -215,36 +215,36 @@ describe "Recipe DSL methods" do
215
215
 
216
216
  context "provides overriding resource_name" do
217
217
  context "with a resource named AnotherNoNameThingy3 with provides :another_no_name_thingy3, os: 'blarghle'" do
218
- before(:context) {
218
+ before(:context) do
219
219
 
220
220
  class AnotherNoNameThingy3 < BaseThingy
221
221
  resource_name :another_no_name_thingy_3
222
222
  provides :another_no_name_thingy3, os: "blarghle"
223
223
  end
224
224
 
225
- }
225
+ end
226
226
 
227
227
  it "and os = linux, another_no_name_thingy3 does not work" do
228
- expect_converge {
228
+ expect_converge do
229
229
  # TODO this is an ugly way to test, make Cheffish expose node attrs
230
230
  run_context.node.automatic[:os] = "linux"
231
- another_no_name_thingy3 "blah" do; end
232
- }.to raise_error(Chef::Exceptions::NoSuchResourceType)
231
+ another_no_name_thingy3("blah") {}
232
+ end.to raise_error(Chef::Exceptions::NoSuchResourceType)
233
233
  end
234
234
 
235
235
  it "and os = blarghle, another_no_name_thingy3 works" do
236
- recipe = converge {
236
+ recipe = converge do
237
237
  # TODO this is an ugly way to test, make Cheffish expose node attrs
238
238
  run_context.node.automatic[:os] = "blarghle"
239
- another_no_name_thingy3 "blah" do; end
240
- }
239
+ another_no_name_thingy3("blah") {}
240
+ end
241
241
  expect(recipe.logged_warnings).to eq ""
242
242
  expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy3)
243
243
  end
244
244
  end
245
245
 
246
246
  context "with a resource named AnotherNoNameThingy4 with two provides" do
247
- before(:context) {
247
+ before(:context) do
248
248
 
249
249
  class AnotherNoNameThingy4 < BaseThingy
250
250
  resource_name :another_no_name_thingy_4
@@ -252,183 +252,183 @@ describe "Recipe DSL methods" do
252
252
  provides :another_no_name_thingy4, platform_family: "foo"
253
253
  end
254
254
 
255
- }
255
+ end
256
256
 
257
257
  it "and os = linux, another_no_name_thingy4 does not work" do
258
- expect_converge {
258
+ expect_converge do
259
259
  # TODO this is an ugly way to test, make Cheffish expose node attrs
260
260
  run_context.node.automatic[:os] = "linux"
261
- another_no_name_thingy4 "blah" do; end
262
- }.to raise_error(Chef::Exceptions::NoSuchResourceType)
261
+ another_no_name_thingy4("blah") {}
262
+ end.to raise_error(Chef::Exceptions::NoSuchResourceType)
263
263
  end
264
264
 
265
265
  it "and os = blarghle, another_no_name_thingy4 works" do
266
- recipe = converge {
266
+ recipe = converge do
267
267
  # TODO this is an ugly way to test, make Cheffish expose node attrs
268
268
  run_context.node.automatic[:os] = "blarghle"
269
- another_no_name_thingy4 "blah" do; end
270
- }
269
+ another_no_name_thingy4("blah") {}
270
+ end
271
271
  expect(recipe.logged_warnings).to eq ""
272
272
  expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy4)
273
273
  end
274
274
 
275
275
  it "and platform_family = foo, another_no_name_thingy4 works" do
276
- recipe = converge {
276
+ recipe = converge do
277
277
  # TODO this is an ugly way to test, make Cheffish expose node attrs
278
278
  run_context.node.automatic[:platform_family] = "foo"
279
- another_no_name_thingy4 "blah" do; end
280
- }
279
+ another_no_name_thingy4("blah") {}
280
+ end
281
281
  expect(recipe.logged_warnings).to eq ""
282
282
  expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy4)
283
283
  end
284
284
  end
285
285
 
286
286
  context "with a resource named AnotherNoNameThingy5, a different resource_name, and a provides with the original resource_name" do
287
- before(:context) {
287
+ before(:context) do
288
288
 
289
289
  class AnotherNoNameThingy5 < BaseThingy
290
290
  resource_name :another_thingy_name_for_another_no_name_thingy5
291
291
  provides :another_no_name_thingy5, os: "blarghle"
292
292
  end
293
293
 
294
- }
294
+ end
295
295
 
296
296
  it "and os = linux, another_no_name_thingy5 does not work" do
297
- expect_converge {
297
+ expect_converge do
298
298
  # this is an ugly way to test, make Cheffish expose node attrs
299
299
  run_context.node.automatic[:os] = "linux"
300
- another_no_name_thingy5 "blah" do; end
301
- }.to raise_error(Chef::Exceptions::NoSuchResourceType)
300
+ another_no_name_thingy5("blah") {}
301
+ end.to raise_error(Chef::Exceptions::NoSuchResourceType)
302
302
  end
303
303
 
304
304
  it "and os = blarghle, another_no_name_thingy5 works" do
305
- recipe = converge {
305
+ recipe = converge do
306
306
  # this is an ugly way to test, make Cheffish expose node attrs
307
307
  run_context.node.automatic[:os] = "blarghle"
308
- another_no_name_thingy5 "blah" do; end
309
- }
308
+ another_no_name_thingy5("blah") {}
309
+ end
310
310
  expect(recipe.logged_warnings).to eq ""
311
311
  expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy5)
312
312
  end
313
313
 
314
314
  it "the new resource name can be used in a recipe" do
315
- recipe = converge {
316
- another_thingy_name_for_another_no_name_thingy5 "blah" do; end
317
- }
315
+ recipe = converge do
316
+ another_thingy_name_for_another_no_name_thingy5("blah") {}
317
+ end
318
318
  expect(recipe.logged_warnings).to eq ""
319
319
  expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy5)
320
320
  end
321
321
  end
322
322
 
323
323
  context "with a resource named AnotherNoNameThingy6, a provides with the original resource name, and a different resource_name" do
324
- before(:context) {
324
+ before(:context) do
325
325
 
326
326
  class AnotherNoNameThingy6 < BaseThingy
327
327
  provides :another_no_name_thingy6, os: "blarghle"
328
328
  resource_name :another_thingy_name_for_another_no_name_thingy6
329
329
  end
330
330
 
331
- }
331
+ end
332
332
 
333
333
  it "and os = linux, another_no_name_thingy6 does not work" do
334
- expect_converge {
334
+ expect_converge do
335
335
  # this is an ugly way to test, make Cheffish expose node attrs
336
336
  run_context.node.automatic[:os] = "linux"
337
- another_no_name_thingy6 "blah" do; end
338
- }.to raise_error(Chef::Exceptions::NoSuchResourceType)
337
+ another_no_name_thingy6("blah") {}
338
+ end.to raise_error(Chef::Exceptions::NoSuchResourceType)
339
339
  end
340
340
 
341
341
  it "and os = blarghle, another_no_name_thingy6 works" do
342
- recipe = converge {
342
+ recipe = converge do
343
343
  # this is an ugly way to test, make Cheffish expose node attrs
344
344
  run_context.node.automatic[:os] = "blarghle"
345
- another_no_name_thingy6 "blah" do; end
346
- }
345
+ another_no_name_thingy6("blah") {}
346
+ end
347
347
  expect(recipe.logged_warnings).to eq ""
348
348
  expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy6)
349
349
  end
350
350
 
351
351
  it "the new resource name can be used in a recipe" do
352
- recipe = converge {
353
- another_thingy_name_for_another_no_name_thingy6 "blah" do; end
354
- }
352
+ recipe = converge do
353
+ another_thingy_name_for_another_no_name_thingy6("blah") {}
354
+ end
355
355
  expect(recipe.logged_warnings).to eq ""
356
356
  expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy6)
357
357
  end
358
358
  end
359
359
 
360
360
  context "with a resource named AnotherNoNameThingy7, a new resource_name, and provides with that new resource name" do
361
- before(:context) {
361
+ before(:context) do
362
362
 
363
363
  class AnotherNoNameThingy7 < BaseThingy
364
364
  resource_name :another_thingy_name_for_another_no_name_thingy7
365
365
  provides :another_thingy_name_for_another_no_name_thingy7, os: "blarghle"
366
366
  end
367
367
 
368
- }
368
+ end
369
369
 
370
370
  it "and os = linux, another_thingy_name_for_another_no_name_thingy7 does not work" do
371
- expect_converge {
371
+ expect_converge do
372
372
  # this is an ugly way to test, make Cheffish expose node attrs
373
373
  run_context.node.automatic[:os] = "linux"
374
- another_thingy_name_for_another_no_name_thingy7 "blah" do; end
375
- }.to raise_error(Chef::Exceptions::NoSuchResourceType)
374
+ another_thingy_name_for_another_no_name_thingy7("blah") {}
375
+ end.to raise_error(Chef::Exceptions::NoSuchResourceType)
376
376
  end
377
377
 
378
378
  it "and os = blarghle, another_thingy_name_for_another_no_name_thingy7 works" do
379
- recipe = converge {
379
+ recipe = converge do
380
380
  # this is an ugly way to test, make Cheffish expose node attrs
381
381
  run_context.node.automatic[:os] = "blarghle"
382
- another_thingy_name_for_another_no_name_thingy7 "blah" do; end
383
- }
382
+ another_thingy_name_for_another_no_name_thingy7("blah") {}
383
+ end
384
384
  expect(recipe.logged_warnings).to eq ""
385
385
  expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy7)
386
386
  end
387
387
 
388
388
  it "the old resource name does not work" do
389
- expect_converge {
389
+ expect_converge do
390
390
  # this is an ugly way to test, make Cheffish expose node attrs
391
391
  run_context.node.automatic[:os] = "linux"
392
- another_no_name_thingy_7 "blah" do; end
393
- }.to raise_error(NoMethodError)
392
+ another_no_name_thingy_7("blah") {}
393
+ end.to raise_error(NoMethodError)
394
394
  end
395
395
  end
396
396
 
397
397
  # opposite order from the previous test (provides, then resource_name)
398
398
  context "with a resource named AnotherNoNameThingy8, a provides with a new resource name, and resource_name with that new resource name" do
399
- before(:context) {
399
+ before(:context) do
400
400
 
401
401
  class AnotherNoNameThingy8 < BaseThingy
402
402
  provides :another_thingy_name_for_another_no_name_thingy8, os: "blarghle"
403
403
  resource_name :another_thingy_name_for_another_no_name_thingy8
404
404
  end
405
405
 
406
- }
406
+ end
407
407
 
408
408
  it "and os = linux, another_thingy_name_for_another_no_name_thingy8 does not work" do
409
- expect_converge {
409
+ expect_converge do
410
410
  # this is an ugly way to test, make Cheffish expose node attrs
411
411
  run_context.node.automatic[:os] = "linux"
412
- another_thingy_name_for_another_no_name_thingy8 "blah" do; end
413
- }.to raise_error(Chef::Exceptions::NoSuchResourceType)
412
+ another_thingy_name_for_another_no_name_thingy8("blah") {}
413
+ end.to raise_error(Chef::Exceptions::NoSuchResourceType)
414
414
  end
415
415
 
416
416
  it "and os = blarghle, another_thingy_name_for_another_no_name_thingy8 works" do
417
- recipe = converge {
417
+ recipe = converge do
418
418
  # this is an ugly way to test, make Cheffish expose node attrs
419
419
  run_context.node.automatic[:os] = "blarghle"
420
- another_thingy_name_for_another_no_name_thingy8 "blah" do; end
421
- }
420
+ another_thingy_name_for_another_no_name_thingy8("blah") {}
421
+ end
422
422
  expect(recipe.logged_warnings).to eq ""
423
423
  expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy8)
424
424
  end
425
425
 
426
426
  it "the old resource name does not work" do
427
- expect_converge {
427
+ expect_converge do
428
428
  # this is an ugly way to test, make Cheffish expose node attrs
429
429
  run_context.node.automatic[:os] = "linux"
430
- another_thingy_name8 "blah" do; end
431
- }.to raise_error(NoMethodError)
430
+ another_thingy_name8("blah") {}
431
+ end.to raise_error(NoMethodError)
432
432
  end
433
433
  end
434
434
  end
@@ -436,64 +436,64 @@ describe "Recipe DSL methods" do
436
436
 
437
437
  context "provides" do
438
438
  context "when MySupplier provides :hemlock" do
439
- before(:context) {
439
+ before(:context) do
440
440
 
441
441
  class RecipeDSLSpecNamespace::MySupplier < BaseThingy
442
442
  resource_name :hemlock
443
443
  end
444
444
 
445
- }
445
+ end
446
446
 
447
447
  it "my_supplier does not work in a recipe" do
448
- expect_converge {
449
- my_supplier "blah" do; end
450
- }.to raise_error(NoMethodError)
448
+ expect_converge do
449
+ my_supplier("blah") {}
450
+ end.to raise_error(NoMethodError)
451
451
  end
452
452
 
453
453
  it "hemlock works in a recipe" do
454
- expect_recipe {
455
- hemlock "blah" do; end
456
- }.to emit_no_warnings_or_errors
454
+ expect_recipe do
455
+ hemlock("blah") {}
456
+ end.to emit_no_warnings_or_errors
457
457
  expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::MySupplier
458
458
  end
459
459
  end
460
460
 
461
461
  context "when Thingy3 has resource_name :thingy3" do
462
- before(:context) {
462
+ before(:context) do
463
463
 
464
464
  class RecipeDSLSpecNamespace::Thingy3 < BaseThingy
465
465
  resource_name :thingy3
466
466
  end
467
467
 
468
- }
468
+ end
469
469
 
470
470
  it "thingy3 works in a recipe" do
471
- expect_recipe {
472
- thingy3 "blah" do; end
473
- }.to emit_no_warnings_or_errors
471
+ expect_recipe do
472
+ thingy3("blah") {}
473
+ end.to emit_no_warnings_or_errors
474
474
  expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
475
475
  end
476
476
 
477
477
  context "and Thingy4 has resource_name :thingy3" do
478
- before(:context) {
478
+ before(:context) do
479
479
 
480
480
  class RecipeDSLSpecNamespace::Thingy4 < BaseThingy
481
481
  resource_name :thingy3
482
482
  end
483
483
 
484
- }
484
+ end
485
485
 
486
486
  it "thingy3 works in a recipe and yields Thingy3 (the alphabetical one)" do
487
- recipe = converge {
488
- thingy3 "blah" do; end
489
- }
487
+ recipe = converge do
488
+ thingy3("blah") {}
489
+ end
490
490
  expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
491
491
  end
492
492
 
493
493
  it "thingy4 does not work in a recipe" do
494
- expect_converge {
495
- thingy4 "blah" do; end
496
- }.to raise_error(NoMethodError)
494
+ expect_converge do
495
+ thingy4("blah") {}
496
+ end.to raise_error(NoMethodError)
497
497
  end
498
498
 
499
499
  it "resource_matching_short_name returns Thingy4" do
@@ -503,7 +503,7 @@ describe "Recipe DSL methods" do
503
503
  end
504
504
 
505
505
  context "when Thingy5 has resource_name :thingy5 and provides :thingy5reverse, :thingy5_2 and :thingy5_2reverse" do
506
- before(:context) {
506
+ before(:context) do
507
507
 
508
508
  class RecipeDSLSpecNamespace::Thingy5 < BaseThingy
509
509
  resource_name :thingy5
@@ -512,36 +512,36 @@ describe "Recipe DSL methods" do
512
512
  provides :thingy5_2reverse
513
513
  end
514
514
 
515
- }
515
+ end
516
516
 
517
517
  it "thingy5 works in a recipe" do
518
- expect_recipe {
519
- thingy5 "blah" do; end
520
- }.to emit_no_warnings_or_errors
518
+ expect_recipe do
519
+ thingy5("blah") {}
520
+ end.to emit_no_warnings_or_errors
521
521
  expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy5
522
522
  end
523
523
 
524
524
  context "and Thingy6 provides :thingy5" do
525
- before(:context) {
525
+ before(:context) do
526
526
 
527
527
  class RecipeDSLSpecNamespace::Thingy6 < BaseThingy
528
528
  resource_name :thingy6
529
529
  provides :thingy5
530
530
  end
531
531
 
532
- }
532
+ end
533
533
 
534
534
  it "thingy6 works in a recipe and yields Thingy6" do
535
- recipe = converge {
536
- thingy6 "blah" do; end
537
- }
535
+ recipe = converge do
536
+ thingy6("blah") {}
537
+ end
538
538
  expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy6
539
539
  end
540
540
 
541
541
  it "thingy5 works in a recipe and yields Foo::Thingy5 (the alphabetical one)" do
542
- recipe = converge {
543
- thingy5 "blah" do; end
544
- }
542
+ recipe = converge do
543
+ thingy5("blah") {}
544
+ end
545
545
  expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy5
546
546
  end
547
547
 
@@ -550,24 +550,24 @@ describe "Recipe DSL methods" do
550
550
  end
551
551
 
552
552
  context "and AThingy5 provides :thingy5reverse" do
553
- before(:context) {
553
+ before(:context) do
554
554
 
555
555
  class RecipeDSLSpecNamespace::AThingy5 < BaseThingy
556
556
  resource_name :thingy5reverse
557
557
  end
558
558
 
559
- }
559
+ end
560
560
 
561
561
  it "thingy5reverse works in a recipe and yields AThingy5 (the alphabetical one)" do
562
- recipe = converge {
563
- thingy5reverse "blah" do; end
564
- }
562
+ recipe = converge do
563
+ thingy5reverse("blah") {}
564
+ end
565
565
  expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::AThingy5
566
566
  end
567
567
  end
568
568
 
569
569
  context "and ZRecipeDSLSpecNamespace::Thingy5 provides :thingy5_2" do
570
- before(:context) {
570
+ before(:context) do
571
571
 
572
572
  module ZRecipeDSLSpecNamespace
573
573
  class Thingy5 < BaseThingy
@@ -575,18 +575,18 @@ describe "Recipe DSL methods" do
575
575
  end
576
576
  end
577
577
 
578
- }
578
+ end
579
579
 
580
580
  it "thingy5_2 works in a recipe and yields the RecipeDSLSpaceNamespace one (the alphabetical one)" do
581
- recipe = converge {
582
- thingy5_2 "blah" do; end
583
- }
581
+ recipe = converge do
582
+ thingy5_2("blah") {}
583
+ end
584
584
  expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy5
585
585
  end
586
586
  end
587
587
 
588
588
  context "and ARecipeDSLSpecNamespace::Thingy5 provides :thingy5_2" do
589
- before(:context) {
589
+ before(:context) do
590
590
 
591
591
  module ARecipeDSLSpecNamespace
592
592
  class Thingy5 < BaseThingy
@@ -594,53 +594,53 @@ describe "Recipe DSL methods" do
594
594
  end
595
595
  end
596
596
 
597
- }
597
+ end
598
598
 
599
599
  it "thingy5_2reverse works in a recipe and yields the ARecipeDSLSpaceNamespace one (the alphabetical one)" do
600
- recipe = converge {
601
- thingy5_2reverse "blah" do; end
602
- }
600
+ recipe = converge do
601
+ thingy5_2reverse("blah") {}
602
+ end
603
603
  expect(BaseThingy.created_resource).to eq ARecipeDSLSpecNamespace::Thingy5
604
604
  end
605
605
  end
606
606
  end
607
607
 
608
608
  context "when Thingy3 has resource_name :thingy3" do
609
- before(:context) {
609
+ before(:context) do
610
610
 
611
611
  class RecipeDSLSpecNamespace::Thingy3 < BaseThingy
612
612
  resource_name :thingy3
613
613
  end
614
614
 
615
- }
615
+ end
616
616
 
617
617
  it "thingy3 works in a recipe" do
618
- expect_recipe {
619
- thingy3 "blah" do; end
620
- }.to emit_no_warnings_or_errors
618
+ expect_recipe do
619
+ thingy3("blah") {}
620
+ end.to emit_no_warnings_or_errors
621
621
  expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
622
622
  end
623
623
 
624
624
  context "and Thingy4 has resource_name :thingy3" do
625
- before(:context) {
625
+ before(:context) do
626
626
 
627
627
  class RecipeDSLSpecNamespace::Thingy4 < BaseThingy
628
628
  resource_name :thingy3
629
629
  end
630
630
 
631
- }
631
+ end
632
632
 
633
633
  it "thingy3 works in a recipe and yields Thingy3 (the alphabetical one)" do
634
- recipe = converge {
635
- thingy3 "blah" do; end
636
- }
634
+ recipe = converge do
635
+ thingy3("blah") {}
636
+ end
637
637
  expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
638
638
  end
639
639
 
640
640
  it "thingy4 does not work in a recipe" do
641
- expect_converge {
642
- thingy4 "blah" do; end
643
- }.to raise_error(NoMethodError)
641
+ expect_converge do
642
+ thingy4("blah") {}
643
+ end.to raise_error(NoMethodError)
644
644
  end
645
645
 
646
646
  it "resource_matching_short_name returns Thingy4" do
@@ -649,25 +649,25 @@ describe "Recipe DSL methods" do
649
649
  end
650
650
 
651
651
  context "and Thingy4 has resource_name :thingy3" do
652
- before(:context) {
652
+ before(:context) do
653
653
 
654
654
  class RecipeDSLSpecNamespace::Thingy4 < BaseThingy
655
655
  resource_name :thingy3
656
656
  end
657
657
 
658
- }
658
+ end
659
659
 
660
660
  it "thingy3 works in a recipe and yields Thingy3 (the alphabetical one)" do
661
- recipe = converge {
662
- thingy3 "blah" do; end
663
- }
661
+ recipe = converge do
662
+ thingy3("blah") {}
663
+ end
664
664
  expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
665
665
  end
666
666
 
667
667
  it "thingy4 does not work in a recipe" do
668
- expect_converge {
669
- thingy4 "blah" do; end
670
- }.to raise_error(NoMethodError)
668
+ expect_converge do
669
+ thingy4("blah") {}
670
+ end.to raise_error(NoMethodError)
671
671
  end
672
672
 
673
673
  it "resource_matching_short_name returns Thingy4" do
@@ -679,35 +679,35 @@ describe "Recipe DSL methods" do
679
679
  end
680
680
 
681
681
  context "when Thingy7 provides :thingy8" do
682
- before(:context) {
682
+ before(:context) do
683
683
 
684
684
  class RecipeDSLSpecNamespace::Thingy7 < BaseThingy
685
685
  resource_name :thingy7
686
686
  provides :thingy8
687
687
  end
688
688
 
689
- }
689
+ end
690
690
 
691
691
  context "and Thingy8 has resource_name :thingy8" do
692
- before(:context) {
692
+ before(:context) do
693
693
 
694
694
  class RecipeDSLSpecNamespace::Thingy8 < BaseThingy
695
695
  resource_name :thingy8
696
696
  end
697
697
 
698
- }
698
+ end
699
699
 
700
700
  it "thingy7 works in a recipe and yields Thingy7" do
701
- recipe = converge {
702
- thingy7 "blah" do; end
703
- }
701
+ recipe = converge do
702
+ thingy7("blah") {}
703
+ end
704
704
  expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy7
705
705
  end
706
706
 
707
707
  it "thingy8 works in a recipe and yields Thingy7 (alphabetical)" do
708
- recipe = converge {
709
- thingy8 "blah" do; end
710
- }
708
+ recipe = converge do
709
+ thingy8("blah") {}
710
+ end
711
711
  expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy7
712
712
  end
713
713
 
@@ -718,7 +718,7 @@ describe "Recipe DSL methods" do
718
718
  end
719
719
 
720
720
  context "when Thingy12 provides :thingy12, :twizzle and :twizzle2" do
721
- before(:context) {
721
+ before(:context) do
722
722
 
723
723
  class RecipeDSLSpecNamespace::Thingy12 < BaseThingy
724
724
  resource_name :thingy12
@@ -726,32 +726,32 @@ describe "Recipe DSL methods" do
726
726
  provides :twizzle2
727
727
  end
728
728
 
729
- }
729
+ end
730
730
 
731
731
  it "thingy12 works in a recipe and yields Thingy12" do
732
- expect_recipe {
733
- thingy12 "blah" do; end
734
- }.to emit_no_warnings_or_errors
732
+ expect_recipe do
733
+ thingy12("blah") {}
734
+ end.to emit_no_warnings_or_errors
735
735
  expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy12
736
736
  end
737
737
 
738
738
  it "twizzle works in a recipe and yields Thingy12" do
739
- expect_recipe {
740
- twizzle "blah" do; end
741
- }.to emit_no_warnings_or_errors
739
+ expect_recipe do
740
+ twizzle("blah") {}
741
+ end.to emit_no_warnings_or_errors
742
742
  expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy12
743
743
  end
744
744
 
745
745
  it "twizzle2 works in a recipe and yields Thingy12" do
746
- expect_recipe {
747
- twizzle2 "blah" do; end
748
- }.to emit_no_warnings_or_errors
746
+ expect_recipe do
747
+ twizzle2("blah") {}
748
+ end.to emit_no_warnings_or_errors
749
749
  expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy12
750
750
  end
751
751
  end
752
752
 
753
753
  context "with platform-specific resources 'my_super_thingy_foo' and 'my_super_thingy_bar'" do
754
- before(:context) {
754
+ before(:context) do
755
755
  class MySuperThingyFoo < BaseThingy
756
756
  resource_name :my_super_thingy_foo
757
757
  provides :my_super_thingy, platform: "foo"
@@ -761,14 +761,14 @@ describe "Recipe DSL methods" do
761
761
  resource_name :my_super_thingy_bar
762
762
  provides :my_super_thingy, platform: "bar"
763
763
  end
764
- }
764
+ end
765
765
 
766
766
  it "A run with platform 'foo' uses MySuperThingyFoo" do
767
767
  r = Cheffish::ChefRun.new(chef_config)
768
768
  r.client.run_context.node.automatic["platform"] = "foo"
769
- r.compile_recipe {
770
- my_super_thingy "blah" do; end
771
- }
769
+ r.compile_recipe do
770
+ my_super_thingy("blah") {}
771
+ end
772
772
  r.converge
773
773
  expect(r).to emit_no_warnings_or_errors
774
774
  expect(BaseThingy.created_resource).to eq MySuperThingyFoo
@@ -777,9 +777,9 @@ describe "Recipe DSL methods" do
777
777
  it "A run with platform 'bar' uses MySuperThingyBar" do
778
778
  r = Cheffish::ChefRun.new(chef_config)
779
779
  r.client.run_context.node.automatic["platform"] = "bar"
780
- r.compile_recipe {
781
- my_super_thingy "blah" do; end
782
- }
780
+ r.compile_recipe do
781
+ my_super_thingy("blah") {}
782
+ end
783
783
  r.converge
784
784
  expect(r).to emit_no_warnings_or_errors
785
785
  expect(BaseThingy.created_resource).to eq MySuperThingyBar
@@ -788,20 +788,20 @@ describe "Recipe DSL methods" do
788
788
  it "A run with platform 'x' reports that my_super_thingy is not supported" do
789
789
  r = Cheffish::ChefRun.new(chef_config)
790
790
  r.client.run_context.node.automatic["platform"] = "x"
791
- expect {
792
- r.compile_recipe {
793
- my_super_thingy "blah" do; end
794
- }
795
- }.to raise_error(Chef::Exceptions::NoSuchResourceType)
791
+ expect do
792
+ r.compile_recipe do
793
+ my_super_thingy("blah") {}
794
+ end
795
+ end.to raise_error(Chef::Exceptions::NoSuchResourceType)
796
796
  end
797
797
  end
798
798
 
799
799
  context "when Thingy10 provides :thingy10" do
800
- before(:context) {
800
+ before(:context) do
801
801
  class RecipeDSLSpecNamespace::Thingy10 < BaseThingy
802
802
  resource_name :thingy10
803
803
  end
804
- }
804
+ end
805
805
 
806
806
  it "declaring a resource providing the same :thingy10 with override: true does not produce a warning" do
807
807
  expect(Chef::Log).not_to receive(:warn)
@@ -812,11 +812,11 @@ describe "Recipe DSL methods" do
812
812
  end
813
813
 
814
814
  context "when Thingy11 provides :thingy11" do
815
- before(:context) {
815
+ before(:context) do
816
816
  class RecipeDSLSpecNamespace::Thingy11 < BaseThingy
817
817
  resource_name :thingy10
818
818
  end
819
- }
819
+ end
820
820
 
821
821
  it "declaring a resource providing the same :thingy11 with os: 'linux' does not produce a warning" do
822
822
  expect(Chef::Log).not_to receive(:warn)
@@ -829,7 +829,7 @@ describe "Recipe DSL methods" do
829
829
 
830
830
  context "with a resource named 'B' with resource name :two_classes_one_dsl" do
831
831
  let(:two_classes_one_dsl) { :"two_classes_one_dsl#{Namer.current_index}" }
832
- let(:resource_class) {
832
+ let(:resource_class) do
833
833
  result = Class.new(BaseThingy) do
834
834
  def self.name
835
835
  "B"
@@ -841,11 +841,11 @@ describe "Recipe DSL methods" do
841
841
  end
842
842
  result.resource_name two_classes_one_dsl
843
843
  result
844
- }
844
+ end
845
845
  before { resource_class } # pull on it so it gets defined before the recipe runs
846
846
 
847
847
  context "and another resource named 'A' with resource_name :two_classes_one_dsl" do
848
- let(:resource_class_a) {
848
+ let(:resource_class_a) do
849
849
  result = Class.new(BaseThingy) do
850
850
  def self.name
851
851
  "A"
@@ -857,14 +857,14 @@ describe "Recipe DSL methods" do
857
857
  end
858
858
  result.resource_name two_classes_one_dsl
859
859
  result
860
- }
860
+ end
861
861
  before { resource_class_a } # pull on it so it gets defined before the recipe runs
862
862
 
863
863
  it "two_classes_one_dsl resolves to A (alphabetically earliest)" do
864
864
  two_classes_one_dsl = self.two_classes_one_dsl
865
- recipe = converge {
865
+ recipe = converge do
866
866
  instance_eval("#{two_classes_one_dsl} 'blah'")
867
- }
867
+ end
868
868
  expect(recipe.logged_warnings).to eq ""
869
869
  expect(BaseThingy.created_resource).to eq resource_class_a
870
870
  end
@@ -875,7 +875,7 @@ describe "Recipe DSL methods" do
875
875
  end
876
876
 
877
877
  context "and another resource named 'Z' with resource_name :two_classes_one_dsl" do
878
- let(:resource_class_z) {
878
+ let(:resource_class_z) do
879
879
  result = Class.new(BaseThingy) do
880
880
  def self.name
881
881
  "Z"
@@ -887,14 +887,14 @@ describe "Recipe DSL methods" do
887
887
  end
888
888
  result.resource_name two_classes_one_dsl
889
889
  result
890
- }
890
+ end
891
891
  before { resource_class_z } # pull on it so it gets defined before the recipe runs
892
892
 
893
893
  it "two_classes_one_dsl resolves to B (alphabetically earliest)" do
894
894
  two_classes_one_dsl = self.two_classes_one_dsl
895
- recipe = converge {
895
+ recipe = converge do
896
896
  instance_eval("#{two_classes_one_dsl} 'blah'")
897
- }
897
+ end
898
898
  expect(recipe.logged_warnings).to eq ""
899
899
  expect(BaseThingy.created_resource).to eq resource_class
900
900
  end
@@ -910,9 +910,9 @@ describe "Recipe DSL methods" do
910
910
 
911
911
  it "two_classes_one_dsl resolves to Z (respects the priority array)" do
912
912
  two_classes_one_dsl = self.two_classes_one_dsl
913
- recipe = converge {
913
+ recipe = converge do
914
914
  instance_eval("#{two_classes_one_dsl} 'blah'")
915
- }
915
+ end
916
916
  expect(recipe.logged_warnings).to eq ""
917
917
  expect(BaseThingy.created_resource).to eq resource_class_z
918
918
  end
@@ -928,9 +928,9 @@ describe "Recipe DSL methods" do
928
928
 
929
929
  it "two_classes_one_dsl resolves to B (picks the next thing in the priority array)" do
930
930
  two_classes_one_dsl = self.two_classes_one_dsl
931
- recipe = converge {
931
+ recipe = converge do
932
932
  instance_eval("#{two_classes_one_dsl} 'blah'")
933
- }
933
+ end
934
934
  expect(recipe.logged_warnings).to eq ""
935
935
  expect(BaseThingy.created_resource).to eq resource_class
936
936
  end
@@ -949,9 +949,9 @@ describe "Recipe DSL methods" do
949
949
 
950
950
  it "two_classes_one_dsl resolves to Z (respects the most recent priority array)" do
951
951
  two_classes_one_dsl = self.two_classes_one_dsl
952
- recipe = converge {
952
+ recipe = converge do
953
953
  instance_eval("#{two_classes_one_dsl} 'blah'")
954
- }
954
+ end
955
955
  expect(recipe.logged_warnings).to eq ""
956
956
  expect(BaseThingy.created_resource).to eq resource_class_z
957
957
  end
@@ -967,9 +967,9 @@ describe "Recipe DSL methods" do
967
967
 
968
968
  it "two_classes_one_dsl resolves to B (picks the first match from the other priority array)" do
969
969
  two_classes_one_dsl = self.two_classes_one_dsl
970
- recipe = converge {
970
+ recipe = converge do
971
971
  instance_eval("#{two_classes_one_dsl} 'blah'")
972
- }
972
+ end
973
973
  expect(recipe.logged_warnings).to eq ""
974
974
  expect(BaseThingy.created_resource).to eq resource_class
975
975
  end
@@ -992,9 +992,9 @@ describe "Recipe DSL methods" do
992
992
 
993
993
  it "two_classes_one_dsl resolves to B (picks the first match outside the priority array)" do
994
994
  two_classes_one_dsl = self.two_classes_one_dsl
995
- recipe = converge {
995
+ recipe = converge do
996
996
  instance_eval("#{two_classes_one_dsl} 'blah'")
997
- }
997
+ end
998
998
  expect(recipe.logged_warnings).to eq ""
999
999
  expect(BaseThingy.created_resource).to eq resource_class
1000
1000
  end
@@ -1012,7 +1012,7 @@ describe "Recipe DSL methods" do
1012
1012
  resource_class.send(:define_method, :provider) { nil }
1013
1013
  end
1014
1014
 
1015
- let(:provider_class) {
1015
+ let(:provider_class) do
1016
1016
  result = Class.new(BaseThingy::Provider) do
1017
1017
  def self.name
1018
1018
  "B"
@@ -1024,11 +1024,11 @@ describe "Recipe DSL methods" do
1024
1024
  end
1025
1025
  result.provides two_classes_one_dsl
1026
1026
  result
1027
- }
1027
+ end
1028
1028
  before { provider_class } # pull on it so it gets defined before the recipe runs
1029
1029
 
1030
1030
  context "and another provider named 'A'" do
1031
- let(:provider_class_a) {
1031
+ let(:provider_class_a) do
1032
1032
  result = Class.new(BaseThingy::Provider) do
1033
1033
  def self.name
1034
1034
  "A"
@@ -1039,15 +1039,15 @@ describe "Recipe DSL methods" do
1039
1039
  def self.inspect; name.inspect; end
1040
1040
  end
1041
1041
  result
1042
- }
1042
+ end
1043
1043
  context "which provides :two_classes_one_dsl" do
1044
1044
  before { provider_class_a.provides two_classes_one_dsl }
1045
1045
 
1046
1046
  it "two_classes_one_dsl resolves to A (alphabetically earliest)" do
1047
1047
  two_classes_one_dsl = self.two_classes_one_dsl
1048
- recipe = converge {
1048
+ recipe = converge do
1049
1049
  instance_eval("#{two_classes_one_dsl} 'blah'")
1050
- }
1050
+ end
1051
1051
  expect(recipe.logged_warnings).to eq ""
1052
1052
  expect(BaseThingy.created_provider).to eq provider_class_a
1053
1053
  end
@@ -1057,9 +1057,9 @@ describe "Recipe DSL methods" do
1057
1057
 
1058
1058
  it "two_classes_one_dsl resolves to B (since A declined)" do
1059
1059
  two_classes_one_dsl = self.two_classes_one_dsl
1060
- recipe = converge {
1060
+ recipe = converge do
1061
1061
  instance_eval("#{two_classes_one_dsl} 'blah'")
1062
- }
1062
+ end
1063
1063
  expect(recipe.logged_warnings).to eq ""
1064
1064
  expect(BaseThingy.created_provider).to eq provider_class
1065
1065
  end
@@ -1067,7 +1067,7 @@ describe "Recipe DSL methods" do
1067
1067
  end
1068
1068
 
1069
1069
  context "and another provider named 'Z'" do
1070
- let(:provider_class_z) {
1070
+ let(:provider_class_z) do
1071
1071
  result = Class.new(BaseThingy::Provider) do
1072
1072
  def self.name
1073
1073
  "Z"
@@ -1078,7 +1078,7 @@ describe "Recipe DSL methods" do
1078
1078
  def self.inspect; name.inspect; end
1079
1079
  end
1080
1080
  result
1081
- }
1081
+ end
1082
1082
  before { provider_class_z } # pull on it so it gets defined before the recipe runs
1083
1083
 
1084
1084
  context "which provides :two_classes_one_dsl" do
@@ -1086,9 +1086,9 @@ describe "Recipe DSL methods" do
1086
1086
 
1087
1087
  it "two_classes_one_dsl resolves to B (alphabetically earliest)" do
1088
1088
  two_classes_one_dsl = self.two_classes_one_dsl
1089
- recipe = converge {
1089
+ recipe = converge do
1090
1090
  instance_eval("#{two_classes_one_dsl} 'blah'")
1091
- }
1091
+ end
1092
1092
  expect(recipe.logged_warnings).to eq ""
1093
1093
  expect(BaseThingy.created_provider).to eq provider_class
1094
1094
  end
@@ -1098,9 +1098,9 @@ describe "Recipe DSL methods" do
1098
1098
 
1099
1099
  it "two_classes_one_dsl resolves to Z (respects the priority map)" do
1100
1100
  two_classes_one_dsl = self.two_classes_one_dsl
1101
- recipe = converge {
1101
+ recipe = converge do
1102
1102
  instance_eval("#{two_classes_one_dsl} 'blah'")
1103
- }
1103
+ end
1104
1104
  expect(recipe.logged_warnings).to eq ""
1105
1105
  expect(BaseThingy.created_provider).to eq provider_class_z
1106
1106
  end
@@ -1115,9 +1115,9 @@ describe "Recipe DSL methods" do
1115
1115
 
1116
1116
  it "two_classes_one_dsl resolves to B (the next one in the priority map)" do
1117
1117
  two_classes_one_dsl = self.two_classes_one_dsl
1118
- recipe = converge {
1118
+ recipe = converge do
1119
1119
  instance_eval("#{two_classes_one_dsl} 'blah'")
1120
- }
1120
+ end
1121
1121
  expect(recipe.logged_warnings).to eq ""
1122
1122
  expect(BaseThingy.created_provider).to eq provider_class
1123
1123
  end
@@ -1129,9 +1129,9 @@ describe "Recipe DSL methods" do
1129
1129
 
1130
1130
  it "two_classes_one_dsl resolves to B (the one in the next priority map)" do
1131
1131
  two_classes_one_dsl = self.two_classes_one_dsl
1132
- recipe = converge {
1132
+ recipe = converge do
1133
1133
  instance_eval("#{two_classes_one_dsl} 'blah'")
1134
- }
1134
+ end
1135
1135
  expect(recipe.logged_warnings).to eq ""
1136
1136
  expect(BaseThingy.created_provider).to eq provider_class
1137
1137
  end
@@ -1141,7 +1141,7 @@ describe "Recipe DSL methods" do
1141
1141
  end
1142
1142
 
1143
1143
  context "and another resource Blarghle with provides :two_classes_one_dsl, os: 'blarghle'" do
1144
- let(:resource_class_blarghle) {
1144
+ let(:resource_class_blarghle) do
1145
1145
  result = Class.new(BaseThingy) do
1146
1146
  def self.name
1147
1147
  "Blarghle"
@@ -1154,27 +1154,27 @@ describe "Recipe DSL methods" do
1154
1154
  result.resource_name two_classes_one_dsl
1155
1155
  result.provides two_classes_one_dsl, os: "blarghle"
1156
1156
  result
1157
- }
1157
+ end
1158
1158
  before { resource_class_blarghle } # pull on it so it gets defined before the recipe runs
1159
1159
 
1160
1160
  it "on os = blarghle, two_classes_one_dsl resolves to Blarghle" do
1161
1161
  two_classes_one_dsl = self.two_classes_one_dsl
1162
- recipe = converge {
1162
+ recipe = converge do
1163
1163
  # this is an ugly way to test, make Cheffish expose node attrs
1164
1164
  run_context.node.automatic[:os] = "blarghle"
1165
1165
  instance_eval("#{two_classes_one_dsl} 'blah' do; end")
1166
- }
1166
+ end
1167
1167
  expect(recipe.logged_warnings).to eq ""
1168
1168
  expect(BaseThingy.created_resource).to eq resource_class_blarghle
1169
1169
  end
1170
1170
 
1171
1171
  it "on os = linux, two_classes_one_dsl resolves to B" do
1172
1172
  two_classes_one_dsl = self.two_classes_one_dsl
1173
- recipe = converge {
1173
+ recipe = converge do
1174
1174
  # this is an ugly way to test, make Cheffish expose node attrs
1175
1175
  run_context.node.automatic[:os] = "linux"
1176
1176
  instance_eval("#{two_classes_one_dsl} 'blah' do; end")
1177
- }
1177
+ end
1178
1178
  expect(recipe.logged_warnings).to eq ""
1179
1179
  expect(BaseThingy.created_resource).to eq resource_class
1180
1180
  end
@@ -1182,37 +1182,38 @@ describe "Recipe DSL methods" do
1182
1182
  end
1183
1183
 
1184
1184
  context "with a resource MyResource" do
1185
- let(:resource_class) { Class.new(BaseThingy) do
1186
- def self.called_provides
1187
- @called_provides
1188
- end
1185
+ let(:resource_class) do
1186
+ Class.new(BaseThingy) do
1187
+ def self.called_provides
1188
+ @called_provides
1189
+ end
1189
1190
 
1190
- def to_s
1191
- "MyResource"
1192
- end
1193
- end }
1191
+ def to_s
1192
+ "MyResource"
1193
+ end
1194
+ end end
1194
1195
  let(:my_resource) { :"my_resource#{Namer.current_index}" }
1195
1196
  let(:blarghle_blarghle_little_star) { :"blarghle_blarghle_little_star#{Namer.current_index}" }
1196
1197
 
1197
1198
  context "with resource_name :my_resource" do
1198
- before {
1199
+ before do
1199
1200
  resource_class.resource_name my_resource
1200
- }
1201
+ end
1201
1202
 
1202
1203
  context "with provides? returning true to my_resource" do
1203
- before {
1204
+ before do
1204
1205
  my_resource = self.my_resource
1205
1206
  resource_class.define_singleton_method(:provides?) do |node, resource_name|
1206
1207
  @called_provides = true
1207
1208
  resource_name == my_resource
1208
1209
  end
1209
- }
1210
+ end
1210
1211
 
1211
1212
  it "my_resource returns the resource and calls provides?, but does not emit a warning" do
1212
1213
  dsl_name = self.my_resource
1213
- recipe = converge {
1214
+ recipe = converge do
1214
1215
  instance_eval("#{dsl_name} 'foo'")
1215
- }
1216
+ end
1216
1217
  expect(recipe.logged_warnings).to eq ""
1217
1218
  expect(BaseThingy.created_resource).to eq resource_class
1218
1219
  expect(resource_class.called_provides).to be_truthy
@@ -1230,18 +1231,18 @@ describe "Recipe DSL methods" do
1230
1231
 
1231
1232
  it "my_resource does not return the resource" do
1232
1233
  dsl_name = self.my_resource
1233
- expect_converge {
1234
+ expect_converge do
1234
1235
  instance_eval("#{dsl_name} 'foo'")
1235
- }.to raise_error(Chef::Exceptions::NoSuchResourceType)
1236
+ end.to raise_error(Chef::Exceptions::NoSuchResourceType)
1236
1237
  expect(resource_class.called_provides).to be_truthy
1237
1238
  end
1238
1239
 
1239
1240
  it "blarghle_blarghle_little_star 'foo' returns the resource and emits a warning" do
1240
1241
  Chef::Config[:treat_deprecation_warnings_as_errors] = false
1241
1242
  dsl_name = self.blarghle_blarghle_little_star
1242
- recipe = converge {
1243
+ recipe = converge do
1243
1244
  instance_eval("#{dsl_name} 'foo'")
1244
- }
1245
+ end
1245
1246
  expect(recipe.logged_warnings).to include "WARN: #{resource_class}.provides? returned true when asked if it provides DSL #{dsl_name}, but provides :#{dsl_name} was never called!"
1246
1247
  expect(BaseThingy.created_resource).to eq resource_class
1247
1248
  expect(resource_class.called_provides).to be_truthy
@@ -1281,9 +1282,9 @@ describe "Recipe DSL methods" do
1281
1282
 
1282
1283
  it "my_resource runs the provider and does not emit a warning" do
1283
1284
  my_resource = self.my_resource
1284
- recipe = converge {
1285
+ recipe = converge do
1285
1286
  instance_eval("#{my_resource} 'foo'")
1286
- }
1287
+ end
1287
1288
  expect(recipe.logged_warnings).to eq ""
1288
1289
  expect(BaseThingy.created_provider).to eq provider_class
1289
1290
  end
@@ -1311,9 +1312,9 @@ describe "Recipe DSL methods" do
1311
1312
 
1312
1313
  it "my_resource runs the first provider" do
1313
1314
  my_resource = self.my_resource
1314
- recipe = converge {
1315
+ recipe = converge do
1315
1316
  instance_eval("#{my_resource} 'foo'")
1316
- }
1317
+ end
1317
1318
  expect(recipe.logged_warnings).to eq ""
1318
1319
  expect(BaseThingy.created_provider).to eq provider_class
1319
1320
  end
@@ -1328,9 +1329,9 @@ describe "Recipe DSL methods" do
1328
1329
  # TODO no warning? ick
1329
1330
  it "my_resource runs the provider anyway" do
1330
1331
  my_resource = self.my_resource
1331
- recipe = converge {
1332
+ recipe = converge do
1332
1333
  instance_eval("#{my_resource} 'foo'")
1333
- }
1334
+ end
1334
1335
  expect(recipe.logged_warnings).to eq ""
1335
1336
  expect(BaseThingy.created_provider).to eq provider_class
1336
1337
  end
@@ -1360,9 +1361,9 @@ describe "Recipe DSL methods" do
1360
1361
 
1361
1362
  it "my_resource runs the other provider" do
1362
1363
  my_resource = self.my_resource
1363
- recipe = converge {
1364
+ recipe = converge do
1364
1365
  instance_eval("#{my_resource} 'foo'")
1365
- }
1366
+ end
1366
1367
  expect(recipe.logged_warnings).to eq ""
1367
1368
  expect(BaseThingy.created_provider).to eq provider_class2
1368
1369
  end
@@ -1371,24 +1372,24 @@ describe "Recipe DSL methods" do
1371
1372
  end
1372
1373
 
1373
1374
  context "with provides? returning true" do
1374
- before {
1375
+ before do
1375
1376
  my_resource = self.my_resource
1376
1377
  provider_class.define_singleton_method(:provides?) do |node, resource|
1377
1378
  @called_provides = true
1378
1379
  resource.declared_type == my_resource
1379
1380
  end
1380
- }
1381
+ end
1381
1382
 
1382
1383
  context "that provides :my_resource" do
1383
- before {
1384
+ before do
1384
1385
  provider_class.provides my_resource
1385
- }
1386
+ end
1386
1387
 
1387
1388
  it "my_resource calls the provider (and calls provides?), but does not emit a warning" do
1388
1389
  my_resource = self.my_resource
1389
- recipe = converge {
1390
+ recipe = converge do
1390
1391
  instance_eval("#{my_resource} 'foo'")
1391
- }
1392
+ end
1392
1393
  expect(recipe.logged_warnings).to eq ""
1393
1394
  expect(BaseThingy.created_provider).to eq provider_class
1394
1395
  expect(provider_class.called_provides).to be_truthy
@@ -1399,9 +1400,9 @@ describe "Recipe DSL methods" do
1399
1400
  it "my_resource calls the provider (and calls provides?), and emits a warning" do
1400
1401
  Chef::Config[:treat_deprecation_warnings_as_errors] = false
1401
1402
  my_resource = self.my_resource
1402
- recipe = converge {
1403
+ recipe = converge do
1403
1404
  instance_eval("#{my_resource} 'foo'")
1404
- }
1405
+ end
1405
1406
  expect(recipe.logged_warnings).to include("WARN: #{provider_class}.provides? returned true when asked if it provides DSL #{my_resource}, but provides :#{my_resource} was never called!")
1406
1407
  expect(BaseThingy.created_provider).to eq provider_class
1407
1408
  expect(provider_class.called_provides).to be_truthy
@@ -1410,24 +1411,24 @@ describe "Recipe DSL methods" do
1410
1411
  end
1411
1412
 
1412
1413
  context "with provides? returning false to my_resource" do
1413
- before {
1414
+ before do
1414
1415
  my_resource = self.my_resource
1415
1416
  provider_class.define_singleton_method(:provides?) do |node, resource|
1416
1417
  @called_provides = true
1417
1418
  false
1418
1419
  end
1419
- }
1420
+ end
1420
1421
 
1421
1422
  context "that provides :my_resource" do
1422
- before {
1423
+ before do
1423
1424
  provider_class.provides my_resource
1424
- }
1425
+ end
1425
1426
 
1426
1427
  it "my_resource fails to find a provider (and calls provides)" do
1427
1428
  my_resource = self.my_resource
1428
- expect_converge {
1429
+ expect_converge do
1429
1430
  instance_eval("#{my_resource} 'foo'")
1430
- }.to raise_error(Chef::Exceptions::ProviderNotFound)
1431
+ end.to raise_error(Chef::Exceptions::ProviderNotFound)
1431
1432
  expect(provider_class.called_provides).to be_truthy
1432
1433
  end
1433
1434
  end
@@ -1435,9 +1436,9 @@ describe "Recipe DSL methods" do
1435
1436
  context "that does not provide :my_resource" do
1436
1437
  it "my_resource fails to find a provider (and calls provides)" do
1437
1438
  my_resource = self.my_resource
1438
- expect_converge {
1439
+ expect_converge do
1439
1440
  instance_eval("#{my_resource} 'foo'")
1440
- }.to raise_error(Chef::Exceptions::ProviderNotFound)
1441
+ end.to raise_error(Chef::Exceptions::ProviderNotFound)
1441
1442
  expect(provider_class.called_provides).to be_truthy
1442
1443
  end
1443
1444
  end
@@ -1451,15 +1452,15 @@ describe "Recipe DSL methods" do
1451
1452
  before { Namer.current_index += 1 }
1452
1453
 
1453
1454
  context "with an LWRP that declares actions" do
1454
- let(:resource_class) {
1455
+ let(:resource_class) do
1455
1456
  Class.new(Chef::Resource::LWRPBase) do
1456
1457
  provides :"recipe_dsl_spec#{Namer.current_index}"
1457
1458
  actions :create
1458
1459
  end
1459
- }
1460
- let(:resource) {
1460
+ end
1461
+ let(:resource) do
1461
1462
  resource_class.new("blah", run_context)
1462
- }
1463
+ end
1463
1464
  it "The actions are part of actions along with :nothing" do
1464
1465
  expect(resource_class.actions).to eq [ :nothing, :create ]
1465
1466
  end
@@ -1468,15 +1469,15 @@ describe "Recipe DSL methods" do
1468
1469
  end
1469
1470
 
1470
1471
  context "and a subclass that declares more actions" do
1471
- let(:subresource_class) {
1472
+ let(:subresource_class) do
1472
1473
  Class.new(Chef::Resource::LWRPBase) do
1473
1474
  provides :"recipe_dsl_spec_sub#{Namer.current_index}"
1474
1475
  actions :delete
1475
1476
  end
1476
- }
1477
- let(:subresource) {
1477
+ end
1478
+ let(:subresource) do
1478
1479
  subresource_class.new("subblah", run_context)
1479
- }
1480
+ end
1480
1481
 
1481
1482
  it "The parent class actions are not part of actions" do
1482
1483
  expect(subresource_class.actions).to eq [ :nothing, :delete ]
@@ -1510,9 +1511,9 @@ describe "Recipe DSL methods" do
1510
1511
 
1511
1512
  it "looks up the provider in Chef::Provider converting the resource name from snake case to camel case" do
1512
1513
  resource = nil
1513
- recipe = converge {
1514
- resource = lw_resource_with_hw_provider_test_case "blah" do; end
1515
- }
1514
+ recipe = converge do
1515
+ resource = lw_resource_with_hw_provider_test_case("blah") {}
1516
+ end
1516
1517
  expect(resource.created_provider).to eq(Chef::Provider::LwResourceWithHwProviderTestCase)
1517
1518
  end
1518
1519
  end