chef 11.10.0.rc.0 → 11.10.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (401) hide show
  1. data/Rakefile +0 -75
  2. data/distro/common/html/_sources/ctl_chef_client.txt +36 -0
  3. data/distro/common/html/_sources/ctl_chef_server.txt +26 -0
  4. data/distro/common/html/_sources/ctl_chef_shell.txt +15 -0
  5. data/distro/common/html/_sources/ctl_chef_solo.txt +25 -0
  6. data/distro/common/html/_sources/index.txt +126 -0
  7. data/distro/common/html/_sources/knife.txt +74 -0
  8. data/distro/common/html/_sources/knife_bootstrap.txt +56 -0
  9. data/distro/common/html/_sources/knife_client.txt +151 -0
  10. data/distro/common/html/_sources/knife_common_options.txt +6 -0
  11. data/distro/common/html/_sources/knife_configure.txt +29 -0
  12. data/distro/common/html/_sources/knife_cookbook.txt +236 -0
  13. data/distro/common/html/_sources/knife_cookbook_site.txt +157 -0
  14. data/distro/common/html/_sources/knife_data_bag.txt +160 -0
  15. data/distro/common/html/_sources/knife_delete.txt +26 -0
  16. data/distro/common/html/_sources/knife_deps.txt +61 -0
  17. data/distro/common/html/_sources/knife_diff.txt +34 -0
  18. data/distro/common/html/_sources/knife_download.txt +44 -0
  19. data/distro/common/html/_sources/knife_edit.txt +26 -0
  20. data/distro/common/html/_sources/knife_environment.txt +158 -0
  21. data/distro/common/html/_sources/knife_exec.txt +47 -0
  22. data/distro/common/html/_sources/knife_index_rebuild.txt +21 -0
  23. data/distro/common/html/_sources/knife_list.txt +33 -0
  24. data/distro/common/html/_sources/knife_node.txt +250 -0
  25. data/distro/common/html/_sources/knife_raw.txt +35 -0
  26. data/distro/common/html/_sources/knife_recipe_list.txt +23 -0
  27. data/distro/common/html/_sources/knife_role.txt +157 -0
  28. data/distro/common/html/_sources/knife_search.txt +53 -0
  29. data/distro/common/html/_sources/knife_show.txt +27 -0
  30. data/distro/common/html/_sources/knife_ssh.txt +43 -0
  31. data/distro/common/html/_sources/knife_status.txt +37 -0
  32. data/distro/common/html/_sources/knife_tag.txt +69 -0
  33. data/distro/common/html/_sources/knife_upload.txt +49 -0
  34. data/distro/common/html/_sources/knife_user.txt +127 -0
  35. data/distro/common/html/_sources/knife_using.txt +43 -0
  36. data/distro/common/html/_sources/knife_xargs.txt +30 -0
  37. data/distro/common/html/_static/ajax-loader.gif +0 -0
  38. data/distro/common/html/_static/basic.css +540 -0
  39. data/distro/common/html/_static/chef.css +507 -0
  40. data/distro/common/html/_static/chef.ico +0 -0
  41. data/distro/common/html/_static/chef_html_logo.png +0 -0
  42. data/distro/common/html/_static/chef_logo.png +0 -0
  43. data/distro/common/html/_static/comment-bright.png +0 -0
  44. data/distro/common/html/_static/comment-close.png +0 -0
  45. data/distro/common/html/_static/comment.png +0 -0
  46. data/distro/common/html/_static/contents.png +0 -0
  47. data/distro/common/html/_static/doctools.js +247 -0
  48. data/distro/common/html/_static/down-pressed.png +0 -0
  49. data/distro/common/html/_static/down.png +0 -0
  50. data/distro/common/html/_static/file.png +0 -0
  51. data/distro/common/html/_static/guide.css +505 -0
  52. data/distro/common/html/_static/jquery.js +154 -0
  53. data/distro/common/html/_static/minus.png +0 -0
  54. data/distro/common/html/_static/navigation.png +0 -0
  55. data/distro/common/html/_static/plus.png +0 -0
  56. data/distro/common/html/_static/pygments.css +62 -0
  57. data/distro/common/html/_static/searchtools.js +560 -0
  58. data/distro/common/html/_static/underscore.js +23 -0
  59. data/distro/common/html/_static/up-pressed.png +0 -0
  60. data/distro/common/html/_static/up.png +0 -0
  61. data/distro/common/html/_static/websupport.js +808 -0
  62. data/distro/common/html/ctl_chef_client.html +219 -0
  63. data/distro/common/html/ctl_chef_server.html +111 -0
  64. data/distro/common/html/ctl_chef_shell.html +120 -0
  65. data/distro/common/html/ctl_chef_solo.html +144 -0
  66. data/distro/common/html/index.html +185 -0
  67. data/distro/common/html/knife.html +172 -0
  68. data/distro/common/html/knife_bootstrap.html +250 -0
  69. data/distro/common/html/knife_client.html +283 -0
  70. data/distro/common/html/knife_common_options.html +98 -0
  71. data/distro/common/html/knife_configure.html +107 -0
  72. data/distro/common/html/knife_cookbook.html +481 -0
  73. data/distro/common/html/knife_cookbook_site.html +372 -0
  74. data/distro/common/html/knife_data_bag.html +359 -0
  75. data/distro/common/html/knife_delete.html +95 -0
  76. data/distro/common/html/knife_deps.html +145 -0
  77. data/distro/common/html/knife_diff.html +125 -0
  78. data/distro/common/html/knife_download.html +147 -0
  79. data/distro/common/html/knife_edit.html +91 -0
  80. data/distro/common/html/knife_environment.html +328 -0
  81. data/distro/common/html/knife_exec.html +222 -0
  82. data/distro/common/html/knife_index_rebuild.html +85 -0
  83. data/distro/common/html/knife_list.html +116 -0
  84. data/distro/common/html/knife_node.html +450 -0
  85. data/distro/common/html/knife_raw.html +112 -0
  86. data/distro/common/html/knife_recipe_list.html +93 -0
  87. data/distro/common/html/knife_role.html +295 -0
  88. data/distro/common/html/knife_search.html +204 -0
  89. data/distro/common/html/knife_show.html +106 -0
  90. data/distro/common/html/knife_ssh.html +179 -0
  91. data/distro/common/html/knife_status.html +142 -0
  92. data/distro/common/html/knife_tag.html +140 -0
  93. data/distro/common/html/knife_upload.html +155 -0
  94. data/distro/common/html/knife_user.html +244 -0
  95. data/distro/common/html/knife_using.html +211 -0
  96. data/distro/common/html/knife_xargs.html +115 -0
  97. data/distro/common/html/objects.inv +0 -0
  98. data/distro/common/html/search.html +84 -0
  99. data/distro/common/html/searchindex.js +1 -0
  100. data/distro/common/man/man1/chef-shell.1 +5 -5
  101. data/distro/common/man/man1/knife-bootstrap.1 +6 -9
  102. data/distro/common/man/man1/knife-client.1 +1 -9
  103. data/distro/common/man/man1/knife-configure.1 +10 -6
  104. data/distro/common/man/man1/knife-cookbook-site.1 +1 -9
  105. data/distro/common/man/man1/knife-cookbook.1 +11 -21
  106. data/distro/common/man/man1/knife-data-bag.1 +8 -22
  107. data/distro/common/man/man1/knife-delete.1 +1 -1
  108. data/distro/common/man/man1/knife-deps.1 +4 -12
  109. data/distro/common/man/man1/knife-diff.1 +1 -1
  110. data/distro/common/man/man1/knife-download.1 +2 -2
  111. data/distro/common/man/man1/knife-edit.1 +1 -1
  112. data/distro/common/man/man1/knife-environment.1 +108 -9
  113. data/distro/common/man/man1/knife-exec.1 +1 -15
  114. data/distro/common/man/man1/knife-index-rebuild.1 +1 -1
  115. data/distro/common/man/man1/knife-list.1 +1 -1
  116. data/distro/common/man/man1/knife-node.1 +3 -13
  117. data/distro/common/man/man1/knife-raw.1 +1 -1
  118. data/distro/common/man/man1/knife-recipe-list.1 +1 -1
  119. data/distro/common/man/man1/knife-role.1 +2 -12
  120. data/distro/common/man/man1/knife-search.1 +5 -5
  121. data/distro/common/man/man1/knife-show.1 +1 -3
  122. data/distro/common/man/man1/knife-ssh.1 +1 -5
  123. data/distro/common/man/man1/knife-status.1 +1 -1
  124. data/distro/common/man/man1/knife-tag.1 +1 -9
  125. data/distro/common/man/man1/knife-upload.1 +7 -9
  126. data/distro/common/man/man1/knife-user.1 +3 -17
  127. data/distro/common/man/man1/knife-xargs.1 +1 -3
  128. data/distro/common/man/man8/chef-client.8 +18 -18
  129. data/distro/common/man/man8/chef-solo.8 +12 -6
  130. data/lib/chef/client.rb +9 -5
  131. data/lib/chef/cookbook_uploader.rb +1 -1
  132. data/lib/chef/dsl/recipe.rb +119 -38
  133. data/lib/chef/exceptions.rb +4 -0
  134. data/lib/chef/policy_builder/expand_node_object.rb +11 -4
  135. data/lib/chef/policy_builder/policyfile.rb +7 -1
  136. data/lib/chef/provider/file.rb +1 -0
  137. data/lib/chef/resource_platform_map.rb +1 -1
  138. data/lib/chef/resource_reporter.rb +2 -2
  139. data/lib/chef/version.rb +1 -1
  140. data/spec/functional/knife/cookbook_delete_spec.rb +9 -9
  141. data/spec/functional/knife/ssh_spec.rb +1 -1
  142. data/spec/functional/resource/link_spec.rb +6 -6
  143. data/spec/functional/resource/registry_spec.rb +7 -7
  144. data/spec/functional/run_lock_spec.rb +1 -1
  145. data/spec/integration/knife/download_spec.rb +1 -1
  146. data/spec/integration/solo/solo_spec.rb +1 -1
  147. data/spec/spec_helper.rb +0 -1
  148. data/spec/stress/win32/file_spec.rb +6 -0
  149. data/spec/support/lib/chef/resource/zen_master.rb +1 -1
  150. data/spec/support/mock/platform.rb +1 -1
  151. data/spec/support/shared/functional/file_resource.rb +0 -2
  152. data/spec/support/shared/functional/securable_resource.rb +2 -2
  153. data/spec/support/shared/unit/api_error_inspector.rb +7 -7
  154. data/spec/support/shared/unit/provider/file.rb +47 -8
  155. data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +23 -23
  156. data/spec/unit/api_client/registration_spec.rb +5 -5
  157. data/spec/unit/api_client_spec.rb +2 -2
  158. data/spec/unit/application/apply.rb +6 -6
  159. data/spec/unit/application/client_spec.rb +6 -6
  160. data/spec/unit/application/knife_spec.rb +5 -5
  161. data/spec/unit/application/solo_spec.rb +13 -13
  162. data/spec/unit/application_spec.rb +19 -19
  163. data/spec/unit/checksum/storage/filesystem_spec.rb +2 -2
  164. data/spec/unit/client_spec.rb +23 -23
  165. data/spec/unit/config_spec.rb +4 -4
  166. data/spec/unit/cookbook/metadata_spec.rb +22 -22
  167. data/spec/unit/cookbook/synchronizer_spec.rb +17 -17
  168. data/spec/unit/daemon_spec.rb +21 -22
  169. data/spec/unit/data_bag_item_spec.rb +8 -8
  170. data/spec/unit/data_bag_spec.rb +6 -6
  171. data/spec/unit/deprecation_spec.rb +1 -1
  172. data/spec/unit/dsl/data_query_spec.rb +1 -1
  173. data/spec/unit/environment_spec.rb +5 -5
  174. data/spec/unit/file_access_control_spec.rb +5 -5
  175. data/spec/unit/file_cache_spec.rb +1 -1
  176. data/spec/unit/file_content_management/deploy/mv_unix_spec.rb +1 -1
  177. data/spec/unit/file_content_management/deploy/mv_windows_spec.rb +12 -12
  178. data/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +4 -4
  179. data/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb +4 -4
  180. data/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb +1 -1
  181. data/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +6 -6
  182. data/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb +4 -4
  183. data/spec/unit/handler/json_file_spec.rb +1 -1
  184. data/spec/unit/handler_spec.rb +3 -3
  185. data/spec/unit/knife/bootstrap_spec.rb +17 -17
  186. data/spec/unit/knife/client_bulk_delete_spec.rb +4 -4
  187. data/spec/unit/knife/client_create_spec.rb +7 -7
  188. data/spec/unit/knife/client_reregister_spec.rb +2 -2
  189. data/spec/unit/knife/client_show_spec.rb +1 -1
  190. data/spec/unit/knife/config_file_selection_spec.rb +4 -4
  191. data/spec/unit/knife/configure_client_spec.rb +4 -4
  192. data/spec/unit/knife/configure_spec.rb +16 -16
  193. data/spec/unit/knife/cookbook_bulk_delete_spec.rb +10 -10
  194. data/spec/unit/knife/cookbook_create_spec.rb +5 -5
  195. data/spec/unit/knife/cookbook_delete_spec.rb +6 -6
  196. data/spec/unit/knife/cookbook_download_spec.rb +10 -10
  197. data/spec/unit/knife/cookbook_list_spec.rb +3 -3
  198. data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +2 -2
  199. data/spec/unit/knife/cookbook_metadata_spec.rb +8 -8
  200. data/spec/unit/knife/cookbook_show_spec.rb +4 -4
  201. data/spec/unit/knife/cookbook_site_download_spec.rb +3 -3
  202. data/spec/unit/knife/cookbook_site_install_spec.rb +8 -8
  203. data/spec/unit/knife/cookbook_site_share_spec.rb +22 -22
  204. data/spec/unit/knife/cookbook_site_unshare_spec.rb +8 -8
  205. data/spec/unit/knife/cookbook_test_spec.rb +7 -7
  206. data/spec/unit/knife/cookbook_upload_spec.rb +20 -20
  207. data/spec/unit/knife/core/cookbook_scm_repo_spec.rb +6 -6
  208. data/spec/unit/knife/core/object_loader_spec.rb +1 -1
  209. data/spec/unit/knife/core/ui_spec.rb +19 -21
  210. data/spec/unit/knife/data_bag_create_spec.rb +4 -4
  211. data/spec/unit/knife/data_bag_edit_spec.rb +7 -7
  212. data/spec/unit/knife/data_bag_from_file_spec.rb +15 -15
  213. data/spec/unit/knife/data_bag_show_spec.rb +5 -5
  214. data/spec/unit/knife/environment_create_spec.rb +6 -6
  215. data/spec/unit/knife/environment_delete_spec.rb +6 -6
  216. data/spec/unit/knife/environment_edit_spec.rb +5 -5
  217. data/spec/unit/knife/environment_from_file_spec.rb +7 -7
  218. data/spec/unit/knife/environment_list_spec.rb +4 -4
  219. data/spec/unit/knife/environment_show_spec.rb +4 -4
  220. data/spec/unit/knife/index_rebuild_spec.rb +2 -2
  221. data/spec/unit/knife/knife_help.rb +11 -11
  222. data/spec/unit/knife/node_bulk_delete_spec.rb +4 -4
  223. data/spec/unit/knife/node_delete_spec.rb +5 -5
  224. data/spec/unit/knife/node_edit_spec.rb +2 -2
  225. data/spec/unit/knife/node_from_file_spec.rb +5 -5
  226. data/spec/unit/knife/node_list_spec.rb +3 -3
  227. data/spec/unit/knife/node_run_list_add_spec.rb +3 -3
  228. data/spec/unit/knife/node_run_list_remove_spec.rb +4 -4
  229. data/spec/unit/knife/node_run_list_set_spec.rb +5 -5
  230. data/spec/unit/knife/node_show_spec.rb +2 -2
  231. data/spec/unit/knife/role_bulk_delete_spec.rb +4 -4
  232. data/spec/unit/knife/role_create_spec.rb +5 -5
  233. data/spec/unit/knife/role_delete_spec.rb +5 -5
  234. data/spec/unit/knife/role_edit_spec.rb +5 -5
  235. data/spec/unit/knife/role_from_file_spec.rb +5 -5
  236. data/spec/unit/knife/role_list_spec.rb +2 -2
  237. data/spec/unit/knife/ssh_spec.rb +6 -6
  238. data/spec/unit/knife/status_spec.rb +4 -4
  239. data/spec/unit/knife/tag_create_spec.rb +3 -3
  240. data/spec/unit/knife/tag_delete_spec.rb +3 -3
  241. data/spec/unit/knife/tag_list_spec.rb +2 -2
  242. data/spec/unit/knife/user_create_spec.rb +7 -7
  243. data/spec/unit/knife/user_reregister_spec.rb +3 -3
  244. data/spec/unit/knife/user_show_spec.rb +1 -1
  245. data/spec/unit/knife_spec.rb +29 -29
  246. data/spec/unit/lwrp_spec.rb +2 -2
  247. data/spec/unit/mixin/checksum_spec.rb +2 -2
  248. data/spec/unit/mixin/command_spec.rb +1 -1
  249. data/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb +4 -4
  250. data/spec/unit/mixin/params_validate_spec.rb +17 -17
  251. data/spec/unit/mixin/path_sanity_spec.rb +8 -8
  252. data/spec/unit/mixin/securable_spec.rb +87 -87
  253. data/spec/unit/mixin/shell_out_spec.rb +1 -1
  254. data/spec/unit/mixin/template_spec.rb +2 -2
  255. data/spec/unit/node/attribute_spec.rb +3 -3
  256. data/spec/unit/node_spec.rb +12 -12
  257. data/spec/unit/platform_spec.rb +1 -1
  258. data/spec/unit/policy_builder/expand_node_object_spec.rb +16 -0
  259. data/spec/unit/policy_builder/policyfile_spec.rb +4 -0
  260. data/spec/unit/provider/breakpoint_spec.rb +8 -8
  261. data/spec/unit/provider/cookbook_file/content_spec.rb +4 -4
  262. data/spec/unit/provider/cookbook_file_spec.rb +1 -1
  263. data/spec/unit/provider/cron/unix_spec.rb +11 -11
  264. data/spec/unit/provider/cron_spec.rb +40 -40
  265. data/spec/unit/provider/deploy/revision_spec.rb +11 -12
  266. data/spec/unit/provider/deploy/timestamped_spec.rb +3 -3
  267. data/spec/unit/provider/deploy_spec.rb +50 -50
  268. data/spec/unit/provider/directory_spec.rb +18 -18
  269. data/spec/unit/provider/env_spec.rb +15 -15
  270. data/spec/unit/provider/erl_call_spec.rb +1 -1
  271. data/spec/unit/provider/execute_spec.rb +5 -5
  272. data/spec/unit/provider/file/content_spec.rb +5 -5
  273. data/spec/unit/provider/file_spec.rb +1 -1
  274. data/spec/unit/provider/git_spec.rb +47 -47
  275. data/spec/unit/provider/group/dscl_spec.rb +16 -15
  276. data/spec/unit/provider/group/gpasswd_spec.rb +6 -5
  277. data/spec/unit/provider/group/groupadd_spec.rb +10 -10
  278. data/spec/unit/provider/group/groupmod_spec.rb +3 -3
  279. data/spec/unit/provider/group/pw_spec.rb +9 -8
  280. data/spec/unit/provider/group/usermod_spec.rb +13 -12
  281. data/spec/unit/provider/group/windows_spec.rb +9 -9
  282. data/spec/unit/provider/group_spec.rb +31 -31
  283. data/spec/unit/provider/http_request_spec.rb +3 -3
  284. data/spec/unit/provider/ifconfig/aix_spec.rb +7 -7
  285. data/spec/unit/provider/ifconfig/debian_spec.rb +3 -3
  286. data/spec/unit/provider/ifconfig/redhat_spec.rb +5 -5
  287. data/spec/unit/provider/ifconfig_spec.rb +13 -13
  288. data/spec/unit/provider/link_spec.rb +33 -33
  289. data/spec/unit/provider/mdadm_spec.rb +4 -4
  290. data/spec/unit/provider/mount/aix_spec.rb +5 -5
  291. data/spec/unit/provider/mount/mount_spec.rb +49 -50
  292. data/spec/unit/provider/mount/windows_spec.rb +18 -18
  293. data/spec/unit/provider/mount_spec.rb +12 -12
  294. data/spec/unit/provider/ohai_spec.rb +6 -6
  295. data/spec/unit/provider/package/aix_spec.rb +14 -14
  296. data/spec/unit/provider/package/apt_spec.rb +10 -10
  297. data/spec/unit/provider/package/dpkg_spec.rb +13 -13
  298. data/spec/unit/provider/package/easy_install_spec.rb +6 -6
  299. data/spec/unit/provider/package/freebsd_spec.rb +29 -29
  300. data/spec/unit/provider/package/ips_spec.rb +4 -4
  301. data/spec/unit/provider/package/macports_spec.rb +6 -6
  302. data/spec/unit/provider/package/pacman_spec.rb +17 -17
  303. data/spec/unit/provider/package/portage_spec.rb +18 -18
  304. data/spec/unit/provider/package/rpm_spec.rb +7 -7
  305. data/spec/unit/provider/package/rubygems_spec.rb +31 -31
  306. data/spec/unit/provider/package/smartos_spec.rb +4 -4
  307. data/spec/unit/provider/package/solaris_spec.rb +15 -15
  308. data/spec/unit/provider/package/yum_spec.rb +100 -100
  309. data/spec/unit/provider/package/zypper_spec.rb +10 -10
  310. data/spec/unit/provider/package_spec.rb +21 -21
  311. data/spec/unit/provider/registry_key_spec.rb +2 -2
  312. data/spec/unit/provider/remote_file/content_spec.rb +31 -31
  313. data/spec/unit/provider/remote_file/fetcher_spec.rb +8 -8
  314. data/spec/unit/provider/remote_file/ftp_spec.rb +10 -10
  315. data/spec/unit/provider/remote_file/http_spec.rb +4 -4
  316. data/spec/unit/provider/remote_file/local_file_spec.rb +2 -2
  317. data/spec/unit/provider/remote_file_spec.rb +1 -1
  318. data/spec/unit/provider/route_spec.rb +23 -23
  319. data/spec/unit/provider/script_spec.rb +5 -5
  320. data/spec/unit/provider/service/arch_service_spec.rb +41 -41
  321. data/spec/unit/provider/service/debian_service_spec.rb +23 -23
  322. data/spec/unit/provider/service/freebsd_service_spec.rb +33 -33
  323. data/spec/unit/provider/service/gentoo_service_spec.rb +16 -16
  324. data/spec/unit/provider/service/init_service_spec.rb +13 -13
  325. data/spec/unit/provider/service/insserv_service_spec.rb +4 -4
  326. data/spec/unit/provider/service/invokercd_service_spec.rb +12 -12
  327. data/spec/unit/provider/service/macosx_spec.rb +20 -20
  328. data/spec/unit/provider/service/redhat_spec.rb +15 -15
  329. data/spec/unit/provider/service/simple_service_spec.rb +9 -9
  330. data/spec/unit/provider/service/solaris_smf_service_spec.rb +13 -13
  331. data/spec/unit/provider/service/systemd_service_spec.rb +28 -28
  332. data/spec/unit/provider/service/upstart_service_spec.rb +41 -41
  333. data/spec/unit/provider/service/windows_spec.rb +37 -37
  334. data/spec/unit/provider/service_spec.rb +9 -9
  335. data/spec/unit/provider/subversion_spec.rb +36 -36
  336. data/spec/unit/provider/template/content_spec.rb +8 -8
  337. data/spec/unit/provider/template_spec.rb +1 -1
  338. data/spec/unit/provider/user/dscl_spec.rb +9 -9
  339. data/spec/unit/provider/user/pw_spec.rb +20 -20
  340. data/spec/unit/provider/user/solaris_spec.rb +5 -5
  341. data/spec/unit/provider/user/windows_spec.rb +8 -8
  342. data/spec/unit/provider/user_spec.rb +34 -34
  343. data/spec/unit/provider_spec.rb +3 -3
  344. data/spec/unit/recipe_spec.rb +79 -4
  345. data/spec/unit/registry_helper_spec.rb +2 -2
  346. data/spec/unit/resource/cron_spec.rb +2 -2
  347. data/spec/unit/resource/directory_spec.rb +5 -5
  348. data/spec/unit/resource/env_spec.rb +2 -2
  349. data/spec/unit/resource/erl_call_spec.rb +1 -1
  350. data/spec/unit/resource/file_spec.rb +8 -8
  351. data/spec/unit/resource/group_spec.rb +3 -3
  352. data/spec/unit/resource/link_spec.rb +8 -8
  353. data/spec/unit/resource/mdadm_spec.rb +3 -3
  354. data/spec/unit/resource/mount_spec.rb +3 -3
  355. data/spec/unit/resource/route_spec.rb +2 -2
  356. data/spec/unit/resource/user_spec.rb +2 -2
  357. data/spec/unit/resource/yum_package_spec.rb +2 -2
  358. data/spec/unit/resource_collection_spec.rb +1 -1
  359. data/spec/unit/resource_definition_spec.rb +2 -2
  360. data/spec/unit/resource_reporter_spec.rb +71 -16
  361. data/spec/unit/resource_spec.rb +3 -3
  362. data/spec/unit/rest/auth_credentials_spec.rb +2 -2
  363. data/spec/unit/rest_spec.rb +3 -40
  364. data/spec/unit/run_list/run_list_expansion_spec.rb +3 -3
  365. data/spec/unit/run_list_spec.rb +9 -9
  366. data/spec/unit/run_status_spec.rb +1 -1
  367. data/spec/unit/runner_spec.rb +8 -8
  368. data/spec/unit/scan_access_control_spec.rb +3 -3
  369. data/spec/unit/search/query_spec.rb +7 -7
  370. data/spec/unit/shell/model_wrapper_spec.rb +2 -2
  371. data/spec/unit/shell/shell_ext_spec.rb +15 -15
  372. data/spec/unit/shell/shell_session_spec.rb +9 -9
  373. data/spec/unit/shell_spec.rb +1 -2
  374. data/spec/unit/user_spec.rb +4 -4
  375. data/spec/unit/util/backup_spec.rb +1 -1
  376. data/spec/unit/util/selinux_spec.rb +7 -7
  377. metadata +106 -51
  378. data/distro/common/html/chef-client.8.html +0 -145
  379. data/distro/common/html/chef-expander.8.html +0 -164
  380. data/distro/common/html/chef-expanderctl.8.html +0 -146
  381. data/distro/common/html/chef-server-webui.8.html +0 -185
  382. data/distro/common/html/chef-server.8.html +0 -182
  383. data/distro/common/html/chef-shell.1.html +0 -286
  384. data/distro/common/html/chef-solo.8.html +0 -185
  385. data/distro/common/html/chef-solr.8.html +0 -165
  386. data/distro/common/html/knife-bootstrap.1.html +0 -241
  387. data/distro/common/html/knife-client.1.html +0 -219
  388. data/distro/common/html/knife-configure.1.html +0 -170
  389. data/distro/common/html/knife-cookbook-site.1.html +0 -241
  390. data/distro/common/html/knife-cookbook.1.html +0 -381
  391. data/distro/common/html/knife-data-bag.1.html +0 -235
  392. data/distro/common/html/knife-environment.1.html +0 -265
  393. data/distro/common/html/knife-exec.1.html +0 -134
  394. data/distro/common/html/knife-index.1.html +0 -125
  395. data/distro/common/html/knife-node.1.html +0 -250
  396. data/distro/common/html/knife-role.1.html +0 -200
  397. data/distro/common/html/knife-search.1.html +0 -288
  398. data/distro/common/html/knife-ssh.1.html +0 -156
  399. data/distro/common/html/knife-status.1.html +0 -128
  400. data/distro/common/html/knife-tag.1.html +0 -137
  401. data/distro/common/html/knife.1.html +0 -315
