puppet 6.0.7-x86-mingw32 → 6.0.8-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (632) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -1
  3. data/Gemfile.lock +4 -8
  4. data/lib/puppet/application/device.rb +99 -83
  5. data/lib/puppet/application/filebucket.rb +4 -0
  6. data/lib/puppet/configurer.rb +5 -4
  7. data/lib/puppet/defaults.rb +31 -11
  8. data/lib/puppet/indirector/request.rb +26 -15
  9. data/lib/puppet/network/http/connection.rb +15 -7
  10. data/lib/puppet/transaction/event_manager.rb +1 -5
  11. data/lib/puppet/type/file/source.rb +0 -1
  12. data/lib/puppet/util/connection.rb +15 -6
  13. data/lib/puppet/util/http_proxy.rb +3 -2
  14. data/lib/puppet/version.rb +1 -1
  15. data/locales/puppet.pot +99 -40
  16. data/man/man5/puppet.conf.5 +8 -8
  17. data/man/man8/puppet-agent.8 +1 -1
  18. data/man/man8/puppet-apply.8 +1 -1
  19. data/man/man8/puppet-catalog.8 +1 -1
  20. data/man/man8/puppet-config.8 +1 -1
  21. data/man/man8/puppet-describe.8 +1 -1
  22. data/man/man8/puppet-device.8 +1 -1
  23. data/man/man8/puppet-doc.8 +1 -1
  24. data/man/man8/puppet-epp.8 +1 -1
  25. data/man/man8/puppet-facts.8 +1 -1
  26. data/man/man8/puppet-filebucket.8 +1 -1
  27. data/man/man8/puppet-generate.8 +1 -1
  28. data/man/man8/puppet-help.8 +1 -1
  29. data/man/man8/puppet-key.8 +1 -1
  30. data/man/man8/puppet-lookup.8 +1 -1
  31. data/man/man8/puppet-man.8 +1 -1
  32. data/man/man8/puppet-module.8 +1 -1
  33. data/man/man8/puppet-node.8 +1 -1
  34. data/man/man8/puppet-parser.8 +1 -1
  35. data/man/man8/puppet-plugin.8 +1 -1
  36. data/man/man8/puppet-report.8 +1 -1
  37. data/man/man8/puppet-resource.8 +1 -1
  38. data/man/man8/puppet-script.8 +1 -1
  39. data/man/man8/puppet-ssl.8 +1 -1
  40. data/man/man8/puppet-status.8 +1 -1
  41. data/man/man8/puppet.8 +2 -2
  42. data/spec/integration/agent/logging_spec.rb +5 -7
  43. data/spec/integration/application/apply_spec.rb +18 -16
  44. data/spec/integration/application/doc_spec.rb +1 -2
  45. data/spec/integration/application/lookup_spec.rb +5 -5
  46. data/spec/integration/configurer_spec.rb +5 -6
  47. data/spec/integration/defaults_spec.rb +5 -6
  48. data/spec/integration/directory_environments_spec.rb +1 -1
  49. data/spec/integration/faces/config_spec.rb +3 -4
  50. data/spec/integration/faces/documentation_spec.rb +0 -1
  51. data/spec/integration/faces/plugin_spec.rb +1 -1
  52. data/spec/integration/file_bucket/file_spec.rb +2 -4
  53. data/spec/integration/file_serving/content_spec.rb +0 -1
  54. data/spec/integration/file_serving/fileset_spec.rb +0 -1
  55. data/spec/integration/file_serving/metadata_spec.rb +0 -1
  56. data/spec/integration/file_serving/terminus_helper_spec.rb +0 -1
  57. data/spec/integration/indirector/catalog/compiler_spec.rb +10 -11
  58. data/spec/integration/indirector/direct_file_server_spec.rb +1 -1
  59. data/spec/integration/indirector/facts/facter_spec.rb +4 -5
  60. data/spec/integration/indirector/file_content/file_server_spec.rb +7 -8
  61. data/spec/integration/indirector/file_metadata/file_server_spec.rb +7 -8
  62. data/spec/integration/network/authconfig_spec.rb +23 -24
  63. data/spec/integration/network/formats_spec.rb +0 -1
  64. data/spec/integration/node/environment_spec.rb +0 -1
  65. data/spec/integration/node/facts_spec.rb +9 -10
  66. data/spec/integration/node_spec.rb +6 -7
  67. data/spec/integration/parser/catalog_spec.rb +1 -5
  68. data/spec/integration/parser/collection_spec.rb +1 -2
  69. data/spec/integration/parser/compiler_spec.rb +6 -6
  70. data/spec/integration/parser/scope_spec.rb +1 -1
  71. data/spec/integration/parser/undef_param_spec.rb +1 -1
  72. data/spec/integration/provider/service/init_spec.rb +4 -5
  73. data/spec/integration/provider/service/systemd_spec.rb +0 -2
  74. data/spec/integration/provider/service/windows_spec.rb +1 -2
  75. data/spec/integration/reference/providers_spec.rb +1 -2
  76. data/spec/integration/reports_spec.rb +1 -2
  77. data/spec/integration/resource/catalog_spec.rb +14 -17
  78. data/spec/integration/resource/type_collection_spec.rb +4 -5
  79. data/spec/integration/ssl/certificate_request_spec.rb +0 -1
  80. data/spec/integration/ssl/host_spec.rb +1 -2
  81. data/spec/integration/ssl/key_spec.rb +0 -1
  82. data/spec/integration/test/test_helper_spec.rb +0 -1
  83. data/spec/integration/transaction/report_spec.rb +6 -11
  84. data/spec/integration/transaction_spec.rb +18 -19
  85. data/spec/integration/type/exec_spec.rb +0 -1
  86. data/spec/integration/type/file_spec.rb +13 -14
  87. data/spec/integration/type/package_spec.rb +19 -23
  88. data/spec/integration/type/tidy_spec.rb +1 -2
  89. data/spec/integration/type_spec.rb +0 -1
  90. data/spec/integration/util/autoload_spec.rb +1 -2
  91. data/spec/integration/util/rdoc/parser_spec.rb +0 -1
  92. data/spec/integration/util/settings_spec.rb +0 -1
  93. data/spec/integration/util/windows/adsi_spec.rb +3 -5
  94. data/spec/integration/util/windows/principal_spec.rb +0 -1
  95. data/spec/integration/util/windows/process_spec.rb +4 -6
  96. data/spec/integration/util/windows/registry_spec.rb +41 -51
  97. data/spec/integration/util/windows/security_spec.rb +2 -4
  98. data/spec/integration/util/windows/user_spec.rb +18 -20
  99. data/spec/integration/util_spec.rb +4 -7
  100. data/spec/lib/puppet_spec/compiler.rb +1 -1
  101. data/spec/lib/puppet_spec/files.rb +0 -1
  102. data/spec/lib/puppet_spec/module_tool/shared_functions.rb +1 -1
  103. data/spec/lib/puppet_spec/scope.rb +1 -2
  104. data/spec/shared_behaviours/all_parsedfile_providers.rb +1 -1
  105. data/spec/shared_behaviours/file_server_terminus.rb +8 -9
  106. data/spec/shared_behaviours/file_serving.rb +6 -8
  107. data/spec/shared_behaviours/file_serving_model.rb +3 -5
  108. data/spec/shared_behaviours/hiera_indirections.rb +3 -4
  109. data/spec/shared_behaviours/iterative_functions.rb +0 -1
  110. data/spec/shared_behaviours/memory_terminus.rb +2 -2
  111. data/spec/shared_examples/rhel_package_provider.rb +112 -70
  112. data/spec/spec_helper.rb +10 -1
  113. data/spec/unit/agent/disabler_spec.rb +4 -5
  114. data/spec/unit/agent/locker_spec.rb +12 -13
  115. data/spec/unit/agent_spec.rb +80 -85
  116. data/spec/unit/application/agent_spec.rb +88 -93
  117. data/spec/unit/application/apply_spec.rb +82 -83
  118. data/spec/unit/application/config_spec.rb +0 -1
  119. data/spec/unit/application/describe_spec.rb +6 -7
  120. data/spec/unit/application/device_spec.rb +395 -419
  121. data/spec/unit/application/doc_spec.rb +44 -46
  122. data/spec/unit/application/face_base_spec.rb +61 -62
  123. data/spec/unit/application/facts_spec.rb +3 -4
  124. data/spec/unit/application/filebucket_spec.rb +66 -74
  125. data/spec/unit/application/indirection_base_spec.rb +8 -6
  126. data/spec/unit/application/lookup_spec.rb +26 -26
  127. data/spec/unit/application/resource_spec.rb +42 -48
  128. data/spec/unit/application/ssl_spec.rb +3 -3
  129. data/spec/unit/application_spec.rb +82 -92
  130. data/spec/unit/capability_spec.rb +6 -6
  131. data/spec/unit/certificate_factory_spec.rb +3 -5
  132. data/spec/unit/configurer/downloader_spec.rb +20 -21
  133. data/spec/unit/configurer/fact_handler_spec.rb +2 -3
  134. data/spec/unit/configurer/plugin_handler_spec.rb +41 -8
  135. data/spec/unit/configurer_spec.rb +189 -192
  136. data/spec/unit/confine/exists_spec.rb +17 -15
  137. data/spec/unit/confine/false_spec.rb +5 -6
  138. data/spec/unit/confine/feature_spec.rb +7 -5
  139. data/spec/unit/confine/true_spec.rb +5 -6
  140. data/spec/unit/confine/variable_spec.rb +14 -15
  141. data/spec/unit/confine_collection_spec.rb +28 -29
  142. data/spec/unit/confine_spec.rb +13 -14
  143. data/spec/unit/confiner_spec.rb +10 -11
  144. data/spec/unit/context/trusted_information_spec.rb +1 -1
  145. data/spec/unit/daemon_spec.rb +35 -36
  146. data/spec/unit/data_providers/function_data_provider_spec.rb +0 -1
  147. data/spec/unit/data_providers/hiera_data_provider_spec.rb +0 -1
  148. data/spec/unit/datatypes_spec.rb +3 -4
  149. data/spec/unit/defaults_spec.rb +18 -13
  150. data/spec/unit/environments_spec.rb +7 -7
  151. data/spec/unit/etc_spec.rb +30 -32
  152. data/spec/unit/external/pson_spec.rb +0 -1
  153. data/spec/unit/face/catalog_spec.rb +0 -1
  154. data/spec/unit/face/config_spec.rb +31 -35
  155. data/spec/unit/face/epp_face_spec.rb +3 -4
  156. data/spec/unit/face/facts_spec.rb +5 -6
  157. data/spec/unit/face/generate_spec.rb +4 -5
  158. data/spec/unit/face/help_spec.rb +7 -8
  159. data/spec/unit/face/key_spec.rb +0 -1
  160. data/spec/unit/face/man_spec.rb +1 -2
  161. data/spec/unit/face/module/install_spec.rb +3 -5
  162. data/spec/unit/face/module/list_spec.rb +2 -12
  163. data/spec/unit/face/module/search_spec.rb +11 -9
  164. data/spec/unit/face/module/uninstall_spec.rb +4 -8
  165. data/spec/unit/face/node_spec.rb +23 -24
  166. data/spec/unit/face/parser_spec.rb +3 -3
  167. data/spec/unit/face/plugin_spec.rb +36 -9
  168. data/spec/unit/face/status_spec.rb +0 -1
  169. data/spec/unit/file_bucket/dipper_spec.rb +24 -20
  170. data/spec/unit/file_bucket/file_spec.rb +0 -2
  171. data/spec/unit/file_serving/base_spec.rb +14 -15
  172. data/spec/unit/file_serving/configuration/parser_spec.rb +27 -28
  173. data/spec/unit/file_serving/configuration_spec.rb +63 -66
  174. data/spec/unit/file_serving/content_spec.rb +10 -11
  175. data/spec/unit/file_serving/fileset_spec.rb +63 -58
  176. data/spec/unit/file_serving/http_metadata_spec.rb +8 -7
  177. data/spec/unit/file_serving/metadata_spec.rb +36 -36
  178. data/spec/unit/file_serving/mount/file_spec.rb +31 -32
  179. data/spec/unit/file_serving/mount/locales_spec.rb +23 -24
  180. data/spec/unit/file_serving/mount/modules_spec.rb +14 -15
  181. data/spec/unit/file_serving/mount/pluginfacts_spec.rb +23 -24
  182. data/spec/unit/file_serving/mount/plugins_spec.rb +23 -24
  183. data/spec/unit/file_serving/mount/tasks_spec.rb +14 -15
  184. data/spec/unit/file_serving/mount_spec.rb +0 -1
  185. data/spec/unit/file_serving/terminus_helper_spec.rb +37 -42
  186. data/spec/unit/file_serving/terminus_selector_spec.rb +12 -13
  187. data/spec/unit/file_system/uniquefile_spec.rb +4 -4
  188. data/spec/unit/file_system_spec.rb +2 -2
  189. data/spec/unit/forge/errors_spec.rb +1 -1
  190. data/spec/unit/forge/forge_spec.rb +13 -14
  191. data/spec/unit/forge/module_release_spec.rb +18 -18
  192. data/spec/unit/forge/repository_spec.rb +29 -30
  193. data/spec/unit/forge_spec.rb +15 -11
  194. data/spec/unit/functions/binary_file_spec.rb +3 -3
  195. data/spec/unit/functions/contain_spec.rb +0 -2
  196. data/spec/unit/functions/defined_spec.rb +0 -1
  197. data/spec/unit/functions/epp_spec.rb +2 -2
  198. data/spec/unit/functions/find_file_spec.rb +7 -7
  199. data/spec/unit/functions/include_spec.rb +0 -4
  200. data/spec/unit/functions/lookup_fixture_spec.rb +0 -1
  201. data/spec/unit/functions/lookup_spec.rb +1 -2
  202. data/spec/unit/functions/module_directory_spec.rb +12 -12
  203. data/spec/unit/functions/require_spec.rb +0 -3
  204. data/spec/unit/functions/shared.rb +5 -8
  205. data/spec/unit/functions/versioncmp_spec.rb +1 -2
  206. data/spec/unit/functions4_spec.rb +9 -10
  207. data/spec/unit/gettext/config_spec.rb +4 -4
  208. data/spec/unit/gettext/module_loading_spec.rb +7 -7
  209. data/spec/unit/graph/rb_tree_map_spec.rb +0 -2
  210. data/spec/unit/graph/relationship_graph_spec.rb +1 -2
  211. data/spec/unit/graph/simple_graph_spec.rb +9 -10
  212. data/spec/unit/hiera_puppet_spec.rb +20 -20
  213. data/spec/unit/indirector/catalog/compiler_spec.rb +147 -149
  214. data/spec/unit/indirector/catalog/json_spec.rb +1 -2
  215. data/spec/unit/indirector/catalog/msgpack_spec.rb +0 -1
  216. data/spec/unit/indirector/catalog/rest_spec.rb +0 -1
  217. data/spec/unit/indirector/catalog/store_configs_spec.rb +0 -1
  218. data/spec/unit/indirector/catalog/yaml_spec.rb +0 -1
  219. data/spec/unit/indirector/certificate/file_spec.rb +0 -1
  220. data/spec/unit/indirector/certificate/rest_spec.rb +8 -10
  221. data/spec/unit/indirector/certificate_request/file_spec.rb +0 -1
  222. data/spec/unit/indirector/certificate_request/rest_spec.rb +0 -1
  223. data/spec/unit/indirector/direct_file_server_spec.rb +17 -18
  224. data/spec/unit/indirector/envelope_spec.rb +1 -2
  225. data/spec/unit/indirector/exec_spec.rb +4 -5
  226. data/spec/unit/indirector/face_spec.rb +9 -9
  227. data/spec/unit/indirector/facts/facter_spec.rb +37 -43
  228. data/spec/unit/indirector/facts/network_device_spec.rb +8 -9
  229. data/spec/unit/indirector/facts/rest_spec.rb +7 -8
  230. data/spec/unit/indirector/facts/store_configs_spec.rb +0 -1
  231. data/spec/unit/indirector/facts/yaml_spec.rb +0 -1
  232. data/spec/unit/indirector/file_bucket_file/file_spec.rb +3 -4
  233. data/spec/unit/indirector/file_bucket_file/rest_spec.rb +0 -1
  234. data/spec/unit/indirector/file_bucket_file/selector_spec.rb +4 -5
  235. data/spec/unit/indirector/file_content/file_server_spec.rb +0 -1
  236. data/spec/unit/indirector/file_content/file_spec.rb +0 -1
  237. data/spec/unit/indirector/file_content/rest_spec.rb +0 -1
  238. data/spec/unit/indirector/file_content/selector_spec.rb +0 -1
  239. data/spec/unit/indirector/file_metadata/file_server_spec.rb +0 -1
  240. data/spec/unit/indirector/file_metadata/file_spec.rb +12 -13
  241. data/spec/unit/indirector/file_metadata/rest_spec.rb +0 -1
  242. data/spec/unit/indirector/file_metadata/selector_spec.rb +0 -1
  243. data/spec/unit/indirector/file_server_spec.rb +87 -87
  244. data/spec/unit/indirector/indirection_spec.rb +242 -226
  245. data/spec/unit/indirector/json_spec.rb +7 -9
  246. data/spec/unit/indirector/key/file_spec.rb +21 -22
  247. data/spec/unit/indirector/memory_spec.rb +6 -7
  248. data/spec/unit/indirector/msgpack_spec.rb +7 -9
  249. data/spec/unit/indirector/node/exec_spec.rb +2 -3
  250. data/spec/unit/indirector/node/memory_spec.rb +2 -4
  251. data/spec/unit/indirector/node/msgpack_spec.rb +0 -1
  252. data/spec/unit/indirector/node/plain_spec.rb +2 -4
  253. data/spec/unit/indirector/node/rest_spec.rb +0 -1
  254. data/spec/unit/indirector/node/store_configs_spec.rb +0 -1
  255. data/spec/unit/indirector/node/yaml_spec.rb +0 -1
  256. data/spec/unit/indirector/none_spec.rb +5 -5
  257. data/spec/unit/indirector/plain_spec.rb +7 -8
  258. data/spec/unit/indirector/report/msgpack_spec.rb +0 -1
  259. data/spec/unit/indirector/report/processor_spec.rb +21 -22
  260. data/spec/unit/indirector/report/rest_spec.rb +11 -12
  261. data/spec/unit/indirector/report/yaml_spec.rb +0 -1
  262. data/spec/unit/indirector/request_spec.rb +11 -12
  263. data/spec/unit/indirector/resource/ral_spec.rb +46 -54
  264. data/spec/unit/indirector/resource/store_configs_spec.rb +0 -1
  265. data/spec/unit/indirector/rest_spec.rb +113 -110
  266. data/spec/unit/indirector/ssl_file_spec.rb +64 -65
  267. data/spec/unit/indirector/status/local_spec.rb +0 -1
  268. data/spec/unit/indirector/status/rest_spec.rb +0 -1
  269. data/spec/unit/indirector/store_configs_spec.rb +0 -1
  270. data/spec/unit/indirector/terminus_spec.rb +27 -27
  271. data/spec/unit/indirector/yaml_spec.rb +5 -6
  272. data/spec/unit/indirector_spec.rb +1 -2
  273. data/spec/unit/info_service_spec.rb +1 -1
  274. data/spec/unit/interface/action_builder_spec.rb +0 -1
  275. data/spec/unit/interface/action_manager_spec.rb +0 -1
  276. data/spec/unit/interface/action_spec.rb +2 -3
  277. data/spec/unit/interface/documentation_spec.rb +0 -1
  278. data/spec/unit/interface/face_collection_spec.rb +19 -12
  279. data/spec/unit/interface_spec.rb +3 -3
  280. data/spec/unit/man_spec.rb +3 -4
  281. data/spec/unit/module_spec.rb +46 -51
  282. data/spec/unit/module_tool/applications/installer_spec.rb +10 -11
  283. data/spec/unit/module_tool/applications/searcher_spec.rb +3 -3
  284. data/spec/unit/module_tool/applications/uninstaller_spec.rb +1 -2
  285. data/spec/unit/module_tool/applications/unpacker_spec.rb +13 -13
  286. data/spec/unit/module_tool/applications/upgrader_spec.rb +5 -5
  287. data/spec/unit/module_tool/install_directory_spec.rb +8 -8
  288. data/spec/unit/module_tool/installed_modules_spec.rb +3 -3
  289. data/spec/unit/module_tool/tar/gnu_spec.rb +6 -6
  290. data/spec/unit/module_tool/tar/mini_spec.rb +12 -12
  291. data/spec/unit/module_tool/tar_spec.rb +12 -13
  292. data/spec/unit/module_tool_spec.rb +7 -12
  293. data/spec/unit/network/auth_config_parser_spec.rb +11 -13
  294. data/spec/unit/network/authconfig_spec.rb +17 -18
  295. data/spec/unit/network/authorization_spec.rb +4 -5
  296. data/spec/unit/network/authstore_spec.rb +0 -1
  297. data/spec/unit/network/format_handler_spec.rb +0 -1
  298. data/spec/unit/network/format_spec.rb +9 -10
  299. data/spec/unit/network/format_support_spec.rb +28 -29
  300. data/spec/unit/network/formats_spec.rb +4 -5
  301. data/spec/unit/network/http/api/indirected_routes_spec.rb +24 -29
  302. data/spec/unit/network/http/api/master/v3/authorization_spec.rb +2 -2
  303. data/spec/unit/network/http/api/master/v3/environment_spec.rb +1 -1
  304. data/spec/unit/network/http/api/master/v3/environments_spec.rb +6 -7
  305. data/spec/unit/network/http/api_spec.rb +0 -2
  306. data/spec/unit/network/http/compression_spec.rb +21 -22
  307. data/spec/unit/network/http/connection_spec.rb +41 -36
  308. data/spec/unit/network/http/factory_spec.rb +5 -6
  309. data/spec/unit/network/http/handler_spec.rb +9 -18
  310. data/spec/unit/network/http/nocache_pool_spec.rb +6 -7
  311. data/spec/unit/network/http/pool_spec.rb +28 -29
  312. data/spec/unit/network/http/request_spec.rb +0 -2
  313. data/spec/unit/network/http/response_spec.rb +11 -13
  314. data/spec/unit/network/http/route_spec.rb +0 -1
  315. data/spec/unit/network/http/session_spec.rb +1 -2
  316. data/spec/unit/network/http/site_spec.rb +0 -1
  317. data/spec/unit/network/http_pool_spec.rb +18 -9
  318. data/spec/unit/network/http_spec.rb +0 -1
  319. data/spec/unit/network/resolver_spec.rb +25 -26
  320. data/spec/unit/network/rights_spec.rb +52 -53
  321. data/spec/unit/node/environment_spec.rb +14 -15
  322. data/spec/unit/node/facts_spec.rb +5 -7
  323. data/spec/unit/node_spec.rb +4 -10
  324. data/spec/unit/other/selinux_spec.rb +0 -1
  325. data/spec/unit/parameter/boolean_spec.rb +1 -2
  326. data/spec/unit/parameter/package_options_spec.rb +1 -2
  327. data/spec/unit/parameter/path_spec.rb +0 -1
  328. data/spec/unit/parameter/value_collection_spec.rb +0 -1
  329. data/spec/unit/parameter/value_spec.rb +0 -1
  330. data/spec/unit/parameter_spec.rb +9 -9
  331. data/spec/unit/parser/ast/block_expression_spec.rb +6 -8
  332. data/spec/unit/parser/ast/leaf_spec.rb +20 -21
  333. data/spec/unit/parser/compiler_spec.rb +84 -96
  334. data/spec/unit/parser/environment_compiler_spec.rb +7 -8
  335. data/spec/unit/parser/files_spec.rb +0 -1
  336. data/spec/unit/parser/functions/create_resources_spec.rb +1 -1
  337. data/spec/unit/parser/functions/digest_spec.rb +0 -1
  338. data/spec/unit/parser/functions/fail_spec.rb +1 -2
  339. data/spec/unit/parser/functions/file_spec.rb +13 -14
  340. data/spec/unit/parser/functions/fqdn_rand_spec.rb +5 -6
  341. data/spec/unit/parser/functions/generate_spec.rb +7 -8
  342. data/spec/unit/parser/functions/inline_template_spec.rb +0 -1
  343. data/spec/unit/parser/functions/regsubst_spec.rb +0 -1
  344. data/spec/unit/parser/functions/scanf_spec.rb +0 -1
  345. data/spec/unit/parser/functions/shellquote_spec.rb +0 -1
  346. data/spec/unit/parser/functions/split_spec.rb +0 -1
  347. data/spec/unit/parser/functions/sprintf_spec.rb +0 -1
  348. data/spec/unit/parser/functions/tag_spec.rb +1 -2
  349. data/spec/unit/parser/functions/tagged_spec.rb +2 -3
  350. data/spec/unit/parser/functions/template_spec.rb +13 -13
  351. data/spec/unit/parser/functions/versioncmp_spec.rb +1 -2
  352. data/spec/unit/parser/functions_spec.rb +6 -7
  353. data/spec/unit/parser/relationship_spec.rb +0 -1
  354. data/spec/unit/parser/resource_spec.rb +42 -42
  355. data/spec/unit/parser/scope_spec.rb +39 -35
  356. data/spec/unit/parser/templatewrapper_spec.rb +11 -12
  357. data/spec/unit/parser/type_loader_spec.rb +17 -19
  358. data/spec/unit/pops/adaptable_spec.rb +0 -1
  359. data/spec/unit/pops/benchmark_spec.rb +0 -1
  360. data/spec/unit/pops/evaluator/access_ops_spec.rb +0 -1
  361. data/spec/unit/pops/evaluator/arithmetic_ops_spec.rb +0 -1
  362. data/spec/unit/pops/evaluator/basic_expressions_spec.rb +0 -1
  363. data/spec/unit/pops/evaluator/collections_ops_spec.rb +0 -1
  364. data/spec/unit/pops/evaluator/comparison_ops_spec.rb +0 -1
  365. data/spec/unit/pops/evaluator/conditionals_spec.rb +0 -1
  366. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +10 -11
  367. data/spec/unit/pops/evaluator/logical_ops_spec.rb +0 -1
  368. data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +0 -1
  369. data/spec/unit/pops/evaluator/string_interpolation_spec.rb +0 -1
  370. data/spec/unit/pops/evaluator/variables_spec.rb +0 -1
  371. data/spec/unit/pops/factory_spec.rb +3 -4
  372. data/spec/unit/pops/issues_spec.rb +19 -20
  373. data/spec/unit/pops/loaders/loader_spec.rb +8 -4
  374. data/spec/unit/pops/loaders/loaders_spec.rb +31 -28
  375. data/spec/unit/pops/lookup/context_spec.rb +0 -1
  376. data/spec/unit/pops/lookup/interpolation_spec.rb +2 -3
  377. data/spec/unit/pops/merge_strategy_spec.rb +0 -1
  378. data/spec/unit/pops/migration_spec.rb +3 -5
  379. data/spec/unit/pops/model/model_spec.rb +0 -1
  380. data/spec/unit/pops/model/pn_transformer_spec.rb +0 -1
  381. data/spec/unit/pops/parser/locator_spec.rb +3 -6
  382. data/spec/unit/pops/parser/parse_application_spec.rb +0 -1
  383. data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +0 -1
  384. data/spec/unit/pops/parser/parse_calls_spec.rb +0 -1
  385. data/spec/unit/pops/parser/parse_capabilities_spec.rb +0 -1
  386. data/spec/unit/pops/parser/parse_conditionals_spec.rb +0 -1
  387. data/spec/unit/pops/parser/parse_containers_spec.rb +0 -1
  388. data/spec/unit/pops/parser/parse_plan_spec.rb +0 -1
  389. data/spec/unit/pops/parser/parse_resource_spec.rb +0 -1
  390. data/spec/unit/pops/parser/parse_site_spec.rb +0 -1
  391. data/spec/unit/pops/parser/pn_parser_spec.rb +0 -1
  392. data/spec/unit/pops/pn_spec.rb +0 -1
  393. data/spec/unit/pops/resource/resource_type_impl_spec.rb +0 -1
  394. data/spec/unit/pops/serialization/serialization_spec.rb +1 -1
  395. data/spec/unit/pops/serialization/to_from_hr_spec.rb +1 -1
  396. data/spec/unit/pops/types/recursion_guard_spec.rb +10 -10
  397. data/spec/unit/pops/types/ruby_generator_spec.rb +2 -2
  398. data/spec/unit/pops/types/type_asserter_spec.rb +2 -2
  399. data/spec/unit/pops/types/type_calculator_spec.rb +30 -30
  400. data/spec/unit/pops/types/type_parser_spec.rb +13 -13
  401. data/spec/unit/pops/validator/validator_spec.rb +1 -2
  402. data/spec/unit/pops/visitor_spec.rb +0 -1
  403. data/spec/unit/property/boolean_spec.rb +1 -1
  404. data/spec/unit/property/ensure_spec.rb +0 -1
  405. data/spec/unit/property/keyvalue_spec.rb +32 -34
  406. data/spec/unit/property/list_spec.rb +26 -27
  407. data/spec/unit/property/ordered_list_spec.rb +10 -14
  408. data/spec/unit/property_spec.rb +42 -43
  409. data/spec/unit/provider/aix_object_spec.rb +47 -45
  410. data/spec/unit/provider/command_spec.rb +9 -9
  411. data/spec/unit/provider/exec/posix_spec.rb +6 -7
  412. data/spec/unit/provider/exec/shell_spec.rb +0 -1
  413. data/spec/unit/provider/exec/windows_spec.rb +2 -4
  414. data/spec/unit/provider/exec_spec.rb +0 -1
  415. data/spec/unit/provider/file/posix_spec.rb +22 -24
  416. data/spec/unit/provider/file/windows_spec.rb +15 -17
  417. data/spec/unit/provider/group/aix_spec.rb +3 -2
  418. data/spec/unit/provider/group/groupadd_spec.rb +30 -26
  419. data/spec/unit/provider/group/ldap_spec.rb +18 -18
  420. data/spec/unit/provider/group/pw_spec.rb +11 -11
  421. data/spec/unit/provider/group/windows_adsi_spec.rb +54 -54
  422. data/spec/unit/provider/ldap_spec.rb +61 -62
  423. data/spec/unit/provider/nameservice/directoryservice_spec.rb +35 -36
  424. data/spec/unit/provider/nameservice_spec.rb +38 -40
  425. data/spec/unit/provider/package/aix_spec.rb +15 -15
  426. data/spec/unit/provider/package/appdmg_spec.rb +13 -13
  427. data/spec/unit/provider/package/apt_spec.rb +44 -27
  428. data/spec/unit/provider/package/aptitude_spec.rb +6 -7
  429. data/spec/unit/provider/package/aptrpm_spec.rb +7 -12
  430. data/spec/unit/provider/package/base_spec.rb +4 -4
  431. data/spec/unit/provider/package/dnf_spec.rb +18 -20
  432. data/spec/unit/provider/package/dpkg_spec.rb +52 -52
  433. data/spec/unit/provider/package/freebsd_spec.rb +11 -11
  434. data/spec/unit/provider/package/gem_spec.rb +51 -43
  435. data/spec/unit/provider/package/hpux_spec.rb +8 -8
  436. data/spec/unit/provider/package/macports_spec.rb +46 -42
  437. data/spec/unit/provider/package/nim_spec.rb +30 -39
  438. data/spec/unit/provider/package/openbsd_spec.rb +36 -39
  439. data/spec/unit/provider/package/opkg_spec.rb +23 -26
  440. data/spec/unit/provider/package/pacman_spec.rb +97 -118
  441. data/spec/unit/provider/package/pip_spec.rb +71 -72
  442. data/spec/unit/provider/package/pkg_spec.rb +109 -109
  443. data/spec/unit/provider/package/pkgdmg_spec.rb +65 -63
  444. data/spec/unit/provider/package/pkgin_spec.rb +10 -8
  445. data/spec/unit/provider/package/pkgng_spec.rb +17 -18
  446. data/spec/unit/provider/package/pkgutil_spec.rb +45 -49
  447. data/spec/unit/provider/package/portage_spec.rb +70 -74
  448. data/spec/unit/provider/package/puppet_gem_spec.rb +28 -8
  449. data/spec/unit/provider/package/rpm_spec.rb +53 -64
  450. data/spec/unit/provider/package/sun_spec.rb +16 -18
  451. data/spec/unit/provider/package/tdnf_spec.rb +2 -2
  452. data/spec/unit/provider/package/up2date_spec.rb +2 -4
  453. data/spec/unit/provider/package/urpmi_spec.rb +15 -17
  454. data/spec/unit/provider/package/windows/exe_package_spec.rb +12 -15
  455. data/spec/unit/provider/package/windows/msi_package_spec.rb +19 -22
  456. data/spec/unit/provider/package/windows/package_spec.rb +37 -42
  457. data/spec/unit/provider/package/windows_spec.rb +36 -32
  458. data/spec/unit/provider/package/yum_spec.rb +7 -7
  459. data/spec/unit/provider/package/zypper_spec.rb +87 -87
  460. data/spec/unit/provider/parsedfile_spec.rb +44 -45
  461. data/spec/unit/provider/service/base_spec.rb +4 -5
  462. data/spec/unit/provider/service/bsd_spec.rb +27 -29
  463. data/spec/unit/provider/service/daemontools_spec.rb +35 -35
  464. data/spec/unit/provider/service/debian_spec.rb +38 -38
  465. data/spec/unit/provider/service/freebsd_spec.rb +18 -18
  466. data/spec/unit/provider/service/gentoo_spec.rb +50 -55
  467. data/spec/unit/provider/service/init_spec.rb +53 -52
  468. data/spec/unit/provider/service/launchd_spec.rb +138 -116
  469. data/spec/unit/provider/service/openbsd_spec.rb +50 -50
  470. data/spec/unit/provider/service/openrc_spec.rb +43 -45
  471. data/spec/unit/provider/service/openwrt_spec.rb +26 -31
  472. data/spec/unit/provider/service/rcng_spec.rb +14 -14
  473. data/spec/unit/provider/service/redhat_spec.rb +45 -43
  474. data/spec/unit/provider/service/runit_spec.rb +29 -27
  475. data/spec/unit/provider/service/smf_spec.rb +74 -66
  476. data/spec/unit/provider/service/src_spec.rb +46 -47
  477. data/spec/unit/provider/service/systemd_spec.rb +104 -113
  478. data/spec/unit/provider/service/upstart_spec.rb +74 -71
  479. data/spec/unit/provider/service/windows_spec.rb +33 -41
  480. data/spec/unit/provider/user/aix_spec.rb +31 -31
  481. data/spec/unit/provider/user/directoryservice_spec.rb +109 -114
  482. data/spec/unit/provider/user/hpux_spec.rb +16 -16
  483. data/spec/unit/provider/user/ldap_spec.rb +57 -57
  484. data/spec/unit/provider/user/openbsd_spec.rb +10 -12
  485. data/spec/unit/provider/user/pw_spec.rb +37 -35
  486. data/spec/unit/provider/user/user_role_add_spec.rb +93 -93
  487. data/spec/unit/provider/user/useradd_spec.rb +93 -92
  488. data/spec/unit/provider/user/windows_adsi_spec.rb +59 -60
  489. data/spec/unit/provider_spec.rb +35 -35
  490. data/spec/unit/puppet_pal_2pec.rb +4 -5
  491. data/spec/unit/puppet_pal_spec.rb +0 -1
  492. data/spec/unit/puppet_spec.rb +6 -7
  493. data/spec/unit/relationship_spec.rb +0 -1
  494. data/spec/unit/reports/http_spec.rb +21 -23
  495. data/spec/unit/reports/store_spec.rb +3 -4
  496. data/spec/unit/reports_spec.rb +12 -14
  497. data/spec/unit/resource/capability_finder_spec.rb +15 -17
  498. data/spec/unit/resource/catalog_spec.rb +72 -68
  499. data/spec/unit/resource/status_spec.rb +6 -8
  500. data/spec/unit/resource/type_collection_spec.rb +17 -18
  501. data/spec/unit/resource/type_spec.rb +34 -35
  502. data/spec/unit/resource_spec.rb +36 -32
  503. data/spec/unit/rest/client_spec.rb +58 -27
  504. data/spec/unit/rest/route_spec.rb +5 -5
  505. data/spec/unit/scheduler/job_spec.rb +0 -1
  506. data/spec/unit/scheduler/scheduler_spec.rb +0 -1
  507. data/spec/unit/scheduler/splay_job_spec.rb +1 -2
  508. data/spec/unit/settings/array_setting_spec.rb +1 -1
  509. data/spec/unit/settings/autosign_setting_spec.rb +9 -9
  510. data/spec/unit/settings/certificate_revocation_setting_spec.rb +1 -1
  511. data/spec/unit/settings/config_file_spec.rb +0 -1
  512. data/spec/unit/settings/directory_setting_spec.rb +2 -7
  513. data/spec/unit/settings/duration_setting_spec.rb +1 -2
  514. data/spec/unit/settings/enum_setting_spec.rb +1 -1
  515. data/spec/unit/settings/environment_conf_spec.rb +4 -6
  516. data/spec/unit/settings/file_setting_spec.rb +44 -46
  517. data/spec/unit/settings/path_setting_spec.rb +1 -2
  518. data/spec/unit/settings/priority_setting_spec.rb +1 -2
  519. data/spec/unit/settings/string_setting_spec.rb +14 -15
  520. data/spec/unit/settings/terminus_setting_spec.rb +1 -2
  521. data/spec/unit/settings/value_translator_spec.rb +0 -1
  522. data/spec/unit/settings_spec.rb +228 -235
  523. data/spec/unit/ssl/base_spec.rb +14 -15
  524. data/spec/unit/ssl/certificate_request_spec.rb +62 -58
  525. data/spec/unit/ssl/certificate_spec.rb +23 -25
  526. data/spec/unit/ssl/digest_spec.rb +0 -1
  527. data/spec/unit/ssl/host_spec.rb +166 -149
  528. data/spec/unit/ssl/key_spec.rb +30 -31
  529. data/spec/unit/ssl/validator_spec.rb +38 -39
  530. data/spec/unit/task_spec.rb +44 -45
  531. data/spec/unit/transaction/additional_resource_generator_spec.rb +3 -5
  532. data/spec/unit/transaction/event_manager_spec.rb +87 -88
  533. data/spec/unit/transaction/event_spec.rb +16 -15
  534. data/spec/unit/transaction/persistence_spec.rb +16 -17
  535. data/spec/unit/transaction/report_spec.rb +11 -12
  536. data/spec/unit/transaction/resource_harness_spec.rb +28 -33
  537. data/spec/unit/transaction_spec.rb +100 -101
  538. data/spec/unit/type/component_spec.rb +0 -1
  539. data/spec/unit/type/exec_spec.rb +60 -56
  540. data/spec/unit/type/file/checksum_spec.rb +9 -10
  541. data/spec/unit/type/file/checksum_value_spec.rb +31 -32
  542. data/spec/unit/type/file/content_spec.rb +58 -61
  543. data/spec/unit/type/file/ctime_spec.rb +0 -1
  544. data/spec/unit/type/file/ensure_spec.rb +12 -13
  545. data/spec/unit/type/file/group_spec.rb +5 -7
  546. data/spec/unit/type/file/mode_spec.rb +4 -6
  547. data/spec/unit/type/file/mtime_spec.rb +0 -1
  548. data/spec/unit/type/file/owner_spec.rb +6 -8
  549. data/spec/unit/type/file/selinux_spec.rb +17 -19
  550. data/spec/unit/type/file/source_spec.rb +104 -101
  551. data/spec/unit/type/file/type_spec.rb +0 -1
  552. data/spec/unit/type/file_spec.rb +195 -185
  553. data/spec/unit/type/filebucket_spec.rb +4 -5
  554. data/spec/unit/type/group_spec.rb +6 -8
  555. data/spec/unit/type/noop_metaparam_spec.rb +1 -2
  556. data/spec/unit/type/package/package_settings_spec.rb +44 -23
  557. data/spec/unit/type/package_spec.rb +56 -57
  558. data/spec/unit/type/resources_spec.rb +72 -74
  559. data/spec/unit/type/schedule_spec.rb +24 -26
  560. data/spec/unit/type/service_spec.rb +48 -48
  561. data/spec/unit/type/stage_spec.rb +0 -1
  562. data/spec/unit/type/tidy_spec.rb +61 -62
  563. data/spec/unit/type/user_spec.rb +24 -25
  564. data/spec/unit/type/whit_spec.rb +0 -1
  565. data/spec/unit/type_spec.rb +55 -54
  566. data/spec/unit/util/at_fork_spec.rb +18 -19
  567. data/spec/unit/util/autoload_spec.rb +55 -56
  568. data/spec/unit/util/backups_spec.rb +34 -35
  569. data/spec/unit/util/character_encoding_spec.rb +5 -5
  570. data/spec/unit/util/checksums_spec.rb +38 -39
  571. data/spec/unit/util/colors_spec.rb +1 -2
  572. data/spec/unit/util/command_line_spec.rb +24 -25
  573. data/spec/unit/util/constant_inflector_spec.rb +0 -1
  574. data/spec/unit/util/diff_spec.rb +7 -8
  575. data/spec/unit/util/errors_spec.rb +0 -1
  576. data/spec/unit/util/execution_spec.rb +185 -161
  577. data/spec/unit/util/execution_stub_spec.rb +0 -1
  578. data/spec/unit/util/feature_spec.rb +21 -14
  579. data/spec/unit/util/filetype_spec.rb +49 -49
  580. data/spec/unit/util/http_proxy_spec.rb +12 -12
  581. data/spec/unit/util/inifile_spec.rb +26 -31
  582. data/spec/unit/util/json_lockfile_spec.rb +3 -5
  583. data/spec/unit/util/ldap/connection_spec.rb +26 -25
  584. data/spec/unit/util/ldap/generator_spec.rb +0 -1
  585. data/spec/unit/util/ldap/manager_spec.rb +102 -101
  586. data/spec/unit/util/lockfile_spec.rb +0 -1
  587. data/spec/unit/util/log/destinations_spec.rb +30 -33
  588. data/spec/unit/util/log_spec.rb +35 -36
  589. data/spec/unit/util/logging_spec.rb +58 -72
  590. data/spec/unit/util/metric_spec.rb +0 -1
  591. data/spec/unit/util/monkey_patches_spec.rb +7 -9
  592. data/spec/unit/util/multi_match_spec.rb +0 -1
  593. data/spec/unit/util/network_device/config_spec.rb +0 -1
  594. data/spec/unit/util/network_device/transport/base_spec.rb +5 -6
  595. data/spec/unit/util/network_device_spec.rb +7 -9
  596. data/spec/unit/util/package_spec.rb +0 -1
  597. data/spec/unit/util/pidlock_spec.rb +21 -22
  598. data/spec/unit/util/plist_spec.rb +40 -33
  599. data/spec/unit/util/posix_spec.rb +54 -51
  600. data/spec/unit/util/rdoc_spec.rb +9 -10
  601. data/spec/unit/util/reference_spec.rb +0 -1
  602. data/spec/unit/util/resource_template_spec.rb +20 -20
  603. data/spec/unit/util/retry_action_spec.rb +7 -8
  604. data/spec/unit/util/rubygems_spec.rb +7 -8
  605. data/spec/unit/util/run_mode_spec.rb +3 -4
  606. data/spec/unit/util/selinux_spec.rb +79 -72
  607. data/spec/unit/util/splayer_spec.rb +8 -9
  608. data/spec/unit/util/ssl_spec.rb +0 -1
  609. data/spec/unit/util/storage_spec.rb +3 -4
  610. data/spec/unit/util/suidmanager_spec.rb +45 -54
  611. data/spec/unit/util/symbolic_file_mode_spec.rb +0 -1
  612. data/spec/unit/util/tag_set_spec.rb +0 -1
  613. data/spec/unit/util/tagging_spec.rb +0 -1
  614. data/spec/unit/util/terminal_spec.rb +9 -10
  615. data/spec/unit/util/user_attr_spec.rb +1 -2
  616. data/spec/unit/util/warnings_spec.rb +3 -4
  617. data/spec/unit/util/watcher/periodic_watcher_spec.rb +2 -2
  618. data/spec/unit/util/watcher_spec.rb +51 -21
  619. data/spec/unit/util/windows/access_control_entry_spec.rb +0 -1
  620. data/spec/unit/util/windows/access_control_list_spec.rb +0 -1
  621. data/spec/unit/util/windows/adsi_spec.rb +136 -138
  622. data/spec/unit/util/windows/api_types_spec.rb +0 -1
  623. data/spec/unit/util/windows/eventlog_spec.rb +9 -12
  624. data/spec/unit/util/windows/file_spec.rb +0 -1
  625. data/spec/unit/util/windows/root_certs_spec.rb +0 -1
  626. data/spec/unit/util/windows/security_descriptor_spec.rb +0 -2
  627. data/spec/unit/util/windows/service_spec.rb +66 -68
  628. data/spec/unit/util/windows/sid_spec.rb +11 -13
  629. data/spec/unit/util/windows/string_spec.rb +0 -1
  630. data/spec/unit/util_spec.rb +55 -57
  631. data/spec/unit/version_spec.rb +6 -6
  632. metadata +2 -2
