chefspec 7.2.1 → 7.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (342) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +21 -13
  3. data/CHANGELOG.md +4 -0
  4. data/Gemfile +14 -10
  5. data/README.md +322 -1025
  6. data/README_old.md +1291 -0
  7. data/Rakefile +8 -3
  8. data/examples/apt_package/spec/install_spec.rb +1 -1
  9. data/examples/apt_package/spec/lock_spec.rb +1 -1
  10. data/examples/apt_package/spec/purge_spec.rb +1 -1
  11. data/examples/apt_package/spec/reconfig_spec.rb +1 -1
  12. data/examples/apt_package/spec/remove_spec.rb +1 -1
  13. data/examples/apt_package/spec/unlock_spec.rb +1 -1
  14. data/examples/apt_package/spec/upgrade_spec.rb +1 -1
  15. data/examples/apt_repository/spec/add_spec.rb +1 -1
  16. data/examples/apt_repository/spec/remove_spec.rb +1 -1
  17. data/examples/apt_update/spec/periodic_spec.rb +1 -1
  18. data/examples/apt_update/spec/update_spec.rb +1 -1
  19. data/examples/attributes/spec/default_spec.rb +1 -1
  20. data/examples/batch/spec/run_spec.rb +1 -1
  21. data/examples/cab_package/spec/install_spec.rb +1 -1
  22. data/examples/cab_package/spec/remove_spec.rb +1 -1
  23. data/examples/cached/spec/default_spec.rb +1 -1
  24. data/examples/chef_gem/spec/install_spec.rb +1 -1
  25. data/examples/chef_gem/spec/purge_spec.rb +1 -1
  26. data/examples/chef_gem/spec/reconfig_spec.rb +1 -1
  27. data/examples/chef_gem/spec/remove_spec.rb +1 -1
  28. data/examples/chef_gem/spec/upgrade_spec.rb +1 -1
  29. data/examples/chocolatey_package/spec/install_spec.rb +1 -1
  30. data/examples/chocolatey_package/spec/remove_spec.rb +1 -1
  31. data/examples/chocolatey_package/spec/upgrade_spec.rb +1 -1
  32. data/examples/compile_time/spec/default_spec.rb +1 -1
  33. data/examples/cookbook_file/spec/create_if_missing_spec.rb +1 -1
  34. data/examples/cookbook_file/spec/create_spec.rb +1 -1
  35. data/examples/cookbook_file/spec/delete_spec.rb +1 -1
  36. data/examples/cookbook_file/spec/touch_spec.rb +1 -1
  37. data/examples/core/recipes/default.rb +1 -0
  38. data/examples/core/spec/default_spec.rb +7 -0
  39. data/examples/core/spec/non_recipe_spec.rb +5 -0
  40. data/examples/cron/spec/create_spec.rb +1 -1
  41. data/examples/cron/spec/delete_spec.rb +1 -1
  42. data/examples/custom_matcher/spec/install_spec.rb +1 -1
  43. data/examples/custom_matcher/spec/remove_spec.rb +1 -1
  44. data/examples/custom_resource/spec/default_spec.rb +1 -1
  45. data/examples/custom_resource_block/resources/default.rb +3 -0
  46. data/examples/custom_resource_block/spec/default_spec.rb +10 -0
  47. data/examples/directory/spec/create_spec.rb +1 -1
  48. data/examples/directory/spec/delete_spec.rb +1 -1
  49. data/examples/dnf_package/spec/install_spec.rb +1 -1
  50. data/examples/dnf_package/spec/purge_spec.rb +1 -1
  51. data/examples/dnf_package/spec/remove_spec.rb +1 -1
  52. data/examples/dnf_package/spec/upgrade_spec.rb +1 -1
  53. data/examples/do_nothing/spec/default_spec.rb +1 -1
  54. data/examples/dpkg_package/spec/install_spec.rb +1 -1
  55. data/examples/dpkg_package/spec/purge_spec.rb +1 -1
  56. data/examples/dpkg_package/spec/remove_spec.rb +1 -1
  57. data/examples/dsc_resource/spec/run_spec.rb +1 -1
  58. data/examples/dsc_script/spec/run_spec.rb +1 -1
  59. data/examples/env/spec/create_spec.rb +1 -1
  60. data/examples/env/spec/delete_spec.rb +1 -1
  61. data/examples/env/spec/modify_spec.rb +1 -1
  62. data/examples/execute/spec/run_spec.rb +1 -1
  63. data/examples/expect_exception/spec/compile_error_spec.rb +1 -1
  64. data/examples/expect_exception/spec/converge_error_spec.rb +1 -1
  65. data/examples/expect_exception/spec/no_error_spec.rb +1 -1
  66. data/examples/file/spec/create_if_missing_spec.rb +1 -1
  67. data/examples/file/spec/create_spec.rb +1 -1
  68. data/examples/file/spec/delete_spec.rb +1 -1
  69. data/examples/file/spec/touch_spec.rb +1 -1
  70. data/examples/freebsd_package/spec/install_spec.rb +1 -1
  71. data/examples/freebsd_package/spec/remove_spec.rb +1 -1
  72. data/examples/gem_package/spec/install_spec.rb +1 -1
  73. data/examples/gem_package/spec/purge_spec.rb +1 -1
  74. data/examples/gem_package/spec/reconfig_spec.rb +1 -1
  75. data/examples/gem_package/spec/remove_spec.rb +1 -1
  76. data/examples/gem_package/spec/upgrade_spec.rb +1 -1
  77. data/examples/git/spec/checkout_spec.rb +1 -1
  78. data/examples/git/spec/export_spec.rb +1 -1
  79. data/examples/git/spec/sync_spec.rb +1 -1
  80. data/examples/group/spec/create_spec.rb +1 -1
  81. data/examples/group/spec/manage_spec.rb +1 -1
  82. data/examples/group/spec/modify_spec.rb +1 -1
  83. data/examples/group/spec/remove_spec.rb +1 -1
  84. data/examples/guards/spec/default_spec.rb +1 -1
  85. data/examples/heavy_provider_light_resource/spec/provider_service_spec.rb +1 -1
  86. data/examples/homebrew_package/spec/install_spec.rb +1 -1
  87. data/examples/homebrew_package/spec/purge_spec.rb +1 -1
  88. data/examples/homebrew_package/spec/remove_spec.rb +1 -1
  89. data/examples/homebrew_package/spec/upgrade_spec.rb +1 -1
  90. data/examples/http_request/spec/delete_spec.rb +1 -1
  91. data/examples/http_request/spec/get_spec.rb +1 -1
  92. data/examples/http_request/spec/head_spec.rb +1 -1
  93. data/examples/http_request/spec/options_spec.rb +1 -1
  94. data/examples/http_request/spec/post_spec.rb +1 -1
  95. data/examples/http_request/spec/put_spec.rb +1 -1
  96. data/examples/ifconfig/spec/add_spec.rb +1 -1
  97. data/examples/ifconfig/spec/delete_spec.rb +1 -1
  98. data/examples/ifconfig/spec/disable_spec.rb +1 -1
  99. data/examples/ifconfig/spec/enable_spec.rb +1 -1
  100. data/examples/include_recipe/spec/default_spec.rb +1 -1
  101. data/examples/ips_package/spec/install_spec.rb +1 -1
  102. data/examples/ips_package/spec/remove_spec.rb +1 -1
  103. data/examples/ips_package/spec/upgrade_spec.rb +1 -1
  104. data/examples/launchd/spec/create_if_missing_spec.rb +1 -1
  105. data/examples/launchd/spec/create_spec.rb +1 -1
  106. data/examples/launchd/spec/delete_spec.rb +1 -1
  107. data/examples/launchd/spec/disable_spec.rb +1 -1
  108. data/examples/launchd/spec/enable_spec.rb +1 -1
  109. data/examples/library_patch/libraries/default.rb +5 -0
  110. data/examples/library_patch/recipes/default.rb +1 -0
  111. data/examples/library_patch/spec/default_spec.rb +14 -0
  112. data/examples/link/spec/create_spec.rb +1 -1
  113. data/examples/link/spec/delete_spec.rb +1 -1
  114. data/examples/link/spec/link_to_spec.rb +1 -1
  115. data/examples/log/spec/write_spec.rb +1 -1
  116. data/examples/macports_package/spec/install_spec.rb +1 -1
  117. data/examples/macports_package/spec/purge_spec.rb +1 -1
  118. data/examples/macports_package/spec/remove_spec.rb +1 -1
  119. data/examples/macports_package/spec/upgrade_spec.rb +1 -1
  120. data/examples/mdadm/spec/assemble_spec.rb +1 -1
  121. data/examples/mdadm/spec/create_spec.rb +1 -1
  122. data/examples/mdadm/spec/stop_spec.rb +1 -1
  123. data/examples/mount/spec/disable_spec.rb +1 -1
  124. data/examples/mount/spec/enable_spec.rb +1 -1
  125. data/examples/mount/spec/mount_spec.rb +1 -1
  126. data/examples/mount/spec/remount_spec.rb +1 -1
  127. data/examples/mount/spec/umount_spec.rb +1 -1
  128. data/examples/msu_package/spec/install_spec.rb +1 -1
  129. data/examples/msu_package/spec/remove_spec.rb +1 -1
  130. data/examples/multiple_actions/spec/default_spec.rb +1 -1
  131. data/examples/multiple_actions/spec/reversed_spec.rb +1 -1
  132. data/examples/multiple_actions/spec/sequential_spec.rb +1 -1
  133. data/examples/multiple_run_action/spec/default_spec.rb +1 -1
  134. data/examples/nothing_matcher/spec/default_spec.rb +1 -1
  135. data/examples/notifications/spec/before_spec.rb +1 -1
  136. data/examples/notifications/spec/chained_spec.rb +1 -1
  137. data/examples/notifications/spec/default_spec.rb +1 -1
  138. data/examples/notifications/spec/delayed_spec.rb +1 -1
  139. data/examples/notifications/spec/immediately_spec.rb +1 -1
  140. data/examples/ohai/spec/reload_spec.rb +1 -1
  141. data/examples/osx_profile/spec/install_spec.rb +1 -1
  142. data/examples/osx_profile/spec/remove_spec.rb +1 -1
  143. data/examples/package/spec/install_spec.rb +1 -1
  144. data/examples/package/spec/lock_spec.rb +1 -1
  145. data/examples/package/spec/purge_spec.rb +1 -1
  146. data/examples/package/spec/reconfig_spec.rb +1 -1
  147. data/examples/package/spec/remove_spec.rb +1 -1
  148. data/examples/package/spec/unlock_spec.rb +1 -1
  149. data/examples/package/spec/upgrade_spec.rb +1 -1
  150. data/examples/pacman_package/spec/install_spec.rb +1 -1
  151. data/examples/pacman_package/spec/purge_spec.rb +1 -1
  152. data/examples/pacman_package/spec/remove_spec.rb +1 -1
  153. data/examples/pacman_package/spec/upgrade_spec.rb +1 -1
  154. data/examples/paludis_package/spec/install_spec.rb +1 -1
  155. data/examples/paludis_package/spec/purge_spec.rb +1 -1
  156. data/examples/paludis_package/spec/remove_spec.rb +1 -1
  157. data/examples/paludis_package/spec/upgrade_spec.rb +1 -1
  158. data/examples/portage_package/spec/install_spec.rb +1 -1
  159. data/examples/portage_package/spec/purge_spec.rb +1 -1
  160. data/examples/portage_package/spec/remove_spec.rb +1 -1
  161. data/examples/portage_package/spec/upgrade_spec.rb +1 -1
  162. data/examples/powershell_script/spec/run_spec.rb +1 -1
  163. data/examples/reboot/spec/cancel_spec.rb +1 -1
  164. data/examples/reboot/spec/now_spec.rb +1 -1
  165. data/examples/reboot/spec/request_spec.rb +1 -1
  166. data/examples/recipe_block/metadata.rb +1 -0
  167. data/examples/recipe_block/spec/recipe_block_spec.rb +34 -0
  168. data/examples/recipe_block/templates/apache2.conf.erb +1 -0
  169. data/examples/registry_key/spec/create_if_missing_spec.rb +1 -1
  170. data/examples/registry_key/spec/create_spec.rb +1 -1
  171. data/examples/registry_key/spec/delete_key_spec.rb +1 -1
  172. data/examples/registry_key/spec/delete_spec.rb +1 -1
  173. data/examples/remote_directory/spec/create_if_missing_spec.rb +1 -1
  174. data/examples/remote_directory/spec/create_spec.rb +1 -1
  175. data/examples/remote_directory/spec/delete_spec.rb +1 -1
  176. data/examples/remote_file/spec/create_if_missing_spec.rb +1 -1
  177. data/examples/remote_file/spec/create_spec.rb +1 -1
  178. data/examples/remote_file/spec/delete_spec.rb +1 -1
  179. data/examples/remote_file/spec/touch_spec.rb +1 -1
  180. data/examples/render_file/spec/default_spec.rb +12 -1
  181. data/examples/render_file/spec/template_helpers_spec.rb +1 -1
  182. data/examples/roles/spec/default_spec.rb +1 -1
  183. data/examples/route/spec/add_spec.rb +1 -1
  184. data/examples/route/spec/delete_spec.rb +1 -1
  185. data/examples/rpm_package/spec/install_spec.rb +1 -1
  186. data/examples/rpm_package/spec/remove_spec.rb +1 -1
  187. data/examples/rpm_package/spec/upgrade_spec.rb +1 -1
  188. data/examples/ruby_block/spec/create_spec.rb +1 -1
  189. data/examples/ruby_block/spec/run_spec.rb +1 -1
  190. data/examples/runner/recipes/default.rb +1 -0
  191. data/examples/runner/spec/default_spec.rb +11 -0
  192. data/examples/script/spec/run_bash_spec.rb +1 -1
  193. data/examples/script/spec/run_csh_spec.rb +1 -1
  194. data/examples/script/spec/run_ksh_spec.rb +1 -1
  195. data/examples/script/spec/run_perl_spec.rb +1 -1
  196. data/examples/script/spec/run_python_spec.rb +1 -1
  197. data/examples/script/spec/run_ruby_spec.rb +1 -1
  198. data/examples/script/spec/run_script_spec.rb +1 -1
  199. data/examples/server/spec/client_spec.rb +1 -1
  200. data/examples/server/spec/data_bag_spec.rb +1 -1
  201. data/examples/server/spec/environment_spec.rb +1 -1
  202. data/examples/server/spec/exotic_port_spec.rb +1 -1
  203. data/examples/server/spec/node_spec.rb +4 -4
  204. data/examples/server/spec/render_with_cached_spec.rb +1 -1
  205. data/examples/server/spec/role_spec.rb +1 -1
  206. data/examples/server/spec/search_spec.rb +1 -1
  207. data/examples/service/spec/disable_spec.rb +1 -1
  208. data/examples/service/spec/enable_spec.rb +1 -1
  209. data/examples/service/spec/reload_spec.rb +1 -1
  210. data/examples/service/spec/restart_spec.rb +1 -1
  211. data/examples/service/spec/start_spec.rb +1 -1
  212. data/examples/service/spec/stop_spec.rb +1 -1
  213. data/examples/smartos_package/spec/install_spec.rb +1 -1
  214. data/examples/smartos_package/spec/remove_spec.rb +1 -1
  215. data/examples/smartos_package/spec/upgrade_spec.rb +1 -1
  216. data/examples/solaris_package/spec/install_spec.rb +1 -1
  217. data/examples/solaris_package/spec/remove_spec.rb +1 -1
  218. data/examples/solaris_package/spec/upgrade_spec.rb +1 -1
  219. data/examples/spec_attributes/attributes/default.rb +1 -0
  220. data/examples/spec_attributes/recipes/default.rb +5 -0
  221. data/examples/spec_attributes/spec/default_spec.rb +54 -0
  222. data/examples/spec_platform/recipes/default.rb +3 -0
  223. data/examples/spec_platform/spec/default_spec.rb +36 -0
  224. data/examples/spec_step_into/recipes/default.rb +3 -0
  225. data/examples/spec_step_into/resources/one.rb +3 -0
  226. data/examples/spec_step_into/resources/two.rb +3 -0
  227. data/examples/spec_step_into/spec/default_spec.rb +50 -0
  228. data/examples/state_attrs/spec/default_spec.rb +1 -1
  229. data/examples/step_into/spec/default_spec.rb +2 -2
  230. data/examples/stub_command/spec/default_spec.rb +1 -1
  231. data/examples/stub_data_bag/spec/default_spec.rb +1 -1
  232. data/examples/stub_data_bag_item/spec/default_spec.rb +1 -1
  233. data/examples/stub_node/spec/default_spec.rb +1 -1
  234. data/examples/stub_search/spec/block_spec.rb +1 -1
  235. data/examples/stub_search/spec/default_spec.rb +1 -1
  236. data/examples/stubs_for/resources/default.rb +20 -0
  237. data/examples/stubs_for/resources/old.rb +26 -0
  238. data/examples/stubs_for/spec/default_spec.rb +240 -0
  239. data/examples/subscribes/spec/before_spec.rb +1 -1
  240. data/examples/subscribes/spec/chained_spec.rb +1 -1
  241. data/examples/subscribes/spec/default_spec.rb +1 -1
  242. data/examples/subscribes/spec/delayed_spec.rb +1 -1
  243. data/examples/subscribes/spec/immediately_spec.rb +1 -1
  244. data/examples/subversion/spec/checkout_spec.rb +1 -1
  245. data/examples/subversion/spec/export_spec.rb +1 -1
  246. data/examples/subversion/spec/force_export_spec.rb +1 -1
  247. data/examples/subversion/spec/sync_spec.rb +1 -1
  248. data/examples/systemd_unit/spec/create_spec.rb +1 -1
  249. data/examples/systemd_unit/spec/delete_spec.rb +1 -1
  250. data/examples/systemd_unit/spec/disable_spec.rb +1 -1
  251. data/examples/systemd_unit/spec/enable_spec.rb +1 -1
  252. data/examples/systemd_unit/spec/mask_spec.rb +1 -1
  253. data/examples/systemd_unit/spec/reload_or_restart_spec.rb +1 -1
  254. data/examples/systemd_unit/spec/reload_or_try_restart_spec.rb +1 -1
  255. data/examples/systemd_unit/spec/restart_spec.rb +1 -1
  256. data/examples/systemd_unit/spec/start_spec.rb +1 -1
  257. data/examples/systemd_unit/spec/stop_spec.rb +1 -1
  258. data/examples/systemd_unit/spec/try_restart_spec.rb +1 -1
  259. data/examples/systemd_unit/spec/unmask_spec.rb +1 -1
  260. data/examples/template/spec/create_if_missing_spec.rb +1 -1
  261. data/examples/template/spec/create_spec.rb +1 -1
  262. data/examples/template/spec/delete_spec.rb +1 -1
  263. data/examples/template/spec/touch_spec.rb +1 -1
  264. data/examples/use_inline_resources/spec/default_spec.rb +1 -1
  265. data/examples/user/spec/create_spec.rb +1 -1
  266. data/examples/user/spec/lock_spec.rb +1 -1
  267. data/examples/user/spec/manage_spec.rb +1 -1
  268. data/examples/user/spec/modify_spec.rb +1 -1
  269. data/examples/user/spec/remove_spec.rb +1 -1
  270. data/examples/user/spec/unlock_spec.rb +1 -1
  271. data/examples/windows_package/spec/install_spec.rb +1 -1
  272. data/examples/windows_package/spec/remove_spec.rb +1 -1
  273. data/examples/windows_service/spec/configure_startup_spec.rb +1 -1
  274. data/examples/windows_service/spec/disable_spec.rb +1 -1
  275. data/examples/windows_service/spec/enable_spec.rb +1 -1
  276. data/examples/windows_service/spec/reload_spec.rb +1 -1
  277. data/examples/windows_service/spec/restart_spec.rb +1 -1
  278. data/examples/windows_service/spec/start_spec.rb +1 -1
  279. data/examples/windows_service/spec/stop_spec.rb +1 -1
  280. data/examples/yum_package/spec/install_spec.rb +1 -1
  281. data/examples/yum_package/spec/lock_spec.rb +1 -1
  282. data/examples/yum_package/spec/purge_spec.rb +1 -1
  283. data/examples/yum_package/spec/remove_spec.rb +1 -1
  284. data/examples/yum_package/spec/unlock_spec.rb +1 -1
  285. data/examples/yum_package/spec/upgrade_spec.rb +1 -1
  286. data/examples/yum_repository/spec/add_spec.rb +1 -1
  287. data/examples/yum_repository/spec/create_spec.rb +1 -1
  288. data/examples/yum_repository/spec/delete_spec.rb +1 -1
  289. data/examples/yum_repository/spec/makecache_spec.rb +1 -1
  290. data/examples/yum_repository/spec/remove_spec.rb +1 -1
  291. data/examples/zypper_package/spec/install_spec.rb +1 -1
  292. data/examples/zypper_package/spec/lock_spec.rb +1 -1
  293. data/examples/zypper_package/spec/purge_spec.rb +1 -1
  294. data/examples/zypper_package/spec/remove_spec.rb +1 -1
  295. data/examples/zypper_package/spec/unlock_spec.rb +1 -1
  296. data/examples/zypper_package/spec/upgrade_spec.rb +1 -1
  297. data/lib/chefspec.rb +1 -1
  298. data/lib/chefspec/api.rb +33 -14
  299. data/lib/chefspec/api/core.rb +195 -0
  300. data/lib/chefspec/api/described.rb +55 -0
  301. data/lib/chefspec/api/do_nothing.rb +24 -19
  302. data/lib/chefspec/api/include_recipe.rb +26 -21
  303. data/lib/chefspec/api/link.rb +26 -21
  304. data/lib/chefspec/api/notifications.rb +38 -33
  305. data/lib/chefspec/api/reboot.rb +11 -6
  306. data/lib/chefspec/api/render_file.rb +35 -30
  307. data/lib/chefspec/api/state_attrs.rb +28 -23
  308. data/lib/chefspec/api/stubs.rb +183 -0
  309. data/lib/chefspec/api/stubs_for.rb +134 -0
  310. data/lib/chefspec/api/subscriptions.rb +35 -30
  311. data/lib/chefspec/api/user.rb +222 -217
  312. data/lib/chefspec/berkshelf.rb +1 -1
  313. data/lib/chefspec/deprecations.rb +2 -11
  314. data/lib/chefspec/errors.rb +1 -0
  315. data/lib/chefspec/extensions.rb +4 -1
  316. data/lib/chefspec/extensions/chef/client.rb +3 -4
  317. data/lib/chefspec/extensions/chef/conditional.rb +3 -2
  318. data/lib/chefspec/extensions/chef/cookbook/gem_installer.rb +25 -28
  319. data/lib/chefspec/extensions/chef/cookbook_loader.rb +13 -0
  320. data/lib/chefspec/extensions/chef/cookbook_uploader.rb +3 -2
  321. data/lib/chefspec/extensions/chef/data_query.rb +5 -8
  322. data/lib/chefspec/extensions/chef/lwrp_base.rb +17 -21
  323. data/lib/chefspec/extensions/chef/provider.rb +36 -0
  324. data/lib/chefspec/extensions/chef/resource.rb +51 -4
  325. data/lib/chefspec/extensions/chef/resource/freebsd_package.rb +13 -16
  326. data/lib/chefspec/extensions/chef/run_context/cookbook_compiler.rb +64 -0
  327. data/lib/chefspec/matchers/render_file_matcher.rb +36 -26
  328. data/lib/chefspec/matchers/resource_matcher.rb +1 -1
  329. data/lib/chefspec/rspec.rb +3 -8
  330. data/lib/chefspec/runner.rb +8 -0
  331. data/lib/chefspec/server_methods.rb +1 -1
  332. data/lib/chefspec/server_runner.rb +13 -9
  333. data/lib/chefspec/solo_runner.rb +136 -32
  334. data/lib/chefspec/version.rb +1 -1
  335. data/spec/unit/deprecations_spec.rb +1 -26
  336. data/spec/unit/macros_spec.rb +14 -14
  337. data/spec/unit/matchers/render_file_matcher_spec.rb +8 -1
  338. data/spec/unit/solo_runner_spec.rb +3 -3
  339. data/templates/errors/may_need_to_specify_platform.erb +1 -1
  340. data/templates/errors/shell_out_not_stubbed.erb +10 -0
  341. metadata +38 -4
  342. data/lib/chefspec/macros.rb +0 -222
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'osx_profile::remove' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'mac_os_x', version: '10.12').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'mac_os_x', version: '10.13').converge(described_recipe) }
5
5
 