@@ -29,26 +29,26 @@ describe Chef::Provider::Package::Rpm do
29
29
 
30
30
  @provider = Chef::Provider::Package::Rpm.new(@new_resource, @run_context)
31
31
 
32
- @status = mock("Status", :exitstatus => 0)
33
- ::File.stub!(:exists?).and_return(true)
32
+ @status = double("Status", :exitstatus => 0)
33
+ ::File.stub(:exists?).and_return(true)
34
34
  end
35
35
 
36
36
  describe "when determining the current state of the package" do
37
37
 
38
38
  it "should create a current resource with the name of new_resource" do
39
- @provider.stub!(:popen4).and_return(@status)
39
+ @provider.stub(:popen4).and_return(@status)
40
40
  @provider.load_current_resource
41
41
  @provider.current_resource.name.should == "emacs"
42
42
  end
43
43
 
44
44
  it "should set the current reource package name to the new resource package name" do
45
- @provider.stub!(:popen4).and_return(@status)
45
+ @provider.stub(:popen4).and_return(@status)
46
46
  @provider.load_current_resource
47
47
  @provider.current_resource.package_name.should == 'emacs'
48
48
  end
49
49
 
50
50
  it "should raise an exception if a source is supplied but not found" do
51
- ::File.stub!(:exists?).and_return(false)
51
+ ::File.stub(:exists?).and_return(false)
52
52
  lambda { @provider.run_action(:any) }.should raise_error(Chef::Exceptions::Package)