@@ -1,4 +1,3 @@
1
- #! /usr/bin/env ruby
2
1
  require 'spec_helper'
3
2
 
4
3
  describe Puppet::Type.type(:file).attrclass(:type) do
@@ -1,4 +1,3 @@
1
- #! /usr/bin/env ruby
2
1
  require 'spec_helper'
3
2
 
4
3
  describe Puppet::Type.type(:file) do
@@ -10,7 +9,7 @@ describe Puppet::Type.type(:file) do
10
9
  let(:catalog) { Puppet::Resource::Catalog.new }
11
10
 
12
11
  before do
13
- Puppet.features.stubs("posix?").returns(true)
12
+ allow(Puppet.features).to receive("posix?").and_return(true)
14
13
  end
15
14
 
16
15
  describe "the path parameter" do
@@ -211,8 +210,8 @@ describe Puppet::Type.type(:file) do
211
210
 
212
211
  it "should return the default filebucket if using the 'puppet' filebucket" do
213
212
  file[:backup] = 'puppet'
214
- bucket = stub('bucket')
215
- file.stubs(:default_bucket).returns bucket
213
+ bucket = double('bucket')
214
+ allow(file).to receive(:default_bucket).and_return(bucket)
216
215
 
217
216
  expect(file.bucket).to eq(bucket)