6
6
  it 'removes an osx_profile from the resource name' do
7
7
  expect(chef_run).to remove_osx_profile('specifying profile')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'package::install' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'installs a package with the default action' do
7
7
  expect(chef_run).to install_package('default_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'package::lock' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'locks a package with an explicit action' do
7
7
  expect(chef_run).to lock_package('explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'package::purge' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'purges a package with an explicit action' do
7
7
  expect(chef_run).to purge_package('explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'package::reconfig' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'reconfigs a package with an explicit action' do
7
7
  expect(chef_run).to reconfig_package('explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'package::remove' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'removes a package with an explicit action' do
7
7
  expect(chef_run).to remove_package('explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'package::unlock' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'unlocks a package with an explicit action' do
7
7
  expect(chef_run).to unlock_package('explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'package::upgrade' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'upgrades a package with an explicit action' do
7
7
  expect(chef_run).to upgrade_package('explicit_action')
@@ -2,7 +2,7 @@ require 'chefspec'
2
2
 
3
3
  describe 'pacman_package::install' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'arch', version: '4.10.13-1-ARCH')
5
+ ChefSpec::SoloRunner.new(platform: 'arch', version: '4.10.13-1-ARCH')
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
@@ -2,7 +2,7 @@ require 'chefspec'
2
2
 
3
3
  describe 'pacman_package::purge' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'arch', version: '4.10.13-1-ARCH')
5
+ ChefSpec::SoloRunner.new(platform: 'arch', version: '4.10.13-1-ARCH')
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
@@ -2,7 +2,7 @@ require 'chefspec'
2
2
 
3
3
  describe 'pacman_package::remove' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'arch', version: '4.10.13-1-ARCH')
5
+ ChefSpec::SoloRunner.new(platform: 'arch', version: '4.10.13-1-ARCH')
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
@@ -2,7 +2,7 @@ require 'chefspec'
2
2
 
3
3
  describe 'pacman_package::upgrade' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'arch', version: '4.10.13-1-ARCH')
5
+ ChefSpec::SoloRunner.new(platform: 'arch', version: '4.10.13-1-ARCH')
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'paludis_package::install' do
4
- let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'gentoo', version: '4.9.6-gentoo-r1').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'gentoo', version: '4.9.95-gentoo').converge(described_recipe) }
5
5
 