53
53
  end
54
54
 
@@ -76,8 +76,8 @@ describe Chef::Provider::Package::Rpm do
76
76
  end
77
77
 
78
78
  it "should raise an exception if rpm fails to run" do
79
- status = mock("Status", :exitstatus => -1)
80
- @provider.stub!(:popen4).and_return(status)
79
+ status = double("Status", :exitstatus => -1)
80
+ @provider.stub(:popen4).and_return(status)
81
81
  lambda { @provider.run_action(:any) }.should raise_error(Chef::Exceptions::Package)
82
82
  end
83
83
  end
@@ -89,7 +89,7 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
89
89
  it "finds a matching gem candidate version" do
90
90
  dep = Gem::Dependency.new('rspec', '>= 0')
91
91
  dep_installer = Gem::DependencyInstaller.new
92
- @gem_env.stub!(:dependency_installer).and_return(dep_installer)
92
+ @gem_env.stub(:dependency_installer).and_return(dep_installer)
93
93
  latest = [[gemspec("rspec", Gem::Version.new("1.3.0")), "http://rubygems.org/"]]
94
94
  dep_installer.should_receive(:find_gems_with_sources).with(dep).and_return(latest)
95
95
  @gem_env.candidate_version_from_remote(Gem::Dependency.new('rspec', '>= 0')).should == Gem::Version.new('1.3.0')
@@ -98,9 +98,9 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
98
98
  it "finds a matching gem candidate version on rubygems 2.0.0+" do
99
99
  dep = Gem::Dependency.new('rspec', '>= 0')
100
100
  dep_installer = Gem::DependencyInstaller.new
101
- @gem_env.stub!(:dependency_installer).and_return(dep_installer)
102
- best_gem = mock("best gem match", :spec => gemspec("rspec", Gem::Version.new("1.3.0")), :source => "https://rubygems.org")
103
- available_set = mock("Gem::AvailableSet test double")
101
+ @gem_env.stub(:dependency_installer).and_return(dep_installer)
102
+ best_gem = double("best gem match", :spec => gemspec("rspec", Gem::Version.new("1.3.0")), :source => "https://rubygems.org")
103
+ available_set = double("Gem::AvailableSet test double")
104
104
  available_set.should_receive(:pick_best!)
105
105
  available_set.should_receive(:set).and_return([best_gem])
106
106
  dep_installer.should_receive(:find_gems_with_sources).with(dep).and_return(available_set)
@@ -121,7 +121,7 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
121
121
  Gem.const_set(:Format, Object.new)
122
122
  @remove_gem_format = true
123
123
  end
124
- Gem::Package.stub!(:respond_to?).with(:open).and_return(false)
124
+ Gem::Package.stub(:respond_to?).with(:open).and_return(false)
125
125
  end
126
126
 
127
127
  after do
@@ -131,7 +131,7 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
131
131
  end
132
132
 
133
133
  it "finds a matching gem candidate version on rubygems 2.0+ with some rubygems 1.8 code loaded" do