218
217
  end
@@ -243,19 +242,19 @@ describe Puppet::Type.type(:file) do
243
242
  before :each do
244
243
  # Mocha won't let me just stub SUIDManager.asuser to yield and return,
245
244
  # but it will do exactly that if we're not root.
246
- Puppet::Util::SUIDManager.stubs(:root?).returns false
245
+ allow(Puppet::Util::SUIDManager).to receive(:root?).and_return(false)
247
246
  end
248
247
 
249
248
  it "should return the desired owner if they can write to the parent directory" do
250
249
  file[:owner] = 1001
251
- FileTest.stubs(:writable?).with(File.dirname file[:path]).returns true
250
+ allow(FileTest).to receive(:writable?).with(File.dirname file[:path]).and_return(true)
252
251
 
253
252
  expect(file.asuser).to eq(1001)
254
253
  end
255
254
 
256
255
  it "should return nil if the desired owner can't write to the parent directory" do
257
256
  file[:owner] = 1001
258
- FileTest.stubs(:writable?).with(File.dirname file[:path]).returns false
257
+ allow(FileTest).to receive(:writable?).with(File.dirname file[:path]).and_return(false)
259
258
 
260
259
  expect(file.asuser).to eq(nil)
261
260
  end
@@ -267,25 +266,25 @@ describe Puppet::Type.type(:file) do
267
266
 