6
6
  it 'installs a paludis_package with the default action' do
7
7
  expect(chef_run).to install_paludis_package('default_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'paludis_package::purge' do
4
- let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'gentoo', version: '4.9.6-gentoo-r1').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'gentoo', version: '4.9.95-gentoo').converge(described_recipe) }
5
5
 
6
6
  it 'purges a paludis_package with an explicit action' do
7
7
  expect(chef_run).to purge_paludis_package('explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'paludis_package::remove' do
4
- let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'gentoo', version: '4.9.6-gentoo-r1').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'gentoo', version: '4.9.95-gentoo').converge(described_recipe) }
5
5
 
6
6
  it 'removes a paludis_package with an explicit action' do
7
7
  expect(chef_run).to remove_paludis_package('explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'paludis_package::upgrade' do
4
- let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'gentoo', version: '4.9.6-gentoo-r1').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'gentoo', version: '4.9.95-gentoo').converge(described_recipe) }
5
5
 
6
6
  it 'upgrades a paludis_package with an explicit action' do
7
7
  expect(chef_run).to upgrade_paludis_package('explicit_action')
@@ -2,7 +2,7 @@ require 'chefspec'
2
2
 
3
3
  describe 'portage_package::install' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'gentoo', version: '4.9.6-gentoo-r1')