134
- package = mock("Gem::Package", :spec => "a gemspec from package")
134
+ package = double("Gem::Package", :spec => "a gemspec from package")
135
135
  Gem::Package.should_receive(:new).with("/path/to/package.gem").and_return(package)
136
136
  @gem_env.spec_from_file("/path/to/package.gem").should == "a gemspec from package"
137
137
  end
@@ -142,7 +142,7 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
142
142
  dep = Gem::Dependency.new('rspec', '>= 0')
143
143
  latest = []
144
144
  dep_installer = Gem::DependencyInstaller.new
145
- @gem_env.stub!(:dependency_installer).and_return(dep_installer)
145
+ @gem_env.stub(:dependency_installer).and_return(dep_installer)
146
146
  dep_installer.should_receive(:find_gems_with_sources).with(dep).and_return(latest)
147
147
  @gem_env.candidate_version_from_remote(Gem::Dependency.new('rspec', '>= 0')).should be_nil
148
148
  end
@@ -159,7 +159,7 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
159
159
 
160
160
  @gem_env.should_receive(:with_gem_sources).with('http://gems.example.com').and_yield
161
161
  dep_installer = Gem::DependencyInstaller.new
162
- @gem_env.stub!(:dependency_installer).and_return(dep_installer)
162
+ @gem_env.stub(:dependency_installer).and_return(dep_installer)
163
163
  dep_installer.should_receive(:find_gems_with_sources).with(dep).and_return(latest)
164
164
  @gem_env.candidate_version_from_remote(Gem::Dependency.new('rspec', '>=0'), 'http://gems.example.com').should == Gem::Version.new('1.3.0')
165
165
  end
@@ -180,14 +180,14 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
180
180
  end
181
181
 
182
182
  it "uninstalls all versions of a gem" do
183
- uninstaller = mock('gem uninstaller')
183
+ uninstaller = double('gem uninstaller')
184
184
  uninstaller.should_receive(:uninstall)
185
185
  @gem_env.should_receive(:uninstaller).with('rspec', :all => true).and_return(uninstaller)
186
186
  @gem_env.uninstall('rspec')
187
187
  end
188
188
 
189
189
  it "uninstalls a specific version of a gem" do
190
- uninstaller = mock('gem uninstaller')
190
+ uninstaller = double('gem uninstaller')
191
191
  uninstaller.should_receive(:uninstall)
192
192
  @gem_env.should_receive(:uninstaller).with('rspec', :version => '1.2.3').and_return(uninstaller)
193
193
  @gem_env.uninstall('rspec', '1.2.3')
@@ -230,7 +230,7 @@ describe Chef::Provider::Package::Rubygems::AlternateGemEnvironment do
230
230
  end
231
231
 
232
232
  it "builds the gems source index from the gem paths" do
233
- @gem_env.stub!(:gem_paths).and_return(['/path/to/gems', '/another/path/to/gems'])
233
+ @gem_env.stub(:gem_paths).and_return(['/path/to/gems', '/another/path/to/gems'])
234
234
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
235
235
  @gem_env.gem_specification
236
236
  Gem::Specification.dirs.should == [ '/path/to/gems/specifications', '/another/path/to/gems/specifications' ]
@@ -244,17 +244,17 @@ describe Chef::Provider::Package::Rubygems::AlternateGemEnvironment do
244
244
  gems = [gemspec('rspec', Gem::Version.new('1.2.9')), gemspec('rspec', Gem::Version.new('1.3.0'))]
245
245
  rspec_dep = Gem::Dependency.new('rspec', nil)
246
246
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
247
- @gem_env.stub!(:gem_specification).and_return(Gem::Specification)
247
+ @gem_env.stub(:gem_specification).and_return(Gem::Specification)
248
248
  @gem_env.gem_specification.should_receive(:find_all_by_name).with(rspec_dep.name, rspec_dep.requirement).and_return(gems)
249
249
  else
250
- @gem_env.stub!(:gem_source_index).and_return(Gem.source_index)
250
+ @gem_env.stub(:gem_source_index).and_return(Gem.source_index)
251
251
  @gem_env.gem_source_index.should_receive(:search).with(rspec_dep).and_return(gems)
252
252
  end
253
253
  @gem_env.installed_versions(Gem::Dependency.new('rspec', nil)).should == gems
254
254
  end
255
255
 
256
256
  it "determines the installed versions of gems from the source index (part2: the unmockening)" do
257
- $stdout.stub!(:write)
257
+ $stdout.stub(:write)
258
258
  path_to_gem = if windows?
259
259
  `where gem`.split[1]
260
260
  else
@@ -295,7 +295,7 @@ RubyGems Environment:
295
295
  - http://rubygems.org/
296
296
  - http://gems.github.com/
297
297
  JRUBY_GEM_ENV
298
- @gem_env.should_receive(:shell_out!).with('/usr/weird/bin/gem env').and_return(mock('jruby_gem_env', :stdout => gem_env_out))
298
+ @gem_env.should_receive(:shell_out!).with('/usr/weird/bin/gem env').and_return(double('jruby_gem_env', :stdout => gem_env_out))
299
299
  expected = ['ruby', Gem::Platform.new('universal-java-1.6')]
300
300
  @gem_env.gem_platforms.should == expected
301
301
  # it should also cache the result
@@ -337,7 +337,7 @@ RubyGems Environment:
337
337
  - http://rubygems.org/
338
338
  - http://gems.github.com/
339
339
  RBX_GEM_ENV
340
- @gem_env.should_receive(:shell_out!).with('/usr/weird/bin/gem env').and_return(mock('rbx_gem_env', :stdout => gem_env_out))
340
+ @gem_env.should_receive(:shell_out!).with('/usr/weird/bin/gem env').and_return(double('rbx_gem_env', :stdout => gem_env_out))
341
341
  @gem_env.gem_platforms.should == Gem.platforms
342
342
  Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache['/usr/weird/bin/gem'].should == Gem.platforms
343
343
  end
@@ -367,7 +367,7 @@ describe Chef::Provider::Package::Rubygems do
367
367
  @run_context = Chef::RunContext.new(@node, {}, @events)
368
368
 
369
369
  # We choose detect omnibus via RbConfig::CONFIG['bindir'] in Chef::Provider::Package::Rubygems.new
370
- RbConfig::CONFIG.stub!(:[]).with('bindir').and_return("/usr/bin/ruby")
370
+ RbConfig::CONFIG.stub(:[]).with('bindir').and_return("/usr/bin/ruby")
371
371
  @provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context)
372
372
  end
373
373
 
@@ -388,11 +388,11 @@ describe Chef::Provider::Package::Rubygems do
388
388
 
389
389
  it "searches for a gem binary when running on Omnibus on Unix" do
390
390
  platform_mock :unix do
391
- RbConfig::CONFIG.stub!(:[]).with('bindir').and_return("/opt/chef/embedded/bin")
392
- ENV.stub!(:[]).with('PATH').and_return("/usr/bin:/usr/sbin:/opt/chef/embedded/bin")
393
- File.stub!(:exists?).with('/usr/bin/gem').and_return(false)
394
- File.stub!(:exists?).with('/usr/sbin/gem').and_return(true)
395
- File.stub!(:exists?).with('/opt/chef/embedded/bin/gem').and_return(true) # should not get here
391
+ RbConfig::CONFIG.stub(:[]).with('bindir').and_return("/opt/chef/embedded/bin")
392
+ ENV.stub(:[]).with('PATH').and_return("/usr/bin:/usr/sbin:/opt/chef/embedded/bin")
393
+ File.stub(:exists?).with('/usr/bin/gem').and_return(false)
394
+ File.stub(:exists?).with('/usr/sbin/gem').and_return(true)
395
+ File.stub(:exists?).with('/opt/chef/embedded/bin/gem').and_return(true) # should not get here
396
396
  provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context)
397
397
  provider.gem_env.gem_binary_location.should == '/usr/sbin/gem'
398
398
  end
@@ -400,13 +400,13 @@ describe Chef::Provider::Package::Rubygems do
400
400
 
401
401
  it "searches for a gem binary when running on Omnibus on Windows" do
402
402
  platform_mock :windows do
403
- RbConfig::CONFIG.stub!(:[]).with('bindir').and_return("d:/opscode/chef/embedded/bin")
404
- ENV.stub!(:[]).with('PATH').and_return('C:\windows\system32;C:\windows;C:\Ruby186\bin;d:\opscode\chef\embedded\bin')
405
- File.stub!(:exists?).with('C:\\windows\\system32\\gem').and_return(false)
406
- File.stub!(:exists?).with('C:\\windows\\gem').and_return(false)
407
- File.stub!(:exists?).with('C:\\Ruby186\\bin\\gem').and_return(true)
408
- File.stub!(:exists?).with('d:\\opscode\\chef\\bin\\gem').and_return(false) # should not get here
409
- File.stub!(:exists?).with('d:\\opscode\\chef\\embedded\\bin\\gem').and_return(false) # should not get here
403
+ RbConfig::CONFIG.stub(:[]).with('bindir').and_return("d:/opscode/chef/embedded/bin")
404
+ ENV.stub(:[]).with('PATH').and_return('C:\windows\system32;C:\windows;C:\Ruby186\bin;d:\opscode\chef\embedded\bin')
405
+ File.stub(:exists?).with('C:\\windows\\system32\\gem').and_return(false)
406
+ File.stub(:exists?).with('C:\\windows\\gem').and_return(false)
407
+ File.stub(:exists?).with('C:\\Ruby186\\bin\\gem').and_return(true)
408
+ File.stub(:exists?).with('d:\\opscode\\chef\\bin\\gem').and_return(false) # should not get here
409
+ File.stub(:exists?).with('d:\\opscode\\chef\\embedded\\bin\\gem').and_return(false) # should not get here
410
410
  provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context)
411
411
  provider.gem_env.gem_binary_location.should == 'C:\Ruby186\bin\gem'
412
412
  end
@@ -475,7 +475,7 @@ describe Chef::Provider::Package::Rubygems do
475
475
  @current_resource = Chef::Resource::GemPackage.new('rspec-core')
476
476
  @provider.current_resource = @current_resource
477
477
  @gem_dep = Gem::Dependency.new('rspec-core', @spec_version)
478
- @provider.stub!(:load_current_resource)
478
+ @provider.stub(:load_current_resource)
479
479
  end
480
480
 
481
481
  describe "in the current gem environment" do
@@ -508,7 +508,7 @@ describe Chef::Provider::Package::Rubygems do
508
508
 
509
509
  # this catches 'gem_package "foo"' when "./foo" is a file in the cwd, and instead of installing './foo' it fetches the remote gem
510
510
  it "installs the gem via the gems api, when the package has no file separator characters in it, but a matching file exists in cwd" do
511
- ::File.stub!(:exists?).and_return(true)
511
+ ::File.stub(:exists?).and_return(true)
512
512
  @new_resource.package_name('rspec-core')
513
513
  @provider.gem_env.should_receive(:install).with(@gem_dep, :sources => nil)