268
267
  describe "#exist?" do
269
268
  it "should be considered existent if it can be stat'ed" do
270
- file.expects(:stat).returns mock('stat')
269
+ expect(file).to receive(:stat).and_return(double('stat'))
271
270
  expect(file).to be_exist
272
271
  end
273
272
 
274
273
  it "should be considered nonexistent if it can not be stat'ed" do
275
- file.expects(:stat).returns nil
274
+ expect(file).to receive(:stat).and_return(nil)
276
275
  expect(file).to_not be_exist
277
276
  end
278
277
  end
279
278
 
280
279
  describe "#eval_generate" do
281
280
  before do
282
- @graph = stub 'graph', :add_edge => nil
283
- catalog.stubs(:relationship_graph).returns @graph
281
+ @graph = double('graph', :add_edge => nil)
282
+ allow(catalog).to receive(:relationship_graph).and_return(@graph)
284
283
  end
285
284
 
286
285
  it "should recurse if recursion is enabled" do
287
- resource = stub('resource', :[] => 'resource')
288
- file.expects(:recurse).returns [resource]
286
+ resource = double('resource', :[] => 'resource')
287
+ expect(file).to receive(:recurse).and_return([resource])
289
288
 
290
289
  file[:recurse] = true
291
290
 
@@ -293,7 +292,7 @@ describe Puppet::Type.type(:file) do
293
292
  end