5
+ ChefSpec::SoloRunner.new(platform: 'gentoo', version: '4.9.95-gentoo')
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
@@ -2,7 +2,7 @@ require 'chefspec'
2
2
 
3
3
  describe 'portage_package::purge' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'gentoo', version: '4.9.6-gentoo-r1')
5
+ ChefSpec::SoloRunner.new(platform: 'gentoo', version: '4.9.95-gentoo')
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
@@ -2,7 +2,7 @@ require 'chefspec'
2
2
 
3
3
  describe 'portage_package::remove' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'gentoo', version: '4.9.6-gentoo-r1')
5
+ ChefSpec::SoloRunner.new(platform: 'gentoo', version: '4.9.95-gentoo')
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
@@ -2,7 +2,7 @@ require 'chefspec'
2
2
 
3
3
  describe 'portage_package::upgrade' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'gentoo', version: '4.9.6-gentoo-r1')
5
+ ChefSpec::SoloRunner.new(platform: 'gentoo', version: '4.9.95-gentoo')
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
@@ -2,7 +2,7 @@ require 'chefspec'
2
2
 
3
3
  describe 'powershell_script::run' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'windows', version: '2012R2')
5
+ ChefSpec::SoloRunner.new(platform: 'windows', version: '2016')
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'reboot::cancel' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'runs a cancel_reboot' do
7
7
  expect(chef_run).to cancel_reboot('explicit cancel')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'reboot::now' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'runs a reboot_now when specifying action' do