514
514
  @provider.action_install.should be_true
@@ -29,9 +29,9 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
29
29
  @current_resource = Chef::Resource::Package.new("varnish")
30
30
 
31
31
 
32
- @status = mock("Status", :exitstatus => 0)
32
+ @status = double("Status", :exitstatus => 0)
33
33
  @provider = Chef::Provider::Package::SmartOS.new(@new_resource, @run_context)
34
- Chef::Resource::Package.stub!(:new).and_return(@current_resource)
34
+ Chef::Resource::Package.stub(:new).and_return(@current_resource)
35
35
  @stdin = StringIO.new
36
36
  @stdout = "varnish-2.1.5nb2\n"
37
37
  @stderr = StringIO.new
@@ -77,11 +77,11 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
77
77
  end
78
78
 
79
79
  it "should lookup the candidate_version if the variable is not already set" do
80
- search = mock()
80
+ search = double()
81
81
  search.should_receive(:each_line).
82
82
  and_yield("something-varnish-1.1.1 something varnish like\n").
83
83
  and_yield("varnish-2.3.4 actual varnish\n")
84
- @shell_out = mock('shell_out!', :stdout => search)
84
+ @shell_out = double('shell_out!', :stdout => search)
85
85
  @provider.should_receive(:shell_out!).with('/opt/local/bin/pkgin se varnish', :env => nil, :returns => [0,1]).and_return(@shell_out)
86
86
  @provider.candidate_version.should == "2.3.4"
87
87
  end
@@ -27,7 +27,7 @@ describe Chef::Provider::Package::Solaris do
27
27
  @new_resource.source("/tmp/bash.pkg")
28
28
 
29
29
  @provider = Chef::Provider::Package::Solaris.new(@new_resource, @run_context)
30
- ::File.stub!(:exists?).and_return(true)
30
+ ::File.stub(:exists?).and_return(true)
31
31
  end
32
32
 
33
33
  describe "assessing the current package status" do
@@ -46,24 +46,24 @@ INSTDATE: Nov 04 2009 01:02
46
46
  HOTLINE: Please contact your local service provider
47
47
  PKGINFO
48
48
 
49
- @status = mock("Status", :exitstatus => 0)
49
+ @status = double("Status", :exitstatus => 0)
50
50
  end
51
51
 
52
52
  it "should create a current resource with the name of new_resource" do
53
- @provider.stub!(:popen4).and_return(@status)
53
+ @provider.stub(:popen4).and_return(@status)
54
54
  @provider.load_current_resource
55
55
  @provider.current_resource.name.should == "SUNWbash"
56
56
  end
57
57
 
58
58
  it "should set the current reource package name to the new resource package name" do
59
- @provider.stub!(:popen4).and_return(@status)
59
+ @provider.stub(:popen4).and_return(@status)
60
60
  @provider.load_current_resource
61
61
  @provider.current_resource.package_name.should == "SUNWbash"
62
62
  end
63
63
 
64
64
  it "should raise an exception if a source is supplied but not found" do
65
- @provider.stub!(:popen4).and_return(@status)
66
- ::File.stub!(:exists?).and_return(false)
65
+ @provider.stub(:popen4).and_return(@status)
66
+ ::File.stub(:exists?).and_return(false)
67
67
  @provider.define_resource_requirements
68
68
  @provider.load_current_resource
69
69
  lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Package)
@@ -93,13 +93,13 @@ PKGINFO
93
93
  it "should raise an exception if the source is not set but we are installing" do
94
94
  @new_resource = Chef::Resource::Package.new("SUNWbash")
95
95
  @provider = Chef::Provider::Package::Solaris.new(@new_resource, @run_context)
96
- @provider.stub!(:popen4).and_return(@status)
96
+ @provider.stub(:popen4).and_return(@status)
97
97
  lambda { @provider.run_action(:install) }.should raise_error(Chef::Exceptions::Package)
98
98
  end
99
99
 
100
100
  it "should raise an exception if pkginfo fails to run" do
101
- @status = mock("Status", :exitstatus => -1)
102
- @provider.stub!(:popen4).and_return(@status)
101
+ @status = double("Status", :exitstatus => -1)
102
+ @provider.stub(:popen4).and_return(@status)
103
103
  lambda { @provider.load_current_resource }.should raise_error(Chef::Exceptions::Package)
104
104
  end
105
105
 
@@ -120,15 +120,15 @@ PKGINFO
120
120
  end
121
121
 
122
122
  it "should lookup the candidate_version if the variable is not already set" do
123
- @status = mock("Status", :exitstatus => 0)
124
- @provider.stub!(:popen4).and_return(@status)
123
+ @status = double("Status", :exitstatus => 0)
124
+ @provider.stub(:popen4).and_return(@status)
125
125
  @provider.should_receive(:popen4)
126
126
  @provider.candidate_version
127
127
  end
128
128
 
129
129
  it "should throw and exception if the exitstatus is not 0" do
130
- @status = mock("Status", :exitstatus => 1)
131
- @provider.stub!(:popen4).and_return(@status)
130
+ @status = double("Status", :exitstatus => 1)
131
+ @provider.stub(:popen4).and_return(@status)
132
132
  lambda { @provider.candidate_version }.should raise_error(Chef::Exceptions::Package)
133
133
  end
134
134
 
@@ -153,7 +153,7 @@ PKGINFO
153
153
  end
154
154
 
155
155
  it "should run pkgadd -n -a /tmp/myadmin -d with the package options -a /tmp/myadmin" do
156
- @new_resource.stub!(:options).and_return("-a /tmp/myadmin")
156
+ @new_resource.stub(:options).and_return("-a /tmp/myadmin")
157
157
  @provider.should_receive(:run_command_with_systems_locale).with({
158
158
  :command => "pkgadd -n -a /tmp/myadmin -d /tmp/bash.pkg all"
159
159
  })
@@ -170,7 +170,7 @@ PKGINFO
170
170
  end
171
171
 
172
172
  it "should run pkgrm -n -a /tmp/myadmin with options -a /tmp/myadmin" do
173
- @new_resource.stub!(:options).and_return("-a /tmp/myadmin")
173
+ @new_resource.stub(:options).and_return("-a /tmp/myadmin")
174
174
  @provider.should_receive(:run_command_with_systems_locale).with({
175
175
  :command => "pkgrm -n -a /tmp/myadmin SUNWbash"
176
176
  })
@@ -24,8 +24,8 @@ describe Chef::Provider::Package::Yum do
24
24
  @events = Chef::EventDispatch::Dispatcher.new
25
25
  @run_context = Chef::RunContext.new(@node, {}, @events)
26
26
  @new_resource = Chef::Resource::Package.new('cups')