294
293
 
295
294
  it "should not recurse if recursion is disabled" do
296
- file.expects(:recurse).never
295
+ expect(file).not_to receive(:recurse)
297
296
 
298
297
  file[:recurse] = false
299
298
 
@@ -319,7 +318,7 @@ describe Puppet::Type.type(:file) do
319
318
  describe "#flush" do
320
319
  it "should flush all properties that respond to :flush" do
321
320
  file[:source] = File.expand_path(__FILE__)
322
- file.parameter(:source).expects(:flush)
321
+ expect(file.parameter(:source)).to receive(:flush)
323
322
  file.flush
324
323
  end
325
324
 
@@ -447,12 +446,14 @@ describe Puppet::Type.type(:file) do
447
446
  it "should not copy values to the child which were set by the source" do
448
447
  source = File.expand_path(__FILE__)
449
448
  file[:source] = source
450
- metadata = stub 'metadata', :owner => "root", :group => "root", :mode => '0755', :ftype => "file", :checksum => "{md5}whatever", :checksum_type => "md5", :source => source
451
- file.parameter(:source).stubs(:metadata).returns metadata
449
+ metadata = double('metadata', :owner => "root", :group => "root", :mode => '0755', :ftype => "file", :checksum => "{md5}whatever", :checksum_type => "md5", :source => source)
450
+ allow(file.parameter(:source)).to receive(:metadata).and_return(metadata)
452
451
 
453
452
  file.parameter(:source).copy_source_values
454
453
 
455
- file.class.expects(:new).with { |params| params[:group].nil? }
454
+ expect(file.class).to receive(:new) do |arg|
455
+ expect(arg[:group]).to be_nil
456
+ end
456
457
  file.newchild("my/path")
457
458
  end
458
459
  end
@@ -484,8 +485,8 @@ describe Puppet::Type.type(:file) do
484
485
  describe "and a source is set" do
485
486
  it "should pass the already-discovered resources to recurse_remote" do
486
487
  file[:source] = File.expand_path(__FILE__)
487
- file.stubs(:recurse_local).returns(:foo => "bar")
488
- file.expects(:recurse_remote).with(:foo => "bar").returns []
488
+ allow(file).to receive(:recurse_local).and_return(:foo => "bar")
489
+ expect(file).to receive(:recurse_remote).with(:foo => "bar").and_return([])
489
490
  file.recurse
490
491
  end
491
492
  end
@@ -493,28 +494,28 @@ describe Puppet::Type.type(:file) do
493
494
  describe "and a target is set" do
494
495
  it "should use recurse_link" do
495
496
  file[:target] = File.expand_path(__FILE__)
496
- file.stubs(:recurse_local).returns(:foo => "bar")
497
- file.expects(:recurse_link).with(:foo => "bar").returns []
497
+ allow(file).to receive(:recurse_local).and_return(:foo => "bar")
498
+ expect(file).to receive(:recurse_link).with(:foo => "bar").and_return([])
498
499
  file.recurse
499
500
  end
500
501
  end
501
502
 
502
503
  it "should use recurse_local if recurse is not remote" do
503
- file.expects(:recurse_local).returns({})
504
+ expect(file).to receive(:recurse_local).and_return({})
504
505
  file.recurse
505
506
  end
506
507
 
507
508
  it "should not use recurse_local if recurse is remote" do
508
509
  file[:recurse] = :remote
509
- file.expects(:recurse_local).never
510
+ expect(file).not_to receive(:recurse_local)
510
511
  file.recurse
511
512
  end
512
513
 
513
514
  it "should return the generated resources as an array sorted by file path" do
514
- one = stub 'one', :[] => "/one"
515
- two = stub 'two', :[] => "/one/two"
516
- three = stub 'three', :[] => "/three"
517
- file.expects(:recurse_local).returns(:one => one, :two => two, :three => three)
515
+ one = double('one', :[] => "/one")
516
+ two = double('two', :[] => "/one/two")
517
+ three = double('three', :[] => "/three")
518
+ expect(file).to receive(:recurse_local).and_return(:one => one, :two => two, :three => three)
518
519
  expect(file.recurse).to eq([one, two, three])
519
520
  end
520
521
 
@@ -525,19 +526,20 @@ describe Puppet::Type.type(:file) do
525
526
 
526
527
  it "should mark each file for removal" do
527
528
  local = described_class.new(:path => path, :ensure => :present)
528
- file.expects(:recurse_local).returns("local" => local)
529
+ expect(file).to receive(:recurse_local).and_return("local" => local)
529
530
 
530
531
  file.recurse
531
532
  expect(local[:ensure]).to eq(:absent)
532
533
  end
533
534
 
534
535
  it "should not remove files that exist in the remote repository" do
536
+ pending("FIXME: This test has been broken since it was introduced in c189b46e3f1 because of = vs ==")
535
537
  file[:source] = File.expand_path(__FILE__)
536
- file.expects(:recurse_local).returns({})
538
+ expect(file).to receive(:recurse_local).and_return({})
537
539
 
538
540
  remote = described_class.new(:path => path, :source => File.expand_path(__FILE__), :ensure => :present)
539
541
 
540
- file.expects(:recurse_remote).with { |hash| hash["remote"] = remote }
542
+ expect(file).to receive(:recurse_remote).with(hash_including("remote" => remote))
541
543
 
542
544
  file.recurse
543
545
 
@@ -580,42 +582,42 @@ describe Puppet::Type.type(:file) do
580
582
 
581
583
  describe "#recurse_link" do
582
584
  before do
583
- @first = stub 'first', :relative_path => "first", :full_path => "/my/first", :ftype => "directory"
584
- @second = stub 'second', :relative_path => "second", :full_path => "/my/second", :ftype => "file"
585
+ @first = double('first', :relative_path => "first", :full_path => "/my/first", :ftype => "directory")
586
+ @second = double('second', :relative_path => "second", :full_path => "/my/second", :ftype => "file")
585
587
 
586
- @resource = stub 'file', :[]= => nil
588
+ @resource = double('file', :[]= => nil)
587
589
  end
588
590
 
589
591
  it "should pass its target to the :perform_recursion method" do
590
592
  file[:target] = "mylinks"
591
- file.expects(:perform_recursion).with("mylinks").returns [@first]
592
- file.stubs(:newchild).returns @resource
593
+ expect(file).to receive(:perform_recursion).with("mylinks").and_return([@first])
594
+ allow(file).to receive(:newchild).and_return(@resource)
593
595
  file.recurse_link({})
594
596
  end
595
597
 
596
598
  it "should ignore the recursively-found '.' file and configure the top-level file to create a directory" do
597
- @first.stubs(:relative_path).returns "."
599
+ allow(@first).to receive(:relative_path).and_return(".")
598
600
  file[:target] = "mylinks"
599
- file.expects(:perform_recursion).with("mylinks").returns [@first]
600
- file.stubs(:newchild).never
601
- file.expects(:[]=).with(:ensure, :directory)
601
+ expect(file).to receive(:perform_recursion).with("mylinks").and_return([@first])
602
+ expect(file).not_to receive(:newchild)
603
+ expect(file).to receive(:[]=).with(:ensure, :directory)
602
604
  file.recurse_link({})
603
605
  end
604
606
 
605
607
  it "should create a new child resource for each generated metadata instance's relative path that doesn't already exist in the children hash" do
606
- file.expects(:perform_recursion).returns [@first, @second]
607
- file.expects(:newchild).with(@first.relative_path).returns @resource
608
+ expect(file).to receive(:perform_recursion).and_return([@first, @second])
609
+ expect(file).to receive(:newchild).with(@first.relative_path).and_return(@resource)
608
610
  file.recurse_link("second" => @resource)
609
611
  end
610
612
 
611
613
  it "should not create a new child resource for paths that already exist in the children hash" do
612
- file.expects(:perform_recursion).returns [@first]
613
- file.expects(:newchild).never
614
+ expect(file).to receive(:perform_recursion).and_return([@first])
615
+ expect(file).not_to receive(:newchild)
614
616
  file.recurse_link("first" => @resource)
615
617
  end
616
618
 
617
619
  it "should set the target to the full path of discovered file and set :ensure to :link if the file is not a directory", :if => described_class.defaultprovider.feature?(:manages_symlinks) do
618
- file.stubs(:perform_recursion).returns [@first, @second]
620
+ allow(file).to receive(:perform_recursion).and_return([@first, @second])
619
621
  file.recurse_link("first" => @resource, "second" => file)
620
622
 
621
623
  expect(file[:ensure]).to eq(:link)
@@ -623,59 +625,59 @@ describe Puppet::Type.type(:file) do
623
625
  end
624
626
 
625
627
  it "should :ensure to :directory if the file is a directory" do
626
- file.stubs(:perform_recursion).returns [@first, @second]
628
+ allow(file).to receive(:perform_recursion).and_return([@first, @second])
627
629
  file.recurse_link("first" => file, "second" => @resource)
628
630
 
629
631
  expect(file[:ensure]).to eq(:directory)
630
632
  end
631
633
 
632
634
  it "should return a hash with both created and existing resources with the relative paths as the hash keys" do
633
- file.expects(:perform_recursion).returns [@first, @second]
634
- file.stubs(:newchild).returns file
635
+ expect(file).to receive(:perform_recursion).and_return([@first, @second])
636
+ allow(file).to receive(:newchild).and_return(file)
635
637
  expect(file.recurse_link("second" => @resource)).to eq({"second" => @resource, "first" => file})
636
638
  end
637
639
  end
638
640
 
639
641
  describe "#recurse_local" do
640
642
  before do
641
- @metadata = stub 'metadata', :relative_path => "my/file"
643
+ @metadata = double('metadata', :relative_path => "my/file")
642
644
  end
643
645
 
644
646
  it "should pass its path to the :perform_recursion method" do