7
7
  expect(chef_run).to now_reboot('explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'reboot::request' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'runs a request_reboot' do
7
7
  expect(chef_run).to request_reboot('explicit_action')
@@ -0,0 +1 @@
1
+ name "recipe_block"
@@ -0,0 +1,34 @@
1
+ describe 'recipe block' do
2
+ platform 'ubuntu', '18.04'
3
+ recipe do
4
+ log 'this is a recipe block'
5
+ end
6
+
7
+ it { expect(chef_run).to write_log('this is a recipe block') }
8
+ it { expect(subject).to write_log('this is a recipe block') }
9
+ it { is_expected.to write_log('this is a recipe block') }
10
+ end
11
+
12
+ describe 'complex recipe block' do
13
+ platform 'ubuntu', '18.04'
14
+ recipe do
15
+ package 'apache2' do
16
+ version '1.2.3'
17
+ end
18
+ template '/etc/apache2/apache2.conf' do
19
+ source 'apache2.conf.erb'
20
+ owner 'root'
21
+ variables platform: node['platform']
22
+ end
23
+ service 'apache2' do
24
+ action [:start, :enable]
25
+ subscribes :restart, 'template[/etc/apache2/apache2.conf]'
26
+ end
27
+ end
28
+
29
+ it { is_expected.to install_package('apache2').with(version: '1.2.3') }
30
+ it { is_expected.to render_file('/etc/apache2/apache2.conf').with_content("Hello ubuntu\n") }
31
+ it { is_expected.to start_service('apache2') }
32
+ it { is_expected.to enable_service('apache2') }
33
+ it { expect(chef_run.template('/etc/apache2/apache2.conf')).to notify('service[apache2]') }
34
+ end
@@ -0,0 +1 @@
1
+ Hello <%= @platform %>
@@ -2,7 +2,7 @@ require 'chefspec'
2
2
 
3
3
  describe 'registry_key::create_if_missing' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'windows', version: '2012R2')