27
- @status = mock("Status", :exitstatus => 0)
28
- @yum_cache = mock(
27
+ @status = double("Status", :exitstatus => 0)
28
+ @yum_cache = double(
29
29
  'Chef::Provider::Yum::YumCache',
30
30
  :reload_installed => true,
31
31
  :reset => true,
@@ -37,9 +37,9 @@ describe Chef::Provider::Package::Yum do
37
37
  :package_repository => "base",
38
38
  :disable_extra_repo_control => true
39
39
  )
40
- Chef::Provider::Package::Yum::YumCache.stub!(:instance).and_return(@yum_cache)
40
+ Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
41
41
  @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
42
- @pid = mock("PID")
42
+ @pid = double("PID")
43
43
  end
44
44
 
45
45
  describe "when loading the current system state" do
@@ -54,7 +54,7 @@ describe Chef::Provider::Package::Yum do
54
54
  end
55
55
 
56
56
  it "should set the installed version to nil on the current resource if no installed package" do
57
- @yum_cache.stub!(:installed_version).and_return(nil)
57
+ @yum_cache.stub(:installed_version).and_return(nil)
58
58
  @provider.load_current_resource
59
59
  @provider.current_resource.version.should be_nil
60
60
  end
@@ -76,14 +76,14 @@ describe Chef::Provider::Package::Yum do
76
76
  describe "when arch in package_name" do
77
77
  it "should set the arch if no existing package_name is found and new_package_name+new_arch is available" do
78
78
  @new_resource = Chef::Resource::YumPackage.new('testing.noarch')
79
- @yum_cache = mock(
79
+ @yum_cache = double(
80
80
  'Chef::Provider::Yum::YumCache'
81
81
  )
82
- @yum_cache.stub!(:installed_version) do |package_name, arch|
82
+ @yum_cache.stub(:installed_version) do |package_name, arch|
83
83
  # nothing installed for package_name/new_package_name
84
84
  nil
85
85
  end
86
- @yum_cache.stub!(:candidate_version) do |package_name, arch|
86
+ @yum_cache.stub(:candidate_version) do |package_name, arch|
87
87
  if package_name == "testing.noarch" || package_name == "testing.more.noarch"
88
88
  nil
89
89
  # candidate for new_package_name
@@ -91,9 +91,9 @@ describe Chef::Provider::Package::Yum do
91
91
  "1.1"
92
92
  end
93
93
  end
94
- @yum_cache.stub!(:package_available?).and_return(true)
95
- @yum_cache.stub!(:disable_extra_repo_control).and_return(true)
96
- Chef::Provider::Package::Yum::YumCache.stub!(:instance).and_return(@yum_cache)
94
+ @yum_cache.stub(:package_available?).and_return(true)
95
+ @yum_cache.stub(:disable_extra_repo_control).and_return(true)
96
+ Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
97
97
  @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
98
98
  @provider.load_current_resource
99
99
  @provider.new_resource.package_name.should == "testing"
@@ -110,10 +110,10 @@ describe Chef::Provider::Package::Yum do
110
110
 
111
111
  it "should not set the arch when an existing package_name is found" do
112
112
  @new_resource = Chef::Resource::YumPackage.new('testing.beta3')
113
- @yum_cache = mock(
113
+ @yum_cache = double(
114
114
  'Chef::Provider::Yum::YumCache'
115
115
  )
116
- @yum_cache.stub!(:installed_version) do |package_name, arch|
116
+ @yum_cache.stub(:installed_version) do |package_name, arch|
117
117
  # installed for package_name
118
118
  if package_name == "testing.beta3" || package_name == "testing.beta3.more"
119
119
  "1.1"
@@ -121,13 +121,13 @@ describe Chef::Provider::Package::Yum do
121
121
  nil
122
122
  end
123
123
  end
124
- @yum_cache.stub!(:candidate_version) do |package_name, arch|
124
+ @yum_cache.stub(:candidate_version) do |package_name, arch|
125
125
  # no candidate for package_name/new_package_name
126
126
  nil
127
127
  end
128
- @yum_cache.stub!(:package_available?).and_return(true)
129
- @yum_cache.stub!(:disable_extra_repo_control).and_return(true)
130
- Chef::Provider::Package::Yum::YumCache.stub!(:instance).and_return(@yum_cache)
128
+ @yum_cache.stub(:package_available?).and_return(true)
129
+ @yum_cache.stub(:disable_extra_repo_control).and_return(true)
130
+ Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
131
131
  @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
132
132
  # annoying side effect of the fun stub'ing above
133
133
  @provider.load_current_resource
@@ -145,20 +145,20 @@ describe Chef::Provider::Package::Yum do
145
145
 
146
146
  it "should not set the arch when no existing package_name or new_package_name+new_arch is found" do
147
147
  @new_resource = Chef::Resource::YumPackage.new('testing.beta3')
148
- @yum_cache = mock(
148
+ @yum_cache = double(
149
149
  'Chef::Provider::Yum::YumCache'
150
150
  )
151
- @yum_cache.stub!(:installed_version) do |package_name, arch|
151
+ @yum_cache.stub(:installed_version) do |package_name, arch|
152
152
  # nothing installed for package_name/new_package_name
153
153
  nil
154
154
  end
155
- @yum_cache.stub!(:candidate_version) do |package_name, arch|
155
+ @yum_cache.stub(:candidate_version) do |package_name, arch|
156
156
  # no candidate for package_name/new_package_name
157
157
  nil
158
158
  end
159
- @yum_cache.stub!(:package_available?).and_return(true)
160
- @yum_cache.stub!(:disable_extra_repo_control).and_return(true)
161
- Chef::Provider::Package::Yum::YumCache.stub!(:instance).and_return(@yum_cache)
159
+ @yum_cache.stub(:package_available?).and_return(true)
160
+ @yum_cache.stub(:disable_extra_repo_control).and_return(true)
161
+ Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
162
162
  @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
163
163
  @provider.load_current_resource
164
164
  @provider.new_resource.package_name.should == "testing.beta3"
@@ -176,14 +176,14 @@ describe Chef::Provider::Package::Yum do
176
176
  it "should ensure it doesn't clobber an existing arch if passed" do
177
177
  @new_resource = Chef::Resource::YumPackage.new('testing.i386')
178
178
  @new_resource.arch("x86_64")
179
- @yum_cache = mock(
179
+ @yum_cache = double(
180
180
  'Chef::Provider::Yum::YumCache'
181
181
  )
182
- @yum_cache.stub!(:installed_version) do |package_name, arch|
182
+ @yum_cache.stub(:installed_version) do |package_name, arch|
183
183
  # nothing installed for package_name/new_package_name
184
184
  nil
185
185
  end
186
- @yum_cache.stub!(:candidate_version) do |package_name, arch|
186
+ @yum_cache.stub(:candidate_version) do |package_name, arch|
187
187
  if package_name == "testing.noarch"
188
188
  nil
189
189
  # candidate for new_package_name
@@ -191,9 +191,9 @@ describe Chef::Provider::Package::Yum do
191
191
  "1.1"
192
192
  end
193
193
  end.and_return("something")
194
- @yum_cache.stub!(:package_available?).and_return(true)
195
- @yum_cache.stub!(:disable_extra_repo_control).and_return(true)
196
- Chef::Provider::Package::Yum::YumCache.stub!(:instance).and_return(@yum_cache)
194
+ @yum_cache.stub(:package_available?).and_return(true)
195
+ @yum_cache.stub(:disable_extra_repo_control).and_return(true)
196
+ Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
197
197
  @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
198
198
  @provider.load_current_resource
199
199
  @provider.new_resource.package_name.should == "testing.i386"
@@ -202,37 +202,37 @@ describe Chef::Provider::Package::Yum do
202
202
  end
203
203
 
204
204
  it "should flush the cache if :before is true" do
205
- @new_resource.stub!(:flush_cache).and_return({:after => false, :before => true})
205
+ @new_resource.stub(:flush_cache).and_return({:after => false, :before => true})
206
206
  @yum_cache.should_receive(:reload).once
207
207
  @provider.load_current_resource
208
208
  end
209
209
 
210
210
  it "should flush the cache if :before is false" do
211
- @new_resource.stub!(:flush_cache).and_return({:after => false, :before => false})
211
+ @new_resource.stub(:flush_cache).and_return({:after => false, :before => false})
212
212
  @yum_cache.should_not_receive(:reload)
213
213
  @provider.load_current_resource
214
214
  end
215
215
 
216
216
  it "should detect --enablerepo or --disablerepo when passed among options, collect them preserving order and notify the yum cache" do
217
- @new_resource.stub!(:options).and_return("--stuff --enablerepo=foo --otherthings --disablerepo=a,b,c --enablerepo=bar")
217
+ @new_resource.stub(:options).and_return("--stuff --enablerepo=foo --otherthings --disablerepo=a,b,c --enablerepo=bar")
218
218
  @yum_cache.should_receive(:enable_extra_repo_control).with("--enablerepo=foo --disablerepo=a,b,c --enablerepo=bar")
219
219
  @provider.load_current_resource
220
220
  end
221
221
 
222
222
  it "should let the yum cache know extra repos are disabled if --enablerepo or --disablerepo aren't among options" do
223
- @new_resource.stub!(:options).and_return("--stuff --otherthings")
223
+ @new_resource.stub(:options).and_return("--stuff --otherthings")
224
224
  @yum_cache.should_receive(:disable_extra_repo_control)
225
225
  @provider.load_current_resource
226
226
  end
227
227
 
228
228
  it "should let the yum cache know extra repos are disabled if options aren't set" do
229
- @new_resource.stub!(:options).and_return(nil)
229
+ @new_resource.stub(:options).and_return(nil)
230
230
  @yum_cache.should_receive(:disable_extra_repo_control)
231
231
  @provider.load_current_resource
232
232
  end
233
233
 
234
234
  it "should search provides if package name can't be found then set package_name to match" do
235
- @yum_cache = mock(
235
+ @yum_cache = double(
236
236
  'Chef::Provider::Yum::YumCache',
237
237
  :reload_installed => true,
238
238
  :reset => true,
@@ -242,7 +242,7 @@ describe Chef::Provider::Package::Yum do
242
242
  :version_available? => true,
243
243
  :disable_extra_repo_control => true
244
244
  )
245
- Chef::Provider::Package::Yum::YumCache.stub!(:instance).and_return(@yum_cache)
245
+ Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
246
246
  pkg = Chef::Provider::Package::Yum::RPMPackage.new("test-package", "1.2.4-11.18.el5", "x86_64", [])
247
247
  @yum_cache.should_receive(:packages_from_require).and_return([pkg])
248
248
  @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@@ -251,7 +251,7 @@ describe Chef::Provider::Package::Yum do
251
251
  end
252
252
 
253
253
  it "should search provides if package name can't be found, warn about multiple matches, but use the first one" do
254
- @yum_cache = mock(
254
+ @yum_cache = double(
255
255
  'Chef::Provider::Yum::YumCache',
256
256
  :reload_installed => true,
257
257
  :reset => true,
@@ -261,7 +261,7 @@ describe Chef::Provider::Package::Yum do
261
261
  :version_available? => true,
262
262
  :disable_extra_repo_control => true
263
263
  )
264
- Chef::Provider::Package::Yum::YumCache.stub!(:instance).and_return(@yum_cache)
264
+ Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
265
265
  pkg_x = Chef::Provider::Package::Yum::RPMPackage.new("test-package-x", "1.2.4-11.18.el5", "x86_64", [])
266
266
  pkg_y = Chef::Provider::Package::Yum::RPMPackage.new("test-package-y", "1.2.6-11.3.el5", "i386", [])
267
267
  @yum_cache.should_receive(:packages_from_require).and_return([pkg_x, pkg_y])
@@ -272,7 +272,7 @@ describe Chef::Provider::Package::Yum do
272
272
  end
273
273
 
274
274
  it "should search provides if no package is available - if no match in installed provides then load the complete set" do
275
- @yum_cache = mock(
275
+ @yum_cache = double(
276
276
  'Chef::Provider::Yum::YumCache',
277
277
  :reload_installed => true,
278
278
  :reset => true,
@@ -282,7 +282,7 @@ describe Chef::Provider::Package::Yum do
282
282
  :version_available? => true,
283
283
  :disable_extra_repo_control => true
284
284
  )
285
- Chef::Provider::Package::Yum::YumCache.stub!(:instance).and_return(@yum_cache)
285
+ Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
286
286
  @yum_cache.should_receive(:packages_from_require).twice.and_return([])
287
287
  @yum_cache.should_receive(:reload_provides)
288
288
  @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@@ -290,7 +290,7 @@ describe Chef::Provider::Package::Yum do
290
290
  end
291
291
 
292
292
  it "should search provides if no package is available and not load the complete set if action is :remove or :purge" do
293
- @yum_cache = mock(
293
+ @yum_cache = double(
294
294
  'Chef::Provider::Yum::YumCache',
295
295
  :reload_installed => true,
296
296
  :reset => true,
@@ -300,7 +300,7 @@ describe Chef::Provider::Package::Yum do
300
300
  :version_available? => true,
301
301
  :disable_extra_repo_control => true
302
302
  )
303
- Chef::Provider::Package::Yum::YumCache.stub!(:instance).and_return(@yum_cache)
303
+ Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
304
304
  @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
305
305
  @yum_cache.should_receive(:packages_from_require).once.and_return([])
306
306
  @yum_cache.should_not_receive(:reload_provides)
@@ -313,7 +313,7 @@ describe Chef::Provider::Package::Yum do
313
313
  end
314
314
 
315
315
  it "should search provides if no package is available - if no match in provides leave the name intact" do
316
- @yum_cache = mock(
316
+ @yum_cache = double(
317
317
  'Chef::Provider::Yum::YumCache',
318
318
  :reload_provides => true,
319
319
  :reload_installed => true,
@@ -324,7 +324,7 @@ describe Chef::Provider::Package::Yum do
324
324
  :version_available? => true,
325
325
  :disable_extra_repo_control => true
326
326
  )
327
- Chef::Provider::Package::Yum::YumCache.stub!(:instance).and_return(@yum_cache)
327
+ Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
328
328
  @yum_cache.should_receive(:packages_from_require).twice.and_return([])
329
329
  @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
330
330
  @provider.load_current_resource
@@ -335,7 +335,7 @@ describe Chef::Provider::Package::Yum do
335
335
  describe "when installing a package" do
336
336
  it "should run yum install with the package name and version" do
337
337
  @provider.load_current_resource
338
- Chef::Provider::Package::Yum::RPMUtils.stub!(:rpmvercmp).and_return(-1)
338
+ Chef::Provider::Package::Yum::RPMUtils.stub(:rpmvercmp).and_return(-1)
339
339
  @provider.should_receive(:yum_command).with(
340
340
  "yum -d0 -e0 -y install emacs-1.0"
341
341
  )
@@ -343,7 +343,7 @@ describe Chef::Provider::Package::Yum do
343
343
  end
344
344
 
345
345
  it "should run yum localinstall if given a path to an rpm" do
346
- @new_resource.stub!(:source).and_return("/tmp/emacs-21.4-20.el5.i386.rpm")
346
+ @new_resource.stub(:source).and_return("/tmp/emacs-21.4-20.el5.i386.rpm")
347
347
  @provider.should_receive(:yum_command).with(
348
348
  "yum -d0 -e0 -y localinstall /tmp/emacs-21.4-20.el5.i386.rpm"
349
349
  )
@@ -352,7 +352,7 @@ describe Chef::Provider::Package::Yum do
352
352
 
353
353
  it "should run yum localinstall if given a path to an rpm as the package" do
354
354
  @new_resource = Chef::Resource::Package.new("/tmp/emacs-21.4-20.el5.i386.rpm")
355
- ::File.stub!(:exists?).and_return(true)
355
+ ::File.stub(:exists?).and_return(true)
356
356
  @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
357
357
  @new_resource.source.should == "/tmp/emacs-21.4-20.el5.i386.rpm"
358
358
  @provider.should_receive(:yum_command).with(
@@ -363,8 +363,8 @@ describe Chef::Provider::Package::Yum do
363
363
 
364
364
  it "should run yum install with the package name, version and arch" do
365
365
  @provider.load_current_resource
366
- @new_resource.stub!(:arch).and_return("i386")
367
- Chef::Provider::Package::Yum::RPMUtils.stub!(:rpmvercmp).and_return(-1)
366
+ @new_resource.stub(:arch).and_return("i386")
367
+ Chef::Provider::Package::Yum::RPMUtils.stub(:rpmvercmp).and_return(-1)
368
368
  @provider.should_receive(:yum_command).with(
369
369
  "yum -d0 -e0 -y install emacs-21.4-20.el5.i386"
370
370
  )
@@ -374,8 +374,8 @@ describe Chef::Provider::Package::Yum do
374
374
  it "installs the package with the options given in the resource" do
375
375
  @provider.load_current_resource
376
376
  @provider.candidate_version = '11'
377
- @new_resource.stub!(:options).and_return("--disablerepo epmd")
378
- Chef::Provider::Package::Yum::RPMUtils.stub!(:rpmvercmp).and_return(-1)
377
+ @new_resource.stub(:options).and_return("--disablerepo epmd")
378
+ Chef::Provider::Package::Yum::RPMUtils.stub(:rpmvercmp).and_return(-1)
379
379
  @provider.should_receive(:yum_command).with(
380
380
  "yum -d0 -e0 -y --disablerepo epmd install cups-11"
381
381
  )
@@ -383,7 +383,7 @@ describe Chef::Provider::Package::Yum do
383
383
  end
384
384
 
385
385
  it "should raise an exception if the package is not available" do
386
- @yum_cache = mock(
386
+ @yum_cache = double(
387
387
  'Chef::Provider::Yum::YumCache',
388
388
  :reload_from_cache => true,
389
389
  :reset => true,
@@ -393,14 +393,14 @@ describe Chef::Provider::Package::Yum do
393
393
  :version_available? => nil,
394
394
  :disable_extra_repo_control => true
395
395
  )
396
- Chef::Provider::Package::Yum::YumCache.stub!(:instance).and_return(@yum_cache)
396
+ Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
397
397
  @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
398
398
  lambda { @provider.install_package("lolcats", "0.99") }.should raise_error(Chef::Exceptions::Package, %r{Version .* not found})
399
399
  end
400
400
 
401
401
  it "should raise an exception if candidate version is older than the installed version and allow_downgrade is false" do
402
- @new_resource.stub!(:allow_downgrade).and_return(false)
403
- @yum_cache = mock(
402
+ @new_resource.stub(:allow_downgrade).and_return(false)
403
+ @yum_cache = double(
404
404
  'Chef::Provider::Yum::YumCache',
405
405
  :reload_installed => true,
406
406
  :reset => true,
@@ -411,14 +411,14 @@ describe Chef::Provider::Package::Yum do
411
411
  :allow_multi_install => [ "kernel" ],
412
412
  :disable_extra_repo_control => true
413
413
  )
414
- Chef::Provider::Package::Yum::YumCache.stub!(:instance).and_return(@yum_cache)
414
+ Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
415
415
  @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
416
416
  @provider.load_current_resource
417
417
  lambda { @provider.install_package("cups", "1.2.4-11.15.el5") }.should raise_error(Chef::Exceptions::Package, %r{is newer than candidate package})
418
418
  end
419
419
 
420
420
  it "should not raise an exception if candidate version is older than the installed version and the package is list in yum's installonlypkg option" do
421
- @yum_cache = mock(
421
+ @yum_cache = double(
422
422
  'Chef::Provider::Yum::YumCache',
423
423
  :reload_installed => true,
424
424
  :reset => true,
@@ -430,7 +430,7 @@ describe Chef::Provider::Package::Yum do
430
430
  :package_repository => "base",
431
431
  :disable_extra_repo_control => true
432
432
  )
433
- Chef::Provider::Package::Yum::YumCache.stub!(:instance).and_return(@yum_cache)
433
+ Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
434
434
  @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
435
435
  @provider.load_current_resource
436
436
  @provider.should_receive(:yum_command).with(
@@ -440,8 +440,8 @@ describe Chef::Provider::Package::Yum do
440
440
  end
441
441
 
442
442
  it "should run yum downgrade if candidate version is older than the installed version and allow_downgrade is true" do
443
- @new_resource.stub!(:allow_downgrade).and_return(true)
444
- @yum_cache = mock(
443
+ @new_resource.stub(:allow_downgrade).and_return(true)
444
+ @yum_cache = double(
445
445
  'Chef::Provider::Yum::YumCache',
446
446
  :reload_installed => true,
447
447
  :reset => true,
@@ -453,7 +453,7 @@ describe Chef::Provider::Package::Yum do
453
453
  :package_repository => "base",
454
454
  :disable_extra_repo_control => true
455
455
  )
456
- Chef::Provider::Package::Yum::YumCache.stub!(:instance).and_return(@yum_cache)
456
+ Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
457
457
  @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
458
458
  @provider.load_current_resource
459
459
  @provider.should_receive(:yum_command).with(
@@ -463,9 +463,9 @@ describe Chef::Provider::Package::Yum do
463
463
  end
464
464
 
465
465
  it "should run yum install then flush the cache if :after is true" do
466
- @new_resource.stub!(:flush_cache).and_return({:after => true, :before => false})
466
+ @new_resource.stub(:flush_cache).and_return({:after => true, :before => false})
467
467
  @provider.load_current_resource
468
- Chef::Provider::Package::Yum::RPMUtils.stub!(:rpmvercmp).and_return(-1)
468
+ Chef::Provider::Package::Yum::RPMUtils.stub(:rpmvercmp).and_return(-1)
469
469
  @provider.should_receive(:yum_command).with(
470
470
  "yum -d0 -e0 -y install emacs-1.0"
471
471
  )
@@ -474,9 +474,9 @@ describe Chef::Provider::Package::Yum do
474
474
  end
475
475
 
476
476
  it "should run yum install then not flush the cache if :after is false" do
477
- @new_resource.stub!(:flush_cache).and_return({:after => false, :before => false})
477
+ @new_resource.stub(:flush_cache).and_return({:after => false, :before => false})
478
478
  @provider.load_current_resource
479
- Chef::Provider::Package::Yum::RPMUtils.stub!(:rpmvercmp).and_return(-1)
479
+ Chef::Provider::Package::Yum::RPMUtils.stub(:rpmvercmp).and_return(-1)
480
480
  @provider.should_receive(:yum_command).with(
481
481
  "yum -d0 -e0 -y install emacs-1.0"
482
482
  )
@@ -489,7 +489,7 @@ describe Chef::Provider::Package::Yum do
489
489
  it "should run yum install if the package is installed and a version is given" do
490
490
  @provider.load_current_resource
491
491
  @provider.candidate_version = '11'
492
- Chef::Provider::Package::Yum::RPMUtils.stub!(:rpmvercmp).and_return(-1)
492
+ Chef::Provider::Package::Yum::RPMUtils.stub(:rpmvercmp).and_return(-1)
493
493
  @provider.should_receive(:yum_command).with(
494
494
  "yum -d0 -e0 -y install cups-11"
495
495
  )
@@ -500,7 +500,7 @@ describe Chef::Provider::Package::Yum do
500
500
  @provider.load_current_resource
501
501
  @current_resource = Chef::Resource::Package.new('cups')
502
502
  @provider.candidate_version = '11'
503
- Chef::Provider::Package::Yum::RPMUtils.stub!(:rpmvercmp).and_return(-1)
503
+ Chef::Provider::Package::Yum::RPMUtils.stub(:rpmvercmp).and_return(-1)
504
504
  @provider.should_receive(:yum_command).with(
505
505
  "yum -d0 -e0 -y install cups-11"
506
506
  )
@@ -508,7 +508,7 @@ describe Chef::Provider::Package::Yum do
508
508
  end
509
509
 
510
510
  it "should raise an exception if candidate version is older than the installed version" do
511
- @yum_cache = mock(
511
+ @yum_cache = double(
512
512
  'Chef::Provider::Yum::YumCache',
513
513
  :reload_installed => true,
514
514
  :reset => true,
@@ -519,7 +519,7 @@ describe Chef::Provider::Package::Yum do
519
519
  :allow_multi_install => [ "kernel" ],
520
520
  :disable_extra_repo_control => true
521
521
  )
522
- Chef::Provider::Package::Yum::YumCache.stub!(:instance).and_return(@yum_cache)
522
+ Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
523
523
  @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
524
524
  @provider.load_current_resource
525
525
  lambda { @provider.upgrade_package("cups", "1.2.4-11.15.el5") }.should raise_error(Chef::Exceptions::Package, %r{is newer than candidate package})
@@ -527,7 +527,7 @@ describe Chef::Provider::Package::Yum do
527
527
 
528
528
  # Test our little workaround, some crossover into Chef::Provider::Package territory
529
529
  it "should call action_upgrade in the parent if the current resource version is nil" do
530
- @yum_cache.stub!(:installed_version).and_return(nil)
530
+ @yum_cache.stub(:installed_version).and_return(nil)
531
531
  @provider.load_current_resource
532
532
  @current_resource = Chef::Resource::Package.new('cups')
533
533
  @provider.candidate_version = '11'
@@ -558,7 +558,7 @@ describe Chef::Provider::Package::Yum do
558
558
  end
559
559
 
560
560
  it "should not call action_upgrade in the parent if the candidate is older" do
561
- @yum_cache.stub!(:installed_version).and_return("12")
561
+ @yum_cache.stub(:installed_version).and_return("12")
562
562
  @provider.load_current_resource
563
563
  @current_resource = Chef::Resource::Package.new('cups')
564
564
  @provider.candidate_version = '11'
@@ -576,7 +576,7 @@ describe Chef::Provider::Package::Yum do
576
576
  end
577
577
 
578
578
  it "should run yum remove with the package name and arch" do
579
- @new_resource.stub!(:arch).and_return("x86_64")
579
+ @new_resource.stub(:arch).and_return("x86_64")
580
580
  @provider.should_receive(:yum_command).with(
581
581
  "yum -d0 -e0 -y remove emacs-1.0.x86_64"
582
582
  )
@@ -595,8 +595,8 @@ describe Chef::Provider::Package::Yum do
595
595
 
596
596
  describe "when running yum" do
597
597
  it "should run yum once if it exits with a return code of 0" do
598
- @status = mock("Status", :exitstatus => 0)
599
- @provider.stub!(:output_of_command).and_return([@status, "", ""])
598
+ @status = double("Status", :exitstatus => 0)
599
+ @provider.stub(:output_of_command).and_return([@status, "", ""])
600
600
  @provider.should_receive(:output_of_command).once.with(
601
601
  "yum -d0 -e0 -y install emacs-1.0",
602
602
  {:timeout => Chef::Config[:yum_timeout]}
@@ -605,8 +605,8 @@ describe Chef::Provider::Package::Yum do
605
605
  end
606
606
 
607
607
  it "should run yum once if it exits with a return code > 0 and no scriptlet failures" do
608
- @status = mock("Status", :exitstatus => 2)
609
- @provider.stub!(:output_of_command).and_return([@status, "failure failure", "problem problem"])
608
+ @status = double("Status", :exitstatus => 2)
609
+ @provider.stub(:output_of_command).and_return([@status, "failure failure", "problem problem"])
610
610
  @provider.should_receive(:output_of_command).once.with(
611
611
  "yum -d0 -e0 -y install emacs-1.0",
612
612
  {:timeout => Chef::Config[:yum_timeout]}
@@ -615,8 +615,8 @@ describe Chef::Provider::Package::Yum do
615
615
  end
616
616
 
617
617
  it "should run yum once if it exits with a return code of 1 and %pre scriptlet failures" do
618
- @status = mock("Status", :exitstatus => 1)
619
- @provider.stub!(:output_of_command).and_return([@status, "error: %pre(demo-1-1.el5.centos.x86_64) scriptlet failed, exit status 2", ""])
618
+ @status = double("Status", :exitstatus => 1)
619
+ @provider.stub(:output_of_command).and_return([@status, "error: %pre(demo-1-1.el5.centos.x86_64) scriptlet failed, exit status 2", ""])
620
620
  @provider.should_receive(:output_of_command).once.with(
621
621
  "yum -d0 -e0 -y install emacs-1.0",
622
622
  {:timeout => Chef::Config[:yum_timeout]}
@@ -626,8 +626,8 @@ describe Chef::Provider::Package::Yum do
626
626
  end
627
627
 
628
628
  it "should run yum twice if it exits with a return code of 1 and %post scriptlet failures" do
629
- @status = mock("Status", :exitstatus => 1)
630
- @provider.stub!(:output_of_command).and_return([@status, "error: %post(demo-1-1.el5.centos.x86_64) scriptlet failed, exit status 2", ""])
629
+ @status = double("Status", :exitstatus => 1)
630
+ @provider.stub(:output_of_command).and_return([@status, "error: %post(demo-1-1.el5.centos.x86_64) scriptlet failed, exit status 2", ""])
631
631
  @provider.should_receive(:output_of_command).twice.with(
632
632
  "yum -d0 -e0 -y install emacs-1.0",
633
633
  {:timeout => Chef::Config[:yum_timeout]}
@@ -1543,8 +1543,8 @@ describe Chef::Provider::Package::Yum::YumCache do
1543
1543
  end
1544
1544
 
1545
1545
  before(:each) do
1546
- @stdin = mock("STDIN", :nil_object => true)
1547
- @stdout = mock("STDOUT", :nil_object => true)
1546
+ @stdin = double("STDIN", :nil_object => true)
1547
+ @stdout = double("STDOUT", :nil_object => true)
1548
1548
 
1549
1549
  @stdout_good = <<EOF
1550
1550
  [option installonlypkgs] kernel kernel-bigmem kernel-enterprise
@@ -1586,13 +1586,13 @@ yum-dump Config Error: File contains no section headers.
1586
1586
  file: file://///etc/yum.repos.d/CentOS-Base.repo, line: 12
1587
1587
  'qeqwewe\n'
1588
1588
  EOF
1589
- @status = mock("Status", :exitstatus => 0, :stdin => @stdin, :stdout => @stdout_good, :stderr => @stderr)
1589
+ @status = double("Status", :exitstatus => 0, :stdin => @stdin, :stdout => @stdout_good, :stderr => @stderr)
1590
1590
 
1591
1591
  # new singleton each time
1592
1592
  Chef::Provider::Package::Yum::YumCache.reset_instance
1593
1593
  @yc = Chef::Provider::Package::Yum::YumCache.instance
1594
1594
  # load valid data
1595
- @yc.stub!(:shell_out!).and_return(@status)
1595
+ @yc.stub(:shell_out!).and_return(@status)
1596
1596
  end
1597
1597
 
1598
1598
  describe "initialize" do
@@ -1642,29 +1642,29 @@ EOF
1642
1642
  end
1643
1643
 
1644
1644
  it "should warn about invalid data with too many separators" do
1645
- @status = mock("Status", :exitstatus => 0, :stdin => @stdin, :stdout => @stdout_bad_separators, :stderr => @stderr)
1646
- @yc.stub!(:shell_out!).and_return(@status)
1645
+ @status = double("Status", :exitstatus => 0, :stdin => @stdin, :stdout => @stdout_bad_separators, :stderr => @stderr)
1646
+ @yc.stub(:shell_out!).and_return(@status)
1647
1647
  Chef::Log.should_receive(:warn).exactly(3).times.with(%r{Problem parsing})
1648
1648
  @yc.refresh
1649
1649
  end
1650
1650
 
1651
1651
  it "should warn about invalid data with an incorrect type" do
1652
- @status = mock("Status", :exitstatus => 0, :stdin => @stdin, :stdout => @stdout_bad_type, :stderr => @stderr)
1653
- @yc.stub!(:shell_out!).and_return(@status)
1652
+ @status = double("Status", :exitstatus => 0, :stdin => @stdin, :stdout => @stdout_bad_type, :stderr => @stderr)
1653
+ @yc.stub(:shell_out!).and_return(@status)
1654
1654
  Chef::Log.should_receive(:warn).exactly(2).times.with(%r{Problem parsing})
1655
1655
  @yc.refresh
1656
1656
  end
1657
1657
 
1658
1658
  it "should warn about no output from yum-dump.py" do
1659
- @status = mock("Status", :exitstatus => 0, :stdin => @stdin, :stdout => @stdout_no_output, :stderr => @stderr)
1660
- @yc.stub!(:shell_out!).and_return(@status)
1659
+ @status = double("Status", :exitstatus => 0, :stdin => @stdin, :stdout => @stdout_no_output, :stderr => @stderr)
1660
+ @yc.stub(:shell_out!).and_return(@status)
1661
1661
  Chef::Log.should_receive(:warn).exactly(1).times.with(%r{no output from yum-dump.py})
1662
1662
  @yc.refresh
1663
1663
  end
1664
1664
 
1665
1665
  it "should raise exception yum-dump.py exits with a non zero status" do
1666
- @status = mock("Status", :exitstatus => 1, :stdin => @stdin, :stdout => @stdout_no_output, :stderr => @stderr)
1667
- @yc.stub!(:shell_out!).and_return(@status)
1666
+ @status = double("Status", :exitstatus => 1, :stdin => @stdin, :stdout => @stdout_no_output, :stderr => @stderr)
1667
+ @yc.stub(:shell_out!).and_return(@status)
1668
1668
  lambda { @yc.refresh}.should raise_error(Chef::Exceptions::Package, %r{CentOS-Base.repo, line: 12})
1669
1669
  end
1670
1670
 
@@ -1690,8 +1690,8 @@ EOF
1690
1690
 
1691
1691
  describe "installed_version" do
1692
1692
  it "should take one or two arguments" do
1693
- lambda { @yc.installed_version("zip") }.should_not raise_error(ArgumentError)
1694
- lambda { @yc.installed_version("zip", "i386") }.should_not raise_error(ArgumentError)
1693
+ lambda { @yc.installed_version("zip") }.should_not raise_error
1694
+ lambda { @yc.installed_version("zip", "i386") }.should_not raise_error
1695
1695
  lambda { @yc.installed_version("zip", "i386", "extra") }.should raise_error(ArgumentError)
1696
1696
  end
1697
1697
 
@@ -1714,8 +1714,8 @@ EOF
1714
1714
 
1715
1715
  describe "available_version" do
1716
1716
  it "should take one or two arguments" do
1717
- lambda { @yc.available_version("zisofs-tools") }.should_not raise_error(ArgumentError)
1718
- lambda { @yc.available_version("zisofs-tools", "i386") }.should_not raise_error(ArgumentError)
1717
+ lambda { @yc.available_version("zisofs-tools") }.should_not raise_error
1718
+ lambda { @yc.available_version("zisofs-tools", "i386") }.should_not raise_error
1719
1719
  lambda { @yc.available_version("zisofs-tools", "i386", "extra") }.should raise_error(ArgumentError)
1720
1720
  end
1721
1721
 
@@ -1739,8 +1739,8 @@ EOF
1739
1739
  describe "version_available?" do
1740
1740
  it "should take two or three arguments" do
1741
1741
  lambda { @yc.version_available?("zisofs-tools") }.should raise_error(ArgumentError)
1742
- lambda { @yc.version_available?("zisofs-tools", "1.0.6-3.2.2") }.should_not raise_error(ArgumentError)
1743
- lambda { @yc.version_available?("zisofs-tools", "1.0.6-3.2.2", "x86_64") }.should_not raise_error(ArgumentError)
1742
+ lambda { @yc.version_available?("zisofs-tools", "1.0.6-3.2.2") }.should_not raise_error
1743
+ lambda { @yc.version_available?("zisofs-tools", "1.0.6-3.2.2", "x86_64") }.should_not raise_error
1744
1744
  end
1745
1745
 
1746
1746
  it "should return true if our package-version-arch is available" do
@@ -1768,8 +1768,8 @@ EOF
1768
1768
  describe "package_repository" do
1769
1769
  it "should take two or three arguments" do
1770
1770
  lambda { @yc.package_repository("zisofs-tools") }.should raise_error(ArgumentError)
1771
- lambda { @yc.package_repository("zisofs-tools", "1.0.6-3.2.2") }.should_not raise_error(ArgumentError)
1772
- lambda { @yc.package_repository("zisofs-tools", "1.0.6-3.2.2", "x86_64") }.should_not raise_error(ArgumentError)
1771
+ lambda { @yc.package_repository("zisofs-tools", "1.0.6-3.2.2") }.should_not raise_error
1772
+ lambda { @yc.package_repository("zisofs-tools", "1.0.6-3.2.2", "x86_64") }.should_not raise_error
1773
1773
  end
1774
1774
 
1775
1775
  it "should return repoid for package-version-arch" do