645
- file.expects(:perform_recursion).with(file[:path]).returns [@metadata]
646
- file.stubs(:newchild)
647
+ expect(file).to receive(:perform_recursion).with(file[:path]).and_return([@metadata])
648
+ allow(file).to receive(:newchild)
647
649
  file.recurse_local
648
650
  end
649
651
 
650
652
  it "should return an empty hash if the recursion returns nothing" do
651
- file.expects(:perform_recursion).returns nil
653
+ expect(file).to receive(:perform_recursion).and_return(nil)
652
654
  expect(file.recurse_local).to eq({})
653
655
  end
654
656
 
655
657
  it "should create a new child resource with each generated metadata instance's relative path" do
656
- file.expects(:perform_recursion).returns [@metadata]
657
- file.expects(:newchild).with(@metadata.relative_path).returns "fiebar"
658
+ expect(file).to receive(:perform_recursion).and_return([@metadata])
659
+ expect(file).to receive(:newchild).with(@metadata.relative_path).and_return("fiebar")
658
660
  file.recurse_local
659
661
  end
660
662
 
661
663
  it "should not create a new child resource for the '.' directory" do
662
- @metadata.stubs(:relative_path).returns "."
664
+ allow(@metadata).to receive(:relative_path).and_return(".")
663
665
 
664
- file.expects(:perform_recursion).returns [@metadata]
665
- file.expects(:newchild).never
666
+ expect(file).to receive(:perform_recursion).and_return([@metadata])
667
+ expect(file).not_to receive(:newchild)
666
668
  file.recurse_local
667
669
  end
668
670
 
669
671
  it "should return a hash of the created resources with the relative paths as the hash keys" do
670
- file.expects(:perform_recursion).returns [@metadata]
671
- file.expects(:newchild).with("my/file").returns "fiebar"
672
+ expect(file).to receive(:perform_recursion).and_return([@metadata])
673
+ expect(file).to receive(:newchild).with("my/file").and_return("fiebar")
672
674
  expect(file.recurse_local).to eq({"my/file" => "fiebar"})
673
675
  end
674
676
 
675
677
  it "should set checksum_type to none if this file checksum is none" do
676
678
  file[:checksum] = :none
677
- Puppet::FileServing::Metadata.indirection.expects(:search).with { |path,params| params[:checksum_type] == :none }.returns [@metadata]
678
- file.expects(:newchild).with("my/file").returns "fiebar"
679
+ expect(Puppet::FileServing::Metadata.indirection).to receive(:search).with(anything, hash_including(checksum_type: :none)).and_return([@metadata])
680
+ expect(file).to receive(:newchild).with("my/file").and_return("fiebar")
679
681
  file.recurse_local
680
682
  end
681
683
  end
@@ -688,94 +690,94 @@ describe Puppet::Type.type(:file) do
688
690
 
689
691
  @first = Puppet::FileServing::Metadata.new(my, :relative_path => "first")
690
692
  @second = Puppet::FileServing::Metadata.new(my, :relative_path => "second")
691
- @first.stubs(:ftype).returns "directory"
692
- @second.stubs(:ftype).returns "directory"
693
+ allow(@first).to receive(:ftype).and_return("directory")
694
+ allow(@second).to receive(:ftype).and_return("directory")
693
695
 
694
- @parameter = stub 'property', :metadata= => nil
695
- @resource = stub 'file', :[]= => nil, :parameter => @parameter
696
+ @parameter = double('property', :metadata= => nil)
697
+ @resource = double('file', :[]= => nil, :parameter => @parameter)
696
698
  end
697
699
 
698
700
  it "should pass its source to the :perform_recursion method" do
699
701
  data = Puppet::FileServing::Metadata.new(File.expand_path("/whatever"), :relative_path => "foobar")
700
- file.expects(:perform_recursion).with("puppet://foo/bar").returns [data]
701
- file.stubs(:newchild).returns @resource
702
+ expect(file).to receive(:perform_recursion).with("puppet://foo/bar").and_return([data])
703
+ allow(file).to receive(:newchild).and_return(@resource)
702
704
  file.recurse_remote({})
703
705
  end
704
706
 
705
707
  it "should not recurse when the remote file is not a directory" do
706
708
  data = Puppet::FileServing::Metadata.new(File.expand_path("/whatever"), :relative_path => ".")
707
- data.stubs(:ftype).returns "file"
708
- file.expects(:perform_recursion).with("puppet://foo/bar").returns [data]
709
- file.expects(:newchild).never
709
+ allow(data).to receive(:ftype).and_return("file")
710
+ expect(file).to receive(:perform_recursion).with("puppet://foo/bar").and_return([data])
711
+ expect(file).not_to receive(:newchild)
710
712
  file.recurse_remote({})
711
713
  end
712
714
 
713
715
  it "should set the source of each returned file to the searched-for URI plus the found relative path" do
714
- @first.expects(:source=).with File.join("puppet://foo/bar", @first.relative_path)
715
- file.expects(:perform_recursion).returns [@first]
716
- file.stubs(:newchild).returns @resource
716
+ expect(@first).to receive(:source=).with(File.join("puppet://foo/bar", @first.relative_path))
717
+ expect(file).to receive(:perform_recursion).and_return([@first])
718
+ allow(file).to receive(:newchild).and_return(@resource)
717
719
  file.recurse_remote({})
718
720
  end
719
721
 
720
722
  it "should create a new resource for any relative file paths that do not already have a resource" do
721
- file.stubs(:perform_recursion).returns [@first]
722
- file.expects(:newchild).with("first").returns @resource
723
+ allow(file).to receive(:perform_recursion).and_return([@first])
724
+ expect(file).to receive(:newchild).with("first").and_return(@resource)
723
725
  expect(file.recurse_remote({})).to eq({"first" => @resource})
724
726
  end
725
727
 
726
728
  it "should not create a new resource for any relative file paths that do already have a resource" do
727
- file.stubs(:perform_recursion).returns [@first]
728
- file.expects(:newchild).never
729
+ allow(file).to receive(:perform_recursion).and_return([@first])
730
+ expect(file).not_to receive(:newchild)
729
731
  file.recurse_remote("first" => @resource)
730
732
  end
731
733
 
732
734
  it "should set the source of each resource to the source of the metadata" do
733
- file.stubs(:perform_recursion).returns [@first]
734
- @resource.stubs(:[]=)
735
- @resource.expects(:[]=).with(:source, File.join("puppet://foo/bar", @first.relative_path))
735
+ allow(file).to receive(:perform_recursion).and_return([@first])
736
+ allow(@resource).to receive(:[]=)
737
+ expect(@resource).to receive(:[]=).with(:source, File.join("puppet://foo/bar", @first.relative_path))
736
738
  file.recurse_remote("first" => @resource)
737
739
  end
738
740
 
739
741
  it "should set the checksum parameter based on the metadata" do
740
- file.stubs(:perform_recursion).returns [@first]
741
- @resource.stubs(:[]=)
742
- @resource.expects(:[]=).with(:checksum, "md5")
742
+ allow(file).to receive(:perform_recursion).and_return([@first])
743
+ allow(@resource).to receive(:[]=)
744
+ expect(@resource).to receive(:[]=).with(:checksum, "md5")
743
745
  file.recurse_remote("first" => @resource)
744
746
  end
745
747
 
746
748
  it "should store the metadata in the source property for each resource so the source does not have to requery the metadata" do
747
- file.stubs(:perform_recursion).returns [@first]
748
- @resource.expects(:parameter).with(:source).returns @parameter
749
+ allow(file).to receive(:perform_recursion).and_return([@first])
750
+ expect(@resource).to receive(:parameter).with(:source).and_return(@parameter)
749
751
 
750
- @parameter.expects(:metadata=).with(@first)
752
+ expect(@parameter).to receive(:metadata=).with(@first)
751
753
 
752
754
  file.recurse_remote("first" => @resource)
753
755
  end
754
756
 
755
757
  it "should not create a new resource for the '.' file" do
756
- @first.stubs(:relative_path).returns "."
757
- file.stubs(:perform_recursion).returns [@first]
758
+ allow(@first).to receive(:relative_path).and_return(".")
759
+ allow(file).to receive(:perform_recursion).and_return([@first])
758
760
 
759
- file.expects(:newchild).never
761
+ expect(file).not_to receive(:newchild)
760
762
 
761
763
  file.recurse_remote({})
762
764
  end
763
765
 
764
766
  it "should store the metadata in the main file's source property if the relative path is '.'" do
765
- @first.stubs(:relative_path).returns "."
766
- file.stubs(:perform_recursion).returns [@first]
767
+ allow(@first).to receive(:relative_path).and_return(".")
768
+ allow(file).to receive(:perform_recursion).and_return([@first])
767
769
 
768
- file.parameter(:source).expects(:metadata=).with @first
770
+ expect(file.parameter(:source)).to receive(:metadata=).with(@first)
769
771
 
770
772
  file.recurse_remote("first" => @resource)
771
773
  end
772
774
 
773
775
  it "should update the main file's checksum parameter if the relative path is '.'" do
774
- @first.stubs(:relative_path).returns "."
775
- file.stubs(:perform_recursion).returns [@first]
776
+ allow(@first).to receive(:relative_path).and_return(".")
777
+ allow(file).to receive(:perform_recursion).and_return([@first])
776
778
 
777
- file.stubs(:[]=)
778
- file.expects(:[]=).with(:checksum, "md5")
779
+ allow(file).to receive(:[]=)
780
+ expect(file). to receive(:[]=).with(:checksum, "md5")
779
781
 
780
782
  file.recurse_remote("first" => @resource)
781
783
  end
@@ -793,11 +795,11 @@ describe Puppet::Type.type(:file) do
793
795
  it "should create file instances for the results for the first source to return any values" do
794
796
  data = Puppet::FileServing::Metadata.new(File.expand_path("/whatever"), :relative_path => "foobar")
795
797
  file[:source] = sources.keys.sort.map { |key| File.expand_path(key) }
796
- file.expects(:perform_recursion).with(sources['/a']).returns nil
797
- file.expects(:perform_recursion).with(sources['/b']).returns []
798
- file.expects(:perform_recursion).with(sources['/c']).returns [data]
799
- file.expects(:perform_recursion).with(sources['/d']).never
800
- file.expects(:newchild).with("foobar").returns @resource
798
+ expect(file).to receive(:perform_recursion).with(sources['/a']).and_return(nil)
799
+ expect(file).to receive(:perform_recursion).with(sources['/b']).and_return([])
800
+ expect(file).to receive(:perform_recursion).with(sources['/c']).and_return([data])
801
+ expect(file).not_to receive(:perform_recursion).with(sources['/d'])
802
+ expect(file).to receive(:newchild).with("foobar").and_return(@resource)
801
803
  file.recurse_remote({})
802
804
  end
803
805
  end
@@ -811,21 +813,20 @@ describe Puppet::Type.type(:file) do
811
813
  klass = Puppet::FileServing::Metadata
812
814
 
813
815
  file[:source] = abs_path = %w{/a /b /c /d}.map {|f| File.expand_path(f) }
814
- file.stubs(:newchild).returns @resource
816
+ allow(file).to receive(:newchild).and_return(@resource)
815
817
 
816
818
  one = [klass.new(abs_path[0], :relative_path => "a")]
817
- file.expects(:perform_recursion).with(sources['/a']).returns one
818
- file.expects(:newchild).with("a").returns @resource
819
+ expect(file).to receive(:perform_recursion).with(sources['/a']).and_return(one)
820
+ expect(file).to receive(:newchild).with("a").and_return(@resource)
819
821
 
820
822
  two = [klass.new(abs_path[1], :relative_path => "a"), klass.new(abs_path[1], :relative_path => "b")]
821
- file.expects(:perform_recursion).with(sources['/b']).returns two
822
- file.expects(:newchild).with("b").returns @resource
823
+ expect(file).to receive(:perform_recursion).with(sources['/b']).and_return(two)
824
+ expect(file).to receive(:newchild).with("b").and_return(@resource)
823
825
 