5
+ ChefSpec::SoloRunner.new(platform: 'windows', version: '2016')
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
@@ -2,7 +2,7 @@ require 'chefspec'
2
2
 
3
3
  describe 'registry_key::create' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'windows', version: '2012R2')
5
+ ChefSpec::SoloRunner.new(platform: 'windows', version: '2016')
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
@@ -2,7 +2,7 @@ require 'chefspec'
2
2
 
3
3
  describe 'registry_key::delete_key' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'windows', version: '2012R2')
5
+ ChefSpec::SoloRunner.new(platform: 'windows', version: '2016')
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
@@ -2,7 +2,7 @@ require 'chefspec'
2
2
 
3
3
  describe 'registry_key::delete' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'windows', version: '2012R2')
5
+ ChefSpec::SoloRunner.new(platform: 'windows', version: '2016')
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'remote_directory::create_if_missing' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'creates a remote_directory with an explicit action' do
7
7
  expect(chef_run).to create_remote_directory_if_missing('/tmp/explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'remote_directory::create' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'creates a remote_directory with the default action' do
7
7
  expect(chef_run).to create_remote_directory('/tmp/default_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'remote_directory::delete' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'deletes a remote_directory with an explicit action' do
7
7
  expect(chef_run).to delete_remote_directory('/tmp/explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'remote_file::create_if_missing' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'creates a remote_file with an explicit action' do
7
7
  expect(chef_run).to create_remote_file_if_missing('/tmp/explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'remote_file::create' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'creates a remote_file with the default action' do
7
7
  expect(chef_run).to create_remote_file('/tmp/default_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'remote_file::delete' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'deletes a remote_file with an explicit action' do
7
7
  expect(chef_run).to delete_remote_file('/tmp/explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'remote_file::touch' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'touchs a remote_file with an explicit action' do
7
7
  expect(chef_run).to touch_remote_file('/tmp/explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'render_file::default' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  context 'file' do
7
7
  it 'renders the file' do
@@ -74,6 +74,17 @@ describe 'render_file::default' do
74
74
  end_with('not')
75
75
  )
76
76
  end
77
+
78
+ it 'renders the file with chained content matchers' do
79
+ expect(chef_run).to render_file('/tmp/cookbook_file')
80
+ .with_content('This')
81
+ .with_content('is')
82
+ .with_content('content!')
83
+ expect(chef_run).to_not render_file('/tmp/cookbook_file')
84
+ .with_content('Sparta!')
85
+ .with_content('is')
86
+ .with_content('This')
87
+ end
77
88
  end
78
89
 
79
90
  context 'with a pristine filesystem' do
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'render_file::template_helpers' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'renders the file using a helper' do
7
7
  expect(chef_run).to render_file('/tmp/template_with_helper')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'roles' do
4
- let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge('role[role]') }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge('role[role]') }
5
5
 
6
6
  it 'expands the run_list' do
7
7
  expect(chef_run).to include_recipe('roles::default')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'route::add' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'adds a route with the default action' do
7
7
  expect(chef_run).to add_route('10.0.0.1')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'route::delete' do
4
- let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
5
5
 
6
6
  it 'deletes a route with an explicit action' do
7
7
  expect(chef_run).to delete_route('10.0.0.2')