824
826
  three = [klass.new(abs_path[2], :relative_path => "a"), klass.new(abs_path[2], :relative_path => "c")]
825
- file.expects(:perform_recursion).with(sources['/c']).returns three
826
- file.expects(:newchild).with("c").returns @resource
827
-
828
- file.expects(:perform_recursion).with(sources['/d']).returns []
827
+ expect(file).to receive(:perform_recursion).with(sources['/c']).and_return(three)
828
+ expect(file).to receive(:newchild).with("c").and_return(@resource)
829
+ expect(file).to receive(:perform_recursion).with(sources['/d']).and_return([])
829
830
 
830
831
  file.recurse_remote({})
831
832
  end
@@ -835,54 +836,54 @@ describe Puppet::Type.type(:file) do
835
836
 
836
837
  describe "#perform_recursion", :uses_checksums => true do
837
838
  it "should use Metadata to do its recursion" do
838
- Puppet::FileServing::Metadata.indirection.expects(:search)
839
+ expect(Puppet::FileServing::Metadata.indirection).to receive(:search)
839
840
  file.perform_recursion(file[:path])
840
841
  end
841
842
 
842
843
  it "should use the provided path as the key to the search" do
843
- Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| key == "/foo" }
844
+ expect(Puppet::FileServing::Metadata.indirection).to receive(:search).with("/foo", anything)
844
845
  file.perform_recursion("/foo")
845
846
  end
846
847
 
847
848
  it "should return the results of the metadata search" do
848
- Puppet::FileServing::Metadata.indirection.expects(:search).returns "foobar"
849
+ expect(Puppet::FileServing::Metadata.indirection).to receive(:search).and_return("foobar")
849
850
  expect(file.perform_recursion(file[:path])).to eq("foobar")
850
851
  end
851
852
 
852
853
  it "should pass its recursion value to the search" do
853
854
  file[:recurse] = true
854
- Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| options[:recurse] == true }
855
+ expect(Puppet::FileServing::Metadata.indirection).to receive(:search).with(anything, hash_including(recurse: true))
855
856
  file.perform_recursion(file[:path])
856
857
  end
857
858
 
858
859
  it "should pass true if recursion is remote" do
859
860
  file[:recurse] = :remote
860
- Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| options[:recurse] == true }
861
+ expect(Puppet::FileServing::Metadata.indirection).to receive(:search).with(anything, hash_including(recurse: true))
861
862
  file.perform_recursion(file[:path])
862
863
  end
863
864
 
864
865
  it "should pass its recursion limit value to the search" do
865
866
  file[:recurselimit] = 10
866
- Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| options[:recurselimit] == 10 }
867
+ expect(Puppet::FileServing::Metadata.indirection).to receive(:search).with(anything, hash_including(recurselimit: 10))
867
868
  file.perform_recursion(file[:path])
868
869
  end
869
870
 
870
871
  it "should configure the search to ignore or manage links" do
871
872
  file[:links] = :manage
872
- Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| options[:links] == :manage }
873
+ expect(Puppet::FileServing::Metadata.indirection).to receive(:search).with(anything, hash_including(links: :manage))
873
874
  file.perform_recursion(file[:path])
874
875
  end
875
876
 
876
877
  it "should pass its 'ignore' setting to the search if it has one" do
877
878
  file[:ignore] = %w{.svn CVS}
878
- Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| options[:ignore] == %w{.svn CVS} }
879
+ expect(Puppet::FileServing::Metadata.indirection).to receive(:search).with(anything, hash_including(ignore: %w{.svn CVS}))
879
880
  file.perform_recursion(file[:path])
880
881
  end
881
882
 
882
883
  with_digest_algorithms do
883
884
  it "it should pass its 'checksum' setting #{metadata[:digest_algorithm]} to the search" do
884
885
  file[:source] = File.expand_path('/foo')
885
- Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| options[:checksum_type] == digest_algorithm.intern }
886
+ expect(Puppet::FileServing::Metadata.indirection).to receive(:search).with(anything, hash_including(checksum_type: digest_algorithm.intern))
886
887
  file.perform_recursion(file[:path])
887
888
  end
888
889
  end
@@ -895,8 +896,8 @@ describe Puppet::Type.type(:file) do
895
896
 
896
897
  it "should fail if it can't backup the file" do
897
898
  # Default: file[:backup] = true
898
- file.stubs(:stat).returns stub('stat', :ftype => 'file')
899
- file.stubs(:perform_backup).returns false
899
+ allow(file).to receive(:stat).and_return(double('stat', :ftype => 'file'))
900
+ allow(file).to receive(:perform_backup).and_return(false)
900
901
 
901
902
  expect { file.remove_existing(:file) }.to raise_error(Puppet::Error, /Could not back up; will not remove/)
902
903
  end
@@ -905,27 +906,27 @@ describe Puppet::Type.type(:file) do
905
906
  it "should not backup directories if backup is true and force is false" do
906
907
  # Default: file[:backup] = true
907
908
  file[:force] = false
908
- file.stubs(:stat).returns stub('stat', :ftype => 'directory')
909
+ allow(file).to receive(:stat).and_return(double('stat', :ftype => 'directory'))
909
910
 
910
- file.expects(:perform_backup).never
911
- file.expects(:warning).with("Could not back up file of type directory")
911
+ expect(file).not_to receive(:perform_backup)
912
+ expect(file).to receive(:warning).with("Could not back up file of type directory")
912
913
  expect(file.remove_existing(:file)).to eq(false)
913
914
  end
914
915
 
915
916
  it "should backup directories if backup is true and force is true" do
916
917
  # Default: file[:backup] = true
917
918
  file[:force] = true
918
- file.stubs(:stat).returns stub('stat', :ftype => 'directory')
919
+ allow(file).to receive(:stat).and_return(double('stat', :ftype => 'directory'))
919
920
 
920
- FileUtils.expects(:rmtree).with(file[:path])
921
- file.expects(:perform_backup).returns(true)
921
+ expect(FileUtils).to receive(:rmtree).with(file[:path])
922
+ expect(file).to receive(:perform_backup).and_return(true)
922
923
 
923
924
  expect(file.remove_existing(:file)).to eq(true)
924
925
  end
925
926
  end
926
927
 
927
928
  it "should not do anything if the file is already the right type and not a link" do
928
- file.stubs(:stat).returns stub('stat', :ftype => 'file')
929
+ allow(file).to receive(:stat).and_return(double('stat', :ftype => 'file'))
929
930
 
930
931
  expect(file.remove_existing(:file)).to eq(false)
931
932
  end
@@ -934,7 +935,7 @@ describe Puppet::Type.type(:file) do
934
935
  file[:force] = false
935
936
  # Actually call stat to set @needs_stat to nil
936
937
  file.stat
937
- file.stubs(:stat).returns stub('stat', :ftype => 'directory')
938
+ allow(file).to receive(:stat).and_return(double('stat', :ftype => 'directory'))
938
939
 
939
940
  expect(file.instance_variable_get(:@stat)).to eq(nil)
940
941
  end
@@ -942,15 +943,15 @@ describe Puppet::Type.type(:file) do
942
943
  it "should remove a directory if backup is true and force is true" do
943
944
  # Default: file[:backup] = true
944
945
  file[:force] = true
945
- file.stubs(:stat).returns stub('stat', :ftype => 'directory')
946
+ allow(file).to receive(:stat).and_return(double('stat', :ftype => 'directory'))
946
947
 
947
- FileUtils.expects(:rmtree).with(file[:path])
948
+ expect(FileUtils).to receive(:rmtree).with(file[:path])
948
949
 
949
950
  expect(file.remove_existing(:file)).to eq(true)
950
951
  end
951
952
 
952
953
  it "should remove an existing file" do
953
- file.stubs(:perform_backup).returns true
954
+ allow(file).to receive(:perform_backup).and_return(true)
954
955
  FileUtils.touch(path)
955
956
 
956
957
  expect(file.remove_existing(:directory)).to eq(true)
@@ -959,7 +960,7 @@ describe Puppet::Type.type(:file) do
959
960
  end
960
961
 
961
962
  it "should remove an existing link", :if => described_class.defaultprovider.feature?(:manages_symlinks) do
962
- file.stubs(:perform_backup).returns true
963
+ allow(file).to receive(:perform_backup).and_return(true)
963
964
 
964
965
  target = tmpfile('link_target')
965
966
  FileUtils.touch(target)
@@ -972,18 +973,18 @@ describe Puppet::Type.type(:file) do
972
973
  end
973
974
 
974
975
  it "should fail if the file is not a directory, link, file, fifo, socket, or is unknown" do
975
- file.stubs(:stat).returns stub('stat', :ftype => 'blockSpecial')
976
+ allow(file).to receive(:stat).and_return(double('stat', :ftype => 'blockSpecial'))
976
977
 
977
- file.expects(:warning).with("Could not back up file of type blockSpecial")
978
+ expect(file).to receive(:warning).with("Could not back up file of type blockSpecial")
978
979
  expect { file.remove_existing(:file) }.to raise_error(Puppet::Error, /Could not remove files of type blockSpecial/)
979
980
  end
980
981
 
981
982
  it "should invalidate the existing stat of the file" do
982
983
  # Actually call stat to set @needs_stat to nil
983
984
  file.stat
984
- file.stubs(:stat).returns stub('stat', :ftype => 'file')
985
+ allow(file).to receive(:stat).and_return(double('stat', :ftype => 'file'))
985
986
 
986
- Puppet::FileSystem.stubs(:unlink)
987
+ allow(Puppet::FileSystem).to receive(:unlink)
987
988
 
988
989
  expect(file.remove_existing(:directory)).to eq(true)
989
990
  expect(file.instance_variable_get(:@stat)).to eq(:needs_stat)
@@ -993,7 +994,7 @@ describe Puppet::Type.type(:file) do
993
994
  describe "#retrieve" do
994
995
  it "should copy the source values if the 'source' parameter is set" do
995
996
  file[:source] = File.expand_path('/foo/bar')
996
- file.parameter(:source).expects(:copy_source_values)
997
+ expect(file.parameter(:source)).to receive(:copy_source_values)
997
998
  file.retrieve
998
999
  end
999
1000
  end
@@ -1009,7 +1010,7 @@ describe Puppet::Type.type(:file) do
1009
1010
  end
1010
1011
 
1011
1012
  it "should be a file if :ensure is set to :present and the file exists as a normal file" do
1012
- file.stubs(:stat).returns(mock('stat', :ftype => "file"))
1013
+ allow(file).to receive(:stat).and_return(double('stat', :ftype => "file"))
1013
1014
  file[:ensure] = :present
1014
1015
  expect(file).to be_should_be_file
1015
1016
  end
@@ -1020,7 +1021,7 @@ describe Puppet::Type.type(:file) do
1020
1021
  end
1021
1022
 
1022
1023
  it "should not be a file if :ensure is set to :present and the file exists but is not a normal file" do
1023
- file.stubs(:stat).returns(mock('stat', :ftype => "directory"))
1024
+ allow(file).to receive(:stat).and_return(double('stat', :ftype => "directory"))
1024
1025
  file[:ensure] = :present
1025
1026
  expect(file).to_not be_should_be_file
1026
1027
  end
@@ -1031,12 +1032,12 @@ describe Puppet::Type.type(:file) do
1031
1032
  end
1032
1033
 
1033
1034
  it "should be a file if neither :ensure nor :content is set but the file exists as a normal file" do
1034
- file.stubs(:stat).returns(mock("stat", :ftype => "file"))
1035
+ allow(file).to receive(:stat).and_return(double("stat", :ftype => "file"))
1035
1036
  expect(file).to be_should_be_file
1036
1037
  end
1037
1038
 
1038
1039
  it "should not be a file if neither :ensure nor :content is set but the file exists but not as a normal file" do
1039
- file.stubs(:stat).returns(mock("stat", :ftype => "directory"))
1040
+ allow(file).to receive(:stat).and_return(double("stat", :ftype => "directory"))
1040
1041
  expect(file).to_not be_should_be_file
1041
1042
  end
1042
1043
  end
@@ -1103,73 +1104,80 @@ describe Puppet::Type.type(:file) do
1103
1104
 
1104
1105
  describe "#write" do
1105
1106
  describe "when validating the checksum" do
1106
- before { file.stubs(:validate_checksum?).returns(true) }
1107
+ before { allow(file).to receive(:validate_checksum?).and_return(true) }
1107
1108
 
1108
1109
  it "should fail if the checksum parameter and content checksums do not match" do
1109
- checksum = stub('checksum_parameter', :sum => 'checksum_b', :sum_file => 'checksum_b')
1110
- file.stubs(:parameter).with(:checksum).returns(checksum)
1111
- file.stubs(:parameter).with(:source).returns(nil)
1110
+ checksum = double('checksum_parameter', :sum => 'checksum_b', :sum_file => 'checksum_b')
1111
+ allow(file).to receive(:parameter).with(:checksum).and_return(checksum)
1112
+ allow(file).to receive(:parameter).with(:source).and_return(nil)
1112
1113
 
1113
1114
 
1114
- property = stub('content_property', :actual_content => "something", :length => "something".length, :write => 'checksum_a')
1115
- file.stubs(:property).with(:content).returns(property)
1115
+ property = double('content_property', :actual_content => "something", :length => "something".length, :write => 'checksum_a')
1116
+ allow(file).to receive(:property).with(:content).and_return(property)
1116
1117
 
1117
- expect { file.write property }.to raise_error(Puppet::Error)
1118
- end
1118
+ expect { file.write property }.to raise_error(Puppet::Error) end
1119
1119
  end
1120
1120
 
1121
1121
  describe "when not validating the checksum" do
1122
- before { file.stubs(:validate_checksum?).returns(false) }
1122
+ before do
1123
+ allow(file).to receive(:validate_checksum?).and_return(false)
1124
+ end
1123
1125
 
1124
1126
  it "should not fail if the checksum property and content checksums do not match" do
1125
- checksum = stub('checksum_parameter', :sum => 'checksum_b')
1126
- file.stubs(:parameter).with(:checksum).returns(checksum)
1127
- file.stubs(:parameter).with(:source).returns(nil)
1127
+ checksum = double('checksum_parameter', :sum => 'checksum_b')
1128
+ allow(file).to receive(:parameter).with(:checksum).and_return(checksum)
1129
+ allow(file).to receive(:parameter).with(:source).and_return(nil)
1128
1130
 
1129
- property = stub('content_property', :actual_content => "something", :length => "something".length, :write => 'checksum_a')
1130
- file.stubs(:property).with(:content).returns(property)
1131
+ property = double('content_property', :actual_content => "something", :length => "something".length, :write => 'checksum_a')
1132
+ allow(file).to receive(:property).with(:content).and_return(property)
1131
1133
 
1132
1134
  expect { file.write property }.to_not raise_error
1133
1135
  end
1134
1136
  end
1135
1137
 
1136
1138
  describe "when resource mode is supplied" do
1137
- before { file.stubs(:property_fix) }
1139
+ before do
1140
+ allow(file).to receive(:property_fix)
1141
+ end
1138
1142
 
1139
1143
  context "and writing temporary files" do
1140
- before { file.stubs(:write_temporary_file?).returns(true) }
1144
+ before do
1145
+ allow(file).to receive(:write_temporary_file?).and_return(true)
1146
+ end
1141
1147
 
1142
1148
  it "should convert symbolic mode to int" do
1143
1149
  file[:mode] = 'oga=r'
1144
- Puppet::Util.expects(:replace_file).with(file[:path], 0444)
1150
+ expect(Puppet::Util).to receive(:replace_file).with(file[:path], 0444)
1145
1151
  file.write
1146
1152
  end
1147
1153
 
1148
1154
  it "should support int modes" do
1149
1155
  file[:mode] = '0444'
1150
- Puppet::Util.expects(:replace_file).with(file[:path], 0444)
1156
+ expect(Puppet::Util).to receive(:replace_file).with(file[:path], 0444)
1151
1157
  file.write
1152
1158
  end
1153
1159
  end
1154
1160
 
1155
1161
  context "and not writing temporary files" do
1156
- before { file.stubs(:write_temporary_file?).returns(false) }
1162
+ before do
1163
+ allow(file).to receive(:write_temporary_file?).and_return(false)
1164
+ end
1157
1165
 
1158
1166
  it "should set a umask of 0" do
1159
1167
  file[:mode] = 'oga=r'
1160
- Puppet::Util.expects(:withumask).with(0)
1168
+ expect(Puppet::Util).to receive(:withumask).with(0)
1161
1169
  file.write
1162
1170
  end
1163
1171
 
1164
1172
  it "should convert symbolic mode to int" do
1165
1173
  file[:mode] = 'oga=r'
1166
- File.expects(:open).with(file[:path], anything, 0444)
1174
+ expect(File).to receive(:open).with(file[:path], anything, 0444)
1167
1175
  file.write
1168
1176
  end
1169
1177
 
1170
1178
  it "should support int modes" do
1171
1179
  file[:mode] = '0444'
1172
- File.expects(:open).with(file[:path], anything, 0444)
1180
+ expect(File).to receive(:open).with(file[:path], anything, 0444)
1173
1181
  file.write
1174
1182
  end
1175
1183
  end
@@ -1204,8 +1212,8 @@ describe Puppet::Type.type(:file) do
1204
1212
  describe "#fail_if_checksum_is_wrong" do
1205
1213
  it "should fail if the checksum of the file doesn't match the expected one" do
1206
1214
  expect do
1215
+ allow(file.parameter(:checksum)).to receive(:sum_file).and_return('wrong!!')
1207
1216
  file.instance_eval do
1208
- parameter(:checksum).stubs(:sum_file).returns('wrong!!')
1209
1217
  fail_if_checksum_is_wrong(self[:path], 'anything!')
1210
1218
  end
1211
1219
  end.to raise_error(Puppet::Error, /File written to disk did not match checksum/)
@@ -1213,8 +1221,8 @@ describe Puppet::Type.type(:file) do
1213
1221
 
1214
1222
  it "should not fail if the checksum is correct" do
1215
1223
  expect do
1224
+ allow(file.parameter(:checksum)).to receive(:sum_file).and_return('anything!')
1216
1225
  file.instance_eval do
1217
- parameter(:checksum).stubs(:sum_file).returns('anything!')
1218
1226
  fail_if_checksum_is_wrong(self[:path], 'anything!')
1219
1227
  end
1220
1228
  end.not_to raise_error
@@ -1222,8 +1230,8 @@ describe Puppet::Type.type(:file) do
1222
1230
 
1223
1231
  it "should not fail if the checksum is absent" do
1224
1232
  expect do
1233
+ allow(file.parameter(:checksum)).to receive(:sum_file).and_return(nil)
1225
1234
  file.instance_eval do
1226
- parameter(:checksum).stubs(:sum_file).returns(nil)
1227
1235
  fail_if_checksum_is_wrong(self[:path], 'anything!')
1228
1236
  end
1229
1237
  end.not_to raise_error
@@ -1262,9 +1270,9 @@ describe Puppet::Type.type(:file) do
1262
1270
  file[name] = value
1263
1271
 
1264
1272
  prop = file.property(name)
1265
- prop.expects(:retrieve)
1266
- prop.expects(:safe_insync?).returns false
1267
- prop.expects(:sync)
1273
+ expect(prop).to receive(:retrieve)
1274
+ expect(prop).to receive(:safe_insync?).and_return(false)
1275
+ expect(prop).to receive(:sync)
1268
1276
 
1269
1277
  file.send(:property_fix)
1270
1278
  end
@@ -1398,7 +1406,7 @@ describe Puppet::Type.type(:file) do
1398
1406
  catalog.add_resource @link_resource
1399
1407
 
1400
1408
  # to prevent the catalog from trying to write state.yaml
1401
- Puppet::Util::Storage.stubs(:store)
1409
+ allow(Puppet::Util::Storage).to receive(:store)
1402
1410
  end
1403
1411
 
1404
1412
  it "should preserve the original file mode and ignore the one set by the link" do
@@ -1435,17 +1443,21 @@ describe Puppet::Type.type(:file) do
1435
1443
  file[:source] = source
1436
1444
 
1437
1445
  # intercept the indirector call to provide back mocked metadata for the given URI
1438
- metadata = stub 'metadata', :source => source
1439
- metadata.expects(:source=)
1440
- Puppet::FileServing::Metadata.indirection.expects(:find).with do |path, opts|
1441
- path == source
1442
- end.returns metadata
1446
+ metadata = double('metadata', :source => source)
1447
+ expect(metadata).to receive(:source=)
1448
+ expect(Puppet::FileServing::Metadata.indirection).to receive(:find).with(source, anything).and_return(metadata)
1443
1449
 
1444
1450
  uri = file.parameters[:source].uri
1445
1451
  expect(URI.unescape(uri.path)).to eq(filename)
1446
1452
  expect(uri.path.encoding).to eq(Encoding::UTF_8)
1447
1453
  end
1448
1454
 
1455
+ matcher :request_key do |expected|
1456
+ match do |actual|
1457
+ values_match? expected, actual.key
1458
+ end
1459
+ end
1460
+
1449
1461
  it 'should allow UTF-8 characters inside the indirector / terminus code' do
1450
1462
  filename = "/bar #{mixed_utf8}"
1451
1463
  source = "puppet://foo#{filename}"
@@ -1454,12 +1466,10 @@ describe Puppet::Type.type(:file) do
1454
1466
  # for this test to properly trigger previously errant behavior, the code for
1455
1467
  # Puppet::FileServing::Metadata.indirection.find must run and produce an
1456
1468
  # instance of Puppet::Indirector::FileMetadata::Rest that can be amended
1457
- metadata = stub 'metadata', :source => source
1458
- metadata.expects(:source=)
1469
+ metadata = double('metadata', :source => source)
1470
+ expect(metadata).to receive(:source=)
1459
1471
  require 'puppet/indirector/file_metadata/rest'
1460
- Puppet::Indirector::FileMetadata::Rest.any_instance.expects(:find).with do |req|
1461
- req.key == filename[1..-1]
1462
- end.returns(metadata)
1472
+ expect_any_instance_of(Puppet::Indirector::FileMetadata::Rest).to receive(:find).with(request_key(filename[1..-1])).and_return(metadata)
1463
1473
 
1464
1474
  uri = file.parameters[:source].uri
1465
1475
  expect(URI.unescape(uri.path)).to eq(filename)
@@ -1511,7 +1521,7 @@ describe Puppet::Type.type(:file) do
1511
1521
 
1512
1522
  describe "on Windows when source_permissions is `use`" do
1513
1523
  before :each do
1514
- Puppet::Util::Platform.stubs(:windows?).returns true
1524
+ allow(Puppet::Util::Platform).to receive(:windows?).and_return(true)
1515
1525
 
1516
1526
  file[:source_permissions] = "use"
1517
1527
  end
@@ -1549,8 +1559,8 @@ describe Puppet::Type.type(:file) do
1549
1559
  file[:group] = 2
1550
1560
  file[:mode] = "0003"
1551
1561
 
1552
- file.parameter(:source).expects(:copy_source_values)
1553
- file.expects(:warning).with(err_message)
1562
+ expect(file.parameter(:source)).to receive(:copy_source_values)
1563
+ expect(file).to receive(:warning).with(err_message)
1554
1564
  expect { file.retrieve }.not_to raise_error
1555
1565
  end
1556
1566
  end
@@ -1638,7 +1648,7 @@ describe Puppet::Type.type(:file) do
1638
1648
  describe "when auditing" do
1639
1649
  before :each do
1640
1650
  # to prevent the catalog from trying to write state.yaml
1641
- Puppet::Util::Storage.stubs(:store)
1651
+ allow(Puppet::Util::Storage).to receive(:store)
1642
1652
  end
1643
1653
 
1644
1654
  it "should not fail if creating a new file if group is not set" do