puppet 3.8.7 → 4.0.0.rc1

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 (1586) hide show
  1. data/CONTRIBUTING.md +26 -11
  2. data/Gemfile +13 -25
  3. data/LICENSE +1 -1
  4. data/Rakefile +9 -0
  5. data/bin/puppet +7 -6
  6. data/conf/auth.conf +30 -26
  7. data/conf/environment.conf +16 -0
  8. data/conf/fileserver.conf +2 -2
  9. data/conf/puppet.conf +6 -0
  10. data/ext/README.environment +1 -1
  11. data/ext/build_defaults.yaml +16 -7
  12. data/ext/debian/control +5 -5
  13. data/ext/debian/puppet-common.manpages +0 -5
  14. data/ext/debian/puppet-common.postinst +3 -3
  15. data/ext/debian/puppet.init +23 -12
  16. data/ext/debian/puppet.logrotate +1 -2
  17. data/ext/debian/puppetmaster-common.postinst +6 -0
  18. data/ext/debian/puppetmaster.init +5 -5
  19. data/ext/debian/rules +4 -1
  20. data/ext/debian/vim-puppet.dirs +2 -0
  21. data/ext/debian/vim-puppet.yaml +2 -0
  22. data/ext/emacs/puppet-mode.el +0 -1
  23. data/ext/gentoo/conf.d/puppet +1 -1
  24. data/ext/gentoo/conf.d/puppetmaster +1 -1
  25. data/ext/nagios/check_puppet.rb +1 -1
  26. data/ext/project_data.yaml +6 -7
  27. data/ext/puppet-nm-dispatcher +13 -0
  28. data/ext/puppet-test +0 -66
  29. data/ext/puppetlisten/puppetlisten.rb +7 -5
  30. data/ext/rack/config.ru +12 -5
  31. data/ext/redhat/client.init +3 -3
  32. data/ext/redhat/logrotate +1 -2
  33. data/ext/redhat/puppet.spec.erb +12 -8
  34. data/ext/redhat/server.init +1 -1
  35. data/ext/regexp_nodes/regexp_nodes.rb +1 -1
  36. data/ext/solaris/smf/svc-puppetd +1 -1
  37. data/ext/solaris/smf/svc-puppetmasterd +1 -1
  38. data/ext/suse/client.init +1 -1
  39. data/ext/suse/server.init +1 -1
  40. data/ext/systemd/puppet.service +1 -3
  41. data/ext/vim/syntax/puppet.vim +1 -1
  42. data/ext/windows/service/daemon.rb +19 -2
  43. data/install.rb +63 -7
  44. data/lib/hiera/puppet_function.rb +7 -18
  45. data/lib/hiera/scope.rb +4 -1
  46. data/lib/puppet.rb +19 -51
  47. data/lib/puppet/agent.rb +2 -6
  48. data/lib/puppet/application.rb +14 -65
  49. data/lib/puppet/application/agent.rb +7 -56
  50. data/lib/puppet/application/apply.rb +1 -6
  51. data/lib/puppet/application/ca.rb +5 -0
  52. data/lib/puppet/application/cert.rb +7 -3
  53. data/lib/puppet/application/certificate.rb +2 -0
  54. data/lib/puppet/application/device.rb +10 -36
  55. data/lib/puppet/application/doc.rb +16 -63
  56. data/lib/puppet/application/epp.rb +5 -0
  57. data/lib/puppet/application/face_base.rb +24 -5
  58. data/lib/puppet/application/master.rb +2 -5
  59. data/lib/puppet/application/resource.rb +17 -17
  60. data/lib/puppet/application_support.rb +57 -0
  61. data/lib/puppet/configurer.rb +3 -7
  62. data/lib/puppet/configurer/downloader.rb +1 -0
  63. data/lib/puppet/configurer/fact_handler.rb +1 -1
  64. data/lib/puppet/daemon.rb +6 -15
  65. data/lib/puppet/data_providers.rb +28 -0
  66. data/lib/puppet/data_providers/data_adapter.rb +86 -0
  67. data/lib/puppet/data_providers/data_function_support.rb +32 -0
  68. data/lib/puppet/data_providers/function_env_data_provider.rb +28 -0
  69. data/lib/puppet/data_providers/function_module_data_provider.rb +44 -0
  70. data/lib/puppet/defaults.rb +135 -530
  71. data/lib/puppet/environments.rb +10 -156
  72. data/lib/puppet/error.rb +4 -30
  73. data/lib/puppet/external/nagios/base.rb +2 -2
  74. data/lib/puppet/external/pson/common.rb +2 -17
  75. data/lib/puppet/external/pson/pure/generator.rb +1 -0
  76. data/lib/puppet/external/pson/pure/parser.rb +0 -11
  77. data/lib/puppet/face/catalog.rb +4 -4
  78. data/lib/puppet/face/certificate.rb +2 -3
  79. data/lib/puppet/face/certificate_request.rb +4 -3
  80. data/lib/puppet/face/certificate_revocation_list.rb +5 -9
  81. data/lib/puppet/face/config.rb +2 -2
  82. data/lib/puppet/face/epp.rb +479 -0
  83. data/lib/puppet/face/facts.rb +6 -49
  84. data/lib/puppet/face/file.rb +2 -2
  85. data/lib/puppet/face/file/download.rb +1 -2
  86. data/lib/puppet/face/help.rb +2 -3
  87. data/lib/puppet/face/module/build.rb +5 -5
  88. data/lib/puppet/face/module/changes.rb +1 -1
  89. data/lib/puppet/face/module/generate.rb +6 -6
  90. data/lib/puppet/face/module/install.rb +16 -16
  91. data/lib/puppet/face/module/list.rb +9 -9
  92. data/lib/puppet/face/module/uninstall.rb +5 -5
  93. data/lib/puppet/face/module/upgrade.rb +3 -3
  94. data/lib/puppet/face/node.rb +3 -4
  95. data/lib/puppet/face/node/clean.rb +5 -68
  96. data/lib/puppet/face/parser.rb +6 -8
  97. data/lib/puppet/face/report.rb +4 -4
  98. data/lib/puppet/face/resource.rb +1 -1
  99. data/lib/puppet/face/resource_type.rb +7 -4
  100. data/lib/puppet/face/status.rb +6 -12
  101. data/lib/puppet/feature/base.rb +0 -7
  102. data/lib/puppet/file_bucket/dipper.rb +1 -2
  103. data/lib/puppet/file_bucket/file.rb +12 -25
  104. data/lib/puppet/file_serving/base.rb +1 -11
  105. data/lib/puppet/file_serving/content.rb +5 -7
  106. data/lib/puppet/file_serving/metadata.rb +4 -61
  107. data/lib/puppet/file_serving/mount/pluginfacts.rb +1 -1
  108. data/lib/puppet/file_serving/mount/plugins.rb +1 -1
  109. data/lib/puppet/file_serving/terminus_helper.rb +16 -5
  110. data/lib/puppet/file_system.rb +6 -22
  111. data/lib/puppet/file_system/file_impl.rb +0 -4
  112. data/lib/puppet/file_system/memory_file.rb +0 -5
  113. data/lib/puppet/file_system/memory_impl.rb +0 -4
  114. data/lib/puppet/file_system/{file19.rb → posix.rb} +1 -1
  115. data/lib/puppet/file_system/{file19windows.rb → windows.rb} +2 -10
  116. data/lib/puppet/forge/repository.rb +12 -8
  117. data/lib/puppet/functions.rb +17 -51
  118. data/lib/puppet/functions/assert_type.rb +7 -7
  119. data/lib/puppet/functions/each.rb +1 -3
  120. data/lib/puppet/functions/epp.rb +3 -3
  121. data/lib/puppet/functions/filter.rb +3 -5
  122. data/lib/puppet/functions/hiera.rb +2 -23
  123. data/lib/puppet/functions/hiera_array.rb +3 -25
  124. data/lib/puppet/functions/hiera_hash.rb +2 -26
  125. data/lib/puppet/functions/hiera_include.rb +4 -37
  126. data/lib/puppet/functions/inline_epp.rb +1 -2
  127. data/lib/puppet/functions/lookup.rb +234 -0
  128. data/lib/puppet/functions/map.rb +1 -3
  129. data/lib/puppet/functions/match.rb +5 -5
  130. data/lib/puppet/functions/reduce.rb +1 -3
  131. data/lib/puppet/functions/regsubst.rb +79 -0
  132. data/lib/puppet/functions/scanf.rb +4 -3
  133. data/lib/puppet/functions/slice.rb +1 -3
  134. data/lib/puppet/functions/split.rb +47 -0
  135. data/lib/puppet/functions/with.rb +1 -1
  136. data/lib/puppet/graph/relationship_graph.rb +41 -13
  137. data/lib/puppet/graph/simple_graph.rb +6 -10
  138. data/lib/puppet/indirector/catalog/compiler.rb +0 -2
  139. data/lib/puppet/indirector/catalog/static_compiler.rb +4 -5
  140. data/lib/puppet/indirector/direct_file_server.rb +1 -3
  141. data/lib/puppet/indirector/face.rb +11 -2
  142. data/lib/puppet/indirector/facts/facter.rb +5 -1
  143. data/lib/puppet/indirector/facts/network_device.rb +5 -2
  144. data/lib/puppet/indirector/facts/store_configs.rb +3 -0
  145. data/lib/puppet/indirector/facts/yaml.rb +4 -0
  146. data/lib/puppet/indirector/file_metadata/file.rb +0 -15
  147. data/lib/puppet/indirector/file_server.rb +2 -16
  148. data/lib/puppet/indirector/hiera.rb +39 -1
  149. data/lib/puppet/indirector/indirection.rb +2 -9
  150. data/lib/puppet/indirector/node/ldap.rb +1 -1
  151. data/lib/puppet/indirector/request.rb +21 -81
  152. data/lib/puppet/indirector/resource/ral.rb +1 -2
  153. data/lib/puppet/indirector/resource/store_configs.rb +1 -2
  154. data/lib/puppet/indirector/resource_type/parser.rb +1 -1
  155. data/lib/puppet/indirector/rest.rb +21 -33
  156. data/lib/puppet/interface.rb +0 -7
  157. data/lib/puppet/interface/action_builder.rb +1 -1
  158. data/lib/puppet/interface/action_manager.rb +9 -13
  159. data/lib/puppet/interface/face_collection.rb +2 -2
  160. data/lib/puppet/interface/option_builder.rb +1 -3
  161. data/lib/puppet/metatype/manager.rb +1 -7
  162. data/lib/puppet/module.rb +42 -35
  163. data/lib/puppet/module_tool.rb +5 -7
  164. data/lib/puppet/module_tool/applications/application.rb +3 -10
  165. data/lib/puppet/module_tool/applications/installer.rb +13 -15
  166. data/lib/puppet/module_tool/applications/unpacker.rb +1 -1
  167. data/lib/puppet/module_tool/applications/upgrader.rb +9 -11
  168. data/lib/puppet/module_tool/contents_description.rb +17 -13
  169. data/lib/puppet/module_tool/installed_modules.rb +4 -6
  170. data/lib/puppet/module_tool/metadata.rb +3 -14
  171. data/lib/puppet/module_tool/skeleton/templates/generator/Gemfile +3 -3
  172. data/lib/puppet/module_tool/skeleton/templates/generator/Rakefile +0 -1
  173. data/lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb +1 -1
  174. data/lib/puppet/module_tool/tar/gnu.rb +1 -1
  175. data/lib/puppet/module_tool/tar/mini.rb +2 -2
  176. data/lib/puppet/network/auth_config_parser.rb +2 -2
  177. data/lib/puppet/network/authconfig.rb +32 -16
  178. data/lib/puppet/network/format_handler.rb +7 -7
  179. data/lib/puppet/network/format_support.rb +4 -0
  180. data/lib/puppet/network/formats.rb +6 -62
  181. data/lib/puppet/network/http.rb +12 -2
  182. data/lib/puppet/network/http/api.rb +42 -0
  183. data/lib/puppet/network/http/api/ca.rb +2 -0
  184. data/lib/puppet/network/http/api/ca/v1.rb +11 -0
  185. data/lib/puppet/network/http/api/{v1.rb → indirected_routes.rb} +57 -29
  186. data/lib/puppet/network/http/api/indirection_type.rb +32 -0
  187. data/lib/puppet/network/http/api/master.rb +2 -0
  188. data/lib/puppet/network/http/api/master/v3.rb +22 -0
  189. data/lib/puppet/network/http/api/master/v3/authorization.rb +18 -0
  190. data/lib/puppet/network/http/api/{v2 → master/v3}/environments.rb +2 -2
  191. data/lib/puppet/network/http/compression.rb +3 -5
  192. data/lib/puppet/network/http/connection.rb +1 -8
  193. data/lib/puppet/network/http/factory.rb +2 -3
  194. data/lib/puppet/network/http/handler.rb +3 -11
  195. data/lib/puppet/network/http/rack/rest.rb +4 -4
  196. data/lib/puppet/network/http/request.rb +4 -4
  197. data/lib/puppet/network/http/webrick.rb +1 -6
  198. data/lib/puppet/network/http/webrick/rest.rb +15 -8
  199. data/lib/puppet/network/resolver.rb +2 -2
  200. data/lib/puppet/network/rights.rb +2 -2
  201. data/lib/puppet/node.rb +2 -29
  202. data/lib/puppet/node/environment.rb +92 -184
  203. data/lib/puppet/node/facts.rb +22 -44
  204. data/lib/puppet/parameter.rb +3 -16
  205. data/lib/puppet/parameter/value.rb +1 -3
  206. data/lib/puppet/parameter/value_collection.rb +12 -11
  207. data/lib/puppet/parser.rb +12 -2
  208. data/lib/puppet/parser/ast.rb +9 -78
  209. data/lib/puppet/parser/ast/block_expression.rb +11 -36
  210. data/lib/puppet/parser/ast/branch.rb +15 -18
  211. data/lib/puppet/parser/ast/hostclass.rb +1 -3
  212. data/lib/puppet/parser/ast/leaf.rb +55 -212
  213. data/lib/puppet/parser/ast/node.rb +3 -11
  214. data/lib/puppet/parser/ast/pops_bridge.rb +2 -7
  215. data/lib/puppet/parser/ast/resource.rb +14 -20
  216. data/lib/puppet/parser/ast/resource_instance.rb +4 -7
  217. data/lib/puppet/parser/ast/resourceparam.rb +21 -22
  218. data/lib/puppet/parser/compiler.rb +41 -70
  219. data/lib/puppet/parser/e4_parser_adapter.rb +2 -23
  220. data/lib/puppet/parser/files.rb +22 -67
  221. data/lib/puppet/parser/functions.rb +1 -3
  222. data/lib/puppet/parser/functions/assert_type.rb +1 -2
  223. data/lib/puppet/parser/functions/contain.rb +5 -3
  224. data/lib/puppet/parser/functions/create_resources.rb +9 -1
  225. data/lib/puppet/parser/functions/defined.rb +33 -61
  226. data/lib/puppet/parser/functions/each.rb +1 -3
  227. data/lib/puppet/parser/functions/epp.rb +1 -2
  228. data/lib/puppet/parser/functions/file.rb +1 -3
  229. data/lib/puppet/parser/functions/filter.rb +1 -3
  230. data/lib/puppet/parser/functions/hiera.rb +4 -6
  231. data/lib/puppet/parser/functions/hiera_array.rb +4 -6
  232. data/lib/puppet/parser/functions/hiera_hash.rb +6 -8
  233. data/lib/puppet/parser/functions/hiera_include.rb +2 -10
  234. data/lib/puppet/parser/functions/include.rb +4 -2
  235. data/lib/puppet/parser/functions/lookup.rb +115 -105
  236. data/lib/puppet/parser/functions/map.rb +1 -3
  237. data/lib/puppet/parser/functions/match.rb +1 -2
  238. data/lib/puppet/parser/functions/realize.rb +1 -6
  239. data/lib/puppet/parser/functions/reduce.rb +1 -3
  240. data/lib/puppet/parser/functions/regsubst.rb +1 -57
  241. data/lib/puppet/parser/functions/require.rb +6 -4
  242. data/lib/puppet/parser/functions/scanf.rb +1 -1
  243. data/lib/puppet/parser/functions/slice.rb +1 -3
  244. data/lib/puppet/parser/functions/split.rb +1 -1
  245. data/lib/puppet/parser/functions/with.rb +1 -2
  246. data/lib/puppet/parser/parser_factory.rb +5 -21
  247. data/lib/puppet/parser/relationship.rb +14 -37
  248. data/lib/puppet/parser/resource.rb +11 -22
  249. data/lib/puppet/parser/scope.rb +45 -135
  250. data/lib/puppet/parser/templatewrapper.rb +1 -29
  251. data/lib/puppet/parser/type_loader.rb +12 -15
  252. data/lib/puppet/plugins.rb +9 -0
  253. data/lib/{puppetx/puppet/bindings_scheme_handler.rb → puppet/plugins/binding_schemes.rb} +14 -4
  254. data/lib/puppet/plugins/configuration.rb +68 -0
  255. data/lib/puppet/plugins/data_providers.rb +90 -0
  256. data/lib/{puppetx/puppet/syntax_checker.rb → puppet/plugins/syntax_checkers.rb} +14 -2
  257. data/lib/puppet/pops.rb +6 -7
  258. data/lib/puppet/pops/adaptable.rb +16 -5
  259. data/lib/puppet/pops/binder/binder.rb +5 -4
  260. data/lib/puppet/pops/binder/bindings_composer.rb +6 -4
  261. data/lib/puppet/pops/binder/bindings_factory.rb +4 -0
  262. data/lib/puppet/pops/binder/bindings_label_provider.rb +1 -1
  263. data/lib/puppet/pops/binder/bindings_loader.rb +3 -8
  264. data/lib/puppet/pops/binder/bindings_model_dumper.rb +36 -8
  265. data/lib/puppet/pops/binder/config/binder_config.rb +2 -2
  266. data/lib/puppet/pops/binder/config/binder_config_checker.rb +1 -1
  267. data/lib/puppet/pops/binder/config/issues.rb +4 -0
  268. data/lib/puppet/pops/binder/injector.rb +0 -1
  269. data/lib/puppet/pops/binder/scheme_handler/symbolic_scheme.rb +1 -1
  270. data/lib/puppet/pops/evaluator/access_operator.rb +18 -50
  271. data/lib/puppet/pops/evaluator/callable_mismatch_describer.rb +5 -5
  272. data/lib/puppet/pops/evaluator/callable_signature.rb +2 -2
  273. data/lib/puppet/pops/evaluator/closure.rb +16 -21
  274. data/lib/puppet/pops/evaluator/collector_transformer.rb +11 -1
  275. data/lib/puppet/pops/evaluator/compare_operator.rb +0 -43
  276. data/lib/puppet/pops/evaluator/epp_evaluator.rb +1 -1
  277. data/lib/puppet/pops/evaluator/evaluator_impl.rb +36 -152
  278. data/lib/puppet/pops/evaluator/external_syntax_support.rb +6 -3
  279. data/lib/puppet/pops/evaluator/relationship_operator.rb +1 -1
  280. data/lib/puppet/pops/evaluator/runtime3_converter.rb +1 -1
  281. data/lib/puppet/pops/evaluator/runtime3_support.rb +9 -57
  282. data/lib/puppet/pops/functions/dispatch.rb +1 -6
  283. data/lib/puppet/pops/issue_reporter.rb +16 -42
  284. data/lib/puppet/pops/issues.rb +13 -128
  285. data/lib/puppet/pops/loader/dependency_loader.rb +3 -3
  286. data/lib/puppet/pops/loader/loader.rb +21 -20
  287. data/lib/puppet/pops/loaders.rb +13 -8
  288. data/lib/puppet/pops/lookup.rb +96 -0
  289. data/lib/puppet/pops/merge_strategy.rb +283 -0
  290. data/lib/puppet/pops/model/ast_transformer.rb +4 -522
  291. data/lib/puppet/pops/model/factory.rb +20 -21
  292. data/lib/puppet/pops/model/model.rb +1 -1
  293. data/lib/puppet/pops/model/model_label_provider.rb +1 -1
  294. data/lib/puppet/pops/model/model_meta.rb +10 -7
  295. data/lib/puppet/pops/model/tree_dumper.rb +1 -1
  296. data/lib/puppet/pops/parser/egrammar.ra +1 -13
  297. data/lib/puppet/pops/parser/eparser.rb +1132 -1272
  298. data/lib/puppet/pops/parser/epp_support.rb +11 -22
  299. data/lib/puppet/pops/parser/evaluating_parser.rb +11 -10
  300. data/lib/puppet/pops/parser/heredoc_support.rb +12 -13
  301. data/lib/puppet/pops/parser/interpolation_support.rb +1 -7
  302. data/lib/puppet/pops/parser/lexer2.rb +33 -36
  303. data/lib/puppet/pops/parser/lexer_support.rb +20 -46
  304. data/lib/puppet/pops/parser/locator.rb +6 -30
  305. data/lib/puppet/pops/parser/parser_support.rb +14 -11
  306. data/lib/puppet/pops/parser/slurp_support.rb +6 -22
  307. data/lib/puppet/pops/patterns.rb +0 -3
  308. data/lib/puppet/pops/types/class_loader.rb +8 -8
  309. data/lib/puppet/pops/types/enumeration.rb +1 -1
  310. data/lib/puppet/pops/types/type_asserter.rb +45 -0
  311. data/lib/puppet/pops/types/type_assertion_error.rb +26 -0
  312. data/lib/puppet/pops/types/type_calculator.rb +110 -212
  313. data/lib/puppet/pops/types/type_factory.rb +15 -74
  314. data/lib/puppet/pops/types/type_parser.rb +15 -24
  315. data/lib/puppet/pops/types/types.rb +25 -35
  316. data/lib/puppet/pops/types/types_meta.rb +2 -13
  317. data/lib/puppet/pops/utils.rb +1 -1
  318. data/lib/puppet/pops/validation.rb +3 -26
  319. data/lib/puppet/pops/validation/checker4_0.rb +6 -56
  320. data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -3
  321. data/lib/puppet/pops/visitor.rb +10 -7
  322. data/lib/puppet/property.rb +44 -124
  323. data/lib/puppet/provider.rb +0 -52
  324. data/lib/puppet/provider/aixobject.rb +2 -2
  325. data/lib/puppet/provider/augeas/augeas.rb +9 -6
  326. data/lib/puppet/provider/command.rb +1 -1
  327. data/lib/puppet/provider/cron/crontab.rb +37 -0
  328. data/lib/puppet/provider/exec.rb +2 -16
  329. data/lib/puppet/provider/file/posix.rb +1 -1
  330. data/lib/puppet/provider/file/windows.rb +1 -1
  331. data/lib/puppet/provider/group/aix.rb +1 -1
  332. data/lib/puppet/provider/group/pw.rb +0 -1
  333. data/lib/puppet/provider/group/windows_adsi.rb +4 -18
  334. data/lib/puppet/provider/host/parsed.rb +4 -2
  335. data/lib/puppet/provider/macauthorization/macauthorization.rb +0 -12
  336. data/lib/puppet/provider/mailalias/aliases.rb +23 -12
  337. data/lib/puppet/provider/mount/parsed.rb +2 -145
  338. data/lib/puppet/provider/nameservice/directoryservice.rb +57 -131
  339. data/lib/puppet/provider/network_device.rb +3 -0
  340. data/lib/puppet/provider/package/appdmg.rb +5 -2
  341. data/lib/puppet/provider/package/apt.rb +1 -1
  342. data/lib/puppet/provider/package/fink.rb +1 -1
  343. data/lib/puppet/provider/package/openbsd.rb +26 -12
  344. data/lib/puppet/provider/package/opkg.rb +6 -1
  345. data/lib/puppet/provider/package/pacman.rb +159 -127
  346. data/lib/puppet/provider/package/pip.rb +1 -11
  347. data/lib/puppet/provider/package/pkg.rb +73 -29
  348. data/lib/puppet/provider/package/pkgdmg.rb +2 -2
  349. data/lib/puppet/provider/package/pkgin.rb +1 -1
  350. data/lib/puppet/provider/package/portage.rb +5 -1
  351. data/lib/puppet/provider/package/portupgrade.rb +0 -2
  352. data/lib/puppet/provider/package/rpm.rb +109 -0
  353. data/lib/puppet/provider/package/rug.rb +0 -1
  354. data/lib/puppet/provider/package/windows/package.rb +1 -1
  355. data/lib/puppet/provider/package/yum.rb +121 -30
  356. data/lib/puppet/provider/package/zypper.rb +8 -17
  357. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +7 -32
  358. data/lib/puppet/provider/service/base.rb +17 -3
  359. data/lib/puppet/provider/service/bsd.rb +1 -1
  360. data/lib/puppet/provider/service/daemontools.rb +1 -1
  361. data/lib/puppet/provider/service/init.rb +0 -7
  362. data/lib/puppet/provider/service/launchd.rb +11 -89
  363. data/lib/puppet/provider/service/openbsd.rb +56 -298
  364. data/lib/puppet/provider/service/runit.rb +1 -1
  365. data/lib/puppet/provider/service/systemd.rb +1 -0
  366. data/lib/puppet/provider/service/upstart.rb +4 -2
  367. data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -1
  368. data/lib/puppet/provider/user/aix.rb +1 -1
  369. data/lib/puppet/provider/user/directoryservice.rb +40 -70
  370. data/lib/puppet/provider/user/hpux.rb +31 -2
  371. data/lib/puppet/provider/user/openbsd.rb +74 -0
  372. data/lib/puppet/provider/user/pw.rb +0 -1
  373. data/lib/puppet/provider/user/user_role_add.rb +1 -3
  374. data/lib/puppet/provider/user/windows_adsi.rb +2 -9
  375. data/lib/puppet/provider/yumrepo/inifile.rb +1 -3
  376. data/lib/puppet/provider/zfs/zfs.rb +3 -2
  377. data/lib/puppet/provider/zone/solaris.rb +3 -3
  378. data/lib/puppet/reference/configuration.rb +4 -3
  379. data/lib/puppet/reference/metaparameter.rb +0 -9
  380. data/lib/puppet/reference/providers.rb +1 -1
  381. data/lib/puppet/reference/type.rb +8 -10
  382. data/lib/puppet/relationship.rb +4 -17
  383. data/lib/puppet/resource.rb +132 -114
  384. data/lib/puppet/resource/catalog.rb +23 -30
  385. data/lib/puppet/resource/status.rb +74 -22
  386. data/lib/puppet/resource/type.rb +12 -52
  387. data/lib/puppet/resource/type_collection.rb +26 -73
  388. data/lib/puppet/settings.rb +94 -153
  389. data/lib/puppet/settings/base_setting.rb +6 -30
  390. data/lib/puppet/settings/config_file.rb +14 -11
  391. data/lib/puppet/settings/duration_setting.rb +1 -1
  392. data/lib/puppet/settings/environment_conf.rb +14 -12
  393. data/lib/puppet/settings/file_setting.rb +9 -10
  394. data/lib/puppet/settings/ttl_setting.rb +1 -3
  395. data/lib/puppet/ssl/certificate.rb +38 -8
  396. data/lib/puppet/ssl/certificate_authority/interface.rb +7 -1
  397. data/lib/puppet/ssl/certificate_factory.rb +3 -3
  398. data/lib/puppet/ssl/certificate_request.rb +36 -8
  399. data/lib/puppet/ssl/configuration.rb +2 -8
  400. data/lib/puppet/ssl/host.rb +1 -8
  401. data/lib/puppet/ssl/inventory.rb +0 -7
  402. data/lib/puppet/ssl/oids.rb +72 -3
  403. data/lib/puppet/ssl/validator/default_validator.rb +0 -1
  404. data/lib/puppet/status.rb +0 -5
  405. data/lib/puppet/syntax_checkers.rb +3 -0
  406. data/lib/{puppetx/puppetlabs → puppet}/syntax_checkers/json.rb +2 -2
  407. data/lib/puppet/test/test_helper.rb +11 -12
  408. data/lib/puppet/transaction.rb +12 -9
  409. data/lib/puppet/transaction/event.rb +4 -5
  410. data/lib/puppet/transaction/event_manager.rb +50 -5
  411. data/lib/puppet/transaction/report.rb +5 -10
  412. data/lib/puppet/transaction/resource_harness.rb +7 -2
  413. data/lib/puppet/type.rb +113 -29
  414. data/lib/puppet/type/augeas.rb +1 -0
  415. data/lib/puppet/type/exec.rb +2 -2
  416. data/lib/puppet/type/file.rb +8 -9
  417. data/lib/puppet/type/file/content.rb +19 -15
  418. data/lib/puppet/type/file/mode.rb +16 -11
  419. data/lib/puppet/type/file/selcontext.rb +1 -1
  420. data/lib/puppet/type/file/source.rb +15 -15
  421. data/lib/puppet/type/filebucket.rb +2 -2
  422. data/lib/puppet/type/group.rb +5 -17
  423. data/lib/puppet/type/host.rb +12 -3
  424. data/lib/puppet/type/k5login.rb +1 -1
  425. data/lib/puppet/type/mailalias.rb +20 -6
  426. data/lib/puppet/type/maillist.rb +1 -1
  427. data/lib/puppet/type/mount.rb +6 -16
  428. data/lib/puppet/type/notify.rb +1 -1
  429. data/lib/puppet/type/package.rb +91 -16
  430. data/lib/puppet/type/resources.rb +0 -7
  431. data/lib/puppet/type/router.rb +1 -1
  432. data/lib/puppet/type/schedule.rb +1 -1
  433. data/lib/puppet/type/scheduled_task.rb +0 -13
  434. data/lib/puppet/type/selboolean.rb +2 -2
  435. data/lib/puppet/type/service.rb +1 -1
  436. data/lib/puppet/type/ssh_authorized_key.rb +1 -1
  437. data/lib/puppet/type/sshkey.rb +1 -1
  438. data/lib/puppet/type/tidy.rb +4 -1
  439. data/lib/puppet/type/user.rb +16 -3
  440. data/lib/puppet/type/yumrepo.rb +26 -0
  441. data/lib/puppet/type/zfs.rb +1 -1
  442. data/lib/puppet/type/zpool.rb +1 -1
  443. data/lib/puppet/util.rb +2 -85
  444. data/lib/puppet/util/autoload.rb +3 -13
  445. data/lib/puppet/util/checksums.rb +59 -22
  446. data/lib/puppet/util/classgen.rb +1 -9
  447. data/lib/puppet/util/colors.rb +0 -117
  448. data/lib/puppet/util/command_line.rb +1 -23
  449. data/lib/puppet/util/errors.rb +2 -4
  450. data/lib/puppet/util/execution.rb +19 -22
  451. data/lib/puppet/util/feature.rb +2 -4
  452. data/lib/puppet/util/fileparsing.rb +3 -2
  453. data/lib/puppet/util/log.rb +13 -56
  454. data/lib/puppet/util/log/destinations.rb +17 -36
  455. data/lib/puppet/util/logging.rb +52 -37
  456. data/lib/puppet/util/metric.rb +0 -149
  457. data/lib/puppet/util/monkey_patches.rb +1 -94
  458. data/lib/puppet/util/network_device/base.rb +1 -5
  459. data/lib/puppet/util/network_device/cisco/interface.rb +2 -2
  460. data/lib/puppet/util/network_device/config.rb +0 -5
  461. data/lib/puppet/util/network_device/transport/ssh.rb +2 -2
  462. data/lib/puppet/util/profiler.rb +1 -1
  463. data/lib/puppet/util/profiler/aggregate.rb +1 -1
  464. data/lib/puppet/util/profiler/around_profiler.rb +1 -1
  465. data/lib/puppet/util/psych_support.rb +38 -0
  466. data/lib/puppet/util/rdoc.rb +6 -42
  467. data/lib/puppet/util/rdoc/code_objects.rb +5 -45
  468. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +1 -1
  469. data/lib/puppet/util/rdoc/parser.rb +5 -15
  470. data/lib/puppet/util/rdoc/parser/puppet_parser_core.rb +8 -227
  471. data/lib/puppet/util/retry_action.rb +46 -0
  472. data/lib/puppet/util/run_mode.rb +31 -7
  473. data/lib/puppet/util/selinux.rb +2 -2
  474. data/lib/puppet/util/ssl.rb +11 -11
  475. data/lib/puppet/util/suidmanager.rb +4 -31
  476. data/lib/puppet/util/tag_set.rb +0 -11
  477. data/lib/puppet/util/tagging.rb +50 -19
  478. data/lib/puppet/util/warnings.rb +1 -0
  479. data/lib/puppet/util/windows/adsi.rb +13 -60
  480. data/lib/puppet/util/windows/api_types.rb +16 -2
  481. data/lib/puppet/util/windows/file.rb +2 -8
  482. data/lib/puppet/util/windows/process.rb +58 -0
  483. data/lib/puppet/util/windows/registry.rb +319 -31
  484. data/lib/puppet/util/windows/security.rb +1 -68
  485. data/lib/puppet/util/windows/taskscheduler.rb +0 -21
  486. data/lib/puppet/util/windows/user.rb +2 -3
  487. data/lib/puppet/vendor/deep_merge/CHANGELOG +45 -0
  488. data/lib/puppet/vendor/deep_merge/Gemfile +3 -0
  489. data/lib/puppet/vendor/deep_merge/LICENSE +21 -0
  490. data/lib/puppet/vendor/deep_merge/README.md +113 -0
  491. data/lib/puppet/vendor/deep_merge/Rakefile +19 -0
  492. data/lib/puppet/vendor/deep_merge/deep_merge.gemspec +35 -0
  493. data/lib/puppet/vendor/deep_merge/lib/deep_merge.rb +2 -0
  494. data/lib/puppet/vendor/deep_merge/lib/deep_merge/core.rb +210 -0
  495. data/lib/puppet/vendor/deep_merge/lib/deep_merge/deep_merge_hash.rb +28 -0
  496. data/lib/puppet/vendor/deep_merge/lib/deep_merge/rails_compat.rb +27 -0
  497. data/lib/puppet/vendor/deep_merge/test/test_deep_merge.rb +608 -0
  498. data/lib/puppet/vendor/load_deep_merge.rb +1 -0
  499. data/lib/puppet/vendor/load_rgen.rb +1 -0
  500. data/lib/puppet/vendor/require_vendored.rb +1 -3
  501. data/lib/puppet/vendor/rgen_patch.rb +132 -0
  502. data/lib/puppet/version.rb +1 -1
  503. data/lib/puppet_x.rb +8 -0
  504. data/lib/semver.rb +0 -1
  505. data/man/man5/puppet.conf.5 +432 -287
  506. data/man/man8/extlookup2hiera.8 +2 -15
  507. data/man/man8/puppet-agent.8 +14 -14
  508. data/man/man8/puppet-apply.8 +29 -30
  509. data/man/man8/puppet-ca.8 +29 -17
  510. data/man/man8/puppet-catalog.8 +5 -34
  511. data/man/man8/puppet-cert.8 +8 -4
  512. data/man/man8/puppet-certificate.8 +15 -29
  513. data/man/man8/puppet-certificate_request.8 +9 -16
  514. data/man/man8/puppet-certificate_revocation_list.8 +5 -31
  515. data/man/man8/puppet-config.8 +52 -11
  516. data/man/man8/puppet-describe.8 +1 -1
  517. data/man/man8/puppet-device.8 +5 -16
  518. data/man/man8/puppet-doc.8 +7 -80
  519. data/man/man8/puppet-epp.8 +349 -0
  520. data/man/man8/puppet-facts.8 +5 -95
  521. data/man/man8/puppet-file.8 +2 -28
  522. data/man/man8/puppet-filebucket.8 +2 -2
  523. data/man/man8/puppet-help.8 +2 -2
  524. data/man/man8/puppet-inspect.8 +1 -1
  525. data/man/man8/puppet-key.8 +6 -3
  526. data/man/man8/puppet-man.8 +2 -2
  527. data/man/man8/puppet-master.8 +11 -7
  528. data/man/man8/puppet-module.8 +75 -49
  529. data/man/man8/puppet-node.8 +8 -56
  530. data/man/man8/puppet-parser.8 +38 -4
  531. data/man/man8/puppet-plugin.8 +2 -2
  532. data/man/man8/puppet-report.8 +8 -70
  533. data/man/man8/puppet-resource.8 +7 -3
  534. data/man/man8/puppet-resource_type.8 +2 -28
  535. data/man/man8/puppet-status.8 +5 -47
  536. data/man/man8/puppet.8 +2 -2
  537. data/spec/fixtures/integration/provider/mailalias/aliases/test1 +3 -0
  538. data/spec/fixtures/integration/provider/sshkey/sample +21 -0
  539. data/spec/fixtures/unit/data_providers/environments/production/environment.conf +2 -0
  540. data/spec/fixtures/unit/data_providers/environments/production/lib/puppet/functions/environment/data.rb +7 -0
  541. data/spec/fixtures/unit/data_providers/environments/production/modules/abc/lib/puppet/bindings/abc/default.rb +9 -0
  542. data/spec/fixtures/unit/data_providers/environments/production/modules/abc/lib/puppet/functions/abc/data.rb +8 -0
  543. data/spec/fixtures/unit/data_providers/environments/production/modules/abc/manifests/init.pp +9 -0
  544. data/spec/fixtures/unit/data_providers/environments/sample/environment.conf +2 -0
  545. data/spec/fixtures/unit/data_providers/environments/sample/manifests/site.pp +6 -0
  546. data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet/bindings/dataprovider/default.rb +54 -0
  547. data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_env_data.rb +31 -0
  548. data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_module_data.rb +32 -0
  549. data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/manifests/init.pp +5 -0
  550. data/spec/fixtures/unit/functions/lookup/environments/production/environment.conf +2 -0
  551. data/spec/fixtures/unit/functions/lookup/environments/production/lib/puppet/functions/environment/data.rb +11 -0
  552. data/spec/fixtures/unit/functions/lookup/environments/production/modules/abc/lib/puppet/bindings/abc/default.rb +9 -0
  553. data/spec/fixtures/unit/functions/lookup/environments/production/modules/abc/lib/puppet/functions/abc/data.rb +9 -0
  554. data/spec/fixtures/unit/functions/lookup/environments/production/modules/abc/manifests/init.pp +8 -0
  555. data/spec/fixtures/unit/parser/lexer/subclass_name_duplication.pp +0 -0
  556. data/spec/fixtures/unit/pops/binder/bindings_composer/ok/binder_config.yaml +1 -1
  557. data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome2/lib/{puppetx → puppet_x}/awesome2/echo_scheme_handler.rb +3 -3
  558. data/spec/fixtures/unit/pops/binder/config/binder_config/nolayer/binder_config.yaml +6 -0
  559. data/spec/fixtures/unit/pops/parser/lexer/subclass_name_duplication.pp +0 -0
  560. data/spec/fixtures/unit/provider/mount/parsed/aix.filesystems +85 -93
  561. data/spec/fixtures/unit/provider/mount/parsed/aix.mount +7 -11
  562. data/spec/fixtures/unit/provider/package/pkg/dummy_implicit_version +3 -0
  563. data/spec/fixtures/unit/provider/package/pkg/dummy_solaris10 +1 -1
  564. data/spec/fixtures/unit/provider/package/pkg/dummy_solaris11.certificate_warning +1 -1
  565. data/spec/fixtures/unit/provider/package/pkg/dummy_solaris11.ifo.installed +1 -1
  566. data/spec/fixtures/unit/provider/package/pkg/dummy_solaris11.ifo.known +1 -1
  567. data/spec/fixtures/unit/provider/package/pkg/dummy_solaris11.installed +1 -1
  568. data/spec/fixtures/unit/provider/package/pkg/dummy_solaris11.known +1 -1
  569. data/spec/fixtures/unit/provider/package/pkg/incomplete +1 -1
  570. data/spec/fixtures/unit/provider/package/pkg/solaris11 +2 -2
  571. data/spec/fixtures/unit/provider/package/pkg/unknown_status +12 -12
  572. data/spec/fixtures/unit/provider/package/yum/yum-check-update-multiline.txt +201 -0
  573. data/spec/fixtures/unit/provider/package/yum/yum-check-update-simple.txt +12 -0
  574. data/spec/fixtures/unit/provider/parsedfile/simple.txt +3 -0
  575. data/spec/fixtures/unit/provider/service/openbsd/rcctl_getall +6 -0
  576. data/spec/fixtures/unit/ssl/certificate/old-style-cert-exts.pem +33 -0
  577. data/spec/fixtures/unit/ssl/certificate_request/old-style-cert-request.pem +28 -0
  578. data/spec/integration/agent/logging_spec.rb +1 -5
  579. data/spec/integration/application/apply_spec.rb +1 -1
  580. data/spec/integration/application/doc_spec.rb +1 -43
  581. data/spec/integration/configurer_spec.rb +5 -5
  582. data/spec/integration/data_binding.rb +4 -0
  583. data/spec/integration/defaults_spec.rb +42 -143
  584. data/spec/integration/directory_environments_spec.rb +3 -3
  585. data/spec/integration/environments/default_manifest_spec.rb +3 -51
  586. data/spec/integration/environments/setting_hooks_spec.rb +1 -1
  587. data/spec/integration/environments/settings_interpolation_spec.rb +50 -105
  588. data/spec/integration/environments/settings_spec.rb +100 -0
  589. data/spec/integration/faces/ca_spec.rb +51 -51
  590. data/spec/integration/faces/documentation_spec.rb +6 -6
  591. data/spec/integration/file_bucket/file_spec.rb +5 -16
  592. data/spec/integration/file_serving/fileset_spec.rb +1 -1
  593. data/spec/integration/file_serving/terminus_helper_spec.rb +1 -1
  594. data/spec/integration/indirector/catalog/compiler_spec.rb +6 -6
  595. data/spec/integration/indirector/direct_file_server_spec.rb +40 -12
  596. data/spec/integration/indirector/facts/facter_spec.rb +1 -1
  597. data/spec/integration/indirector/file_content/file_server_spec.rb +23 -21
  598. data/spec/integration/indirector/file_metadata/file_server_spec.rb +53 -0
  599. data/spec/integration/indirector/node/ldap_spec.rb +0 -0
  600. data/spec/integration/network/authconfig_spec.rb +26 -26
  601. data/spec/integration/network/formats_spec.rb +12 -12
  602. data/spec/integration/network/http/api/indirected_routes_spec.rb +56 -0
  603. data/spec/integration/node/environment_spec.rb +12 -15
  604. data/spec/integration/node/facts_spec.rb +3 -3
  605. data/spec/integration/node_spec.rb +8 -8
  606. data/spec/integration/parser/catalog_spec.rb +1 -32
  607. data/spec/integration/parser/class_spec.rb +0 -4
  608. data/spec/integration/parser/{collector_spec.rb → collection_spec.rb} +3 -27
  609. data/spec/integration/parser/compiler_spec.rb +769 -385
  610. data/spec/integration/parser/conditionals_spec.rb +2 -27
  611. data/spec/integration/parser/functions/require_spec.rb +8 -8
  612. data/spec/integration/parser/node_spec.rb +29 -42
  613. data/spec/integration/parser/resource_expressions_spec.rb +125 -210
  614. data/spec/integration/parser/scope_spec.rb +168 -319
  615. data/spec/integration/parser/undef_param_spec.rb +5 -5
  616. data/spec/integration/provider/cron/crontab_spec.rb +3 -3
  617. data/spec/integration/provider/mailalias/aliases_spec.rb +0 -0
  618. data/spec/integration/provider/mount_spec.rb +33 -28
  619. data/spec/integration/provider/package_spec.rb +3 -14
  620. data/spec/integration/provider/service/init_spec.rb +4 -4
  621. data/spec/integration/provider/service/systemd_spec.rb +3 -3
  622. data/spec/integration/provider/ssh_authorized_key_spec.rb +12 -12
  623. data/spec/integration/provider/sshkey_spec.rb +159 -0
  624. data/spec/integration/reference/providers_spec.rb +1 -1
  625. data/spec/integration/reports_spec.rb +1 -1
  626. data/spec/integration/resource/catalog_spec.rb +3 -3
  627. data/spec/integration/resource/type_collection_spec.rb +10 -25
  628. data/spec/integration/ssl/autosign_spec.rb +1 -1
  629. data/spec/integration/ssl/certificate_authority_spec.rb +8 -8
  630. data/spec/integration/ssl/certificate_request_spec.rb +2 -2
  631. data/spec/integration/ssl/certificate_revocation_list_spec.rb +0 -0
  632. data/spec/integration/ssl/host_spec.rb +7 -7
  633. data/spec/integration/transaction/report_spec.rb +0 -0
  634. data/spec/integration/transaction_spec.rb +86 -50
  635. data/spec/integration/type/exec_spec.rb +5 -5
  636. data/spec/integration/type/file_spec.rb +277 -280
  637. data/spec/integration/type/package_spec.rb +105 -6
  638. data/spec/integration/type/tidy_spec.rb +1 -1
  639. data/spec/integration/type/user_spec.rb +4 -4
  640. data/spec/integration/type_spec.rb +2 -2
  641. data/spec/integration/util/autoload_spec.rb +7 -12
  642. data/spec/integration/util/rdoc/parser_spec.rb +13 -99
  643. data/spec/integration/util/settings_spec.rb +1 -1
  644. data/spec/integration/util/windows/process_spec.rb +6 -6
  645. data/spec/integration/util/windows/security_spec.rb +79 -105
  646. data/spec/integration/util/windows/user_spec.rb +12 -12
  647. data/spec/integration/util_spec.rb +8 -8
  648. data/spec/lib/matchers/containment_matchers.rb +1 -1
  649. data/spec/lib/matchers/include.rb +3 -3
  650. data/spec/lib/matchers/include_in_order.rb +2 -2
  651. data/spec/lib/matchers/json.rb +5 -35
  652. data/spec/lib/matchers/match_tokens2.rb +1 -1
  653. data/spec/lib/matchers/relationship_graph_matchers.rb +1 -1
  654. data/spec/lib/matchers/resource.rb +8 -23
  655. data/spec/lib/puppet/face/1.0.0/huzzah.rb +2 -2
  656. data/spec/lib/puppet/face/basetest.rb +0 -0
  657. data/spec/lib/puppet/face/huzzah.rb +2 -2
  658. data/spec/lib/puppet/face/version_matching.rb +1 -1
  659. data/spec/lib/puppet/indirector_proxy.rb +34 -0
  660. data/spec/lib/puppet/indirector_testing.rb +1 -11
  661. data/spec/lib/puppet_spec/files.rb +1 -1
  662. data/spec/lib/puppet_spec/fixtures.rb +0 -0
  663. data/spec/lib/puppet_spec/handler.rb +53 -0
  664. data/spec/lib/puppet_spec/matchers.rb +12 -5
  665. data/spec/lib/puppet_spec/module_tool/shared_functions.rb +3 -3
  666. data/spec/lib/puppet_spec/modules.rb +11 -0
  667. data/spec/lib/puppet_spec/network.rb +101 -0
  668. data/spec/lib/puppet_spec/pops.rb +2 -2
  669. data/spec/lib/puppet_spec/settings.rb +17 -0
  670. data/spec/lib/puppet_spec/verbose.rb +0 -0
  671. data/spec/shared_behaviours/all_parsedfile_providers.rb +1 -1
  672. data/spec/shared_behaviours/an_indirector_face.rb +2 -2
  673. data/spec/shared_behaviours/documentation_on_faces.rb +46 -46
  674. data/spec/shared_behaviours/file_server_terminus.rb +1 -1
  675. data/spec/shared_behaviours/file_serving.rb +0 -0
  676. data/spec/shared_behaviours/hiera_indirections.rb +10 -10
  677. data/spec/shared_behaviours/iterative_functions.rb +1 -1
  678. data/spec/shared_behaviours/memory_terminus.rb +5 -5
  679. data/spec/shared_behaviours/path_parameters.rb +8 -8
  680. data/spec/shared_behaviours/store_configs_terminus.rb +3 -3
  681. data/spec/shared_behaviours/things_that_declare_options.rb +25 -25
  682. data/spec/shared_contexts/checksum.rb +62 -0
  683. data/spec/shared_contexts/{checksums.rb → digests.rb} +2 -2
  684. data/spec/spec_helper.rb +14 -5
  685. data/spec/unit/agent/disabler_spec.rb +3 -3
  686. data/spec/unit/agent/locker_spec.rb +9 -9
  687. data/spec/unit/agent_spec.rb +18 -18
  688. data/spec/unit/application/agent_spec.rb +25 -92
  689. data/spec/unit/application/apply_spec.rb +16 -16
  690. data/spec/unit/application/cert_spec.rb +15 -15
  691. data/spec/unit/application/certificate_spec.rb +2 -2
  692. data/spec/unit/application/config_spec.rb +1 -1
  693. data/spec/unit/application/describe_spec.rb +6 -6
  694. data/spec/unit/application/device_spec.rb +25 -63
  695. data/spec/unit/application/doc_spec.rb +22 -31
  696. data/spec/unit/application/face_base_spec.rb +88 -59
  697. data/spec/unit/application/facts_spec.rb +2 -11
  698. data/spec/unit/application/filebucket_spec.rb +7 -7
  699. data/spec/unit/application/indirection_base_spec.rb +0 -4
  700. data/spec/unit/application/inspect_spec.rb +21 -21
  701. data/spec/unit/application/master_spec.rb +8 -9
  702. data/spec/unit/application/resource_spec.rb +27 -79
  703. data/spec/unit/application_spec.rb +54 -58
  704. data/spec/unit/configurer/downloader_factory_spec.rb +0 -0
  705. data/spec/unit/configurer/downloader_spec.rb +26 -20
  706. data/spec/unit/configurer/fact_handler_spec.rb +19 -12
  707. data/spec/unit/configurer/plugin_handler_spec.rb +0 -0
  708. data/spec/unit/configurer_spec.rb +44 -44
  709. data/spec/unit/confine/exists_spec.rb +10 -10
  710. data/spec/unit/confine/false_spec.rb +7 -7
  711. data/spec/unit/confine/feature_spec.rb +7 -7
  712. data/spec/unit/confine/true_spec.rb +7 -7
  713. data/spec/unit/confine/variable_spec.rb +13 -13
  714. data/spec/unit/confine_collection_spec.rb +12 -12
  715. data/spec/unit/confine_spec.rb +10 -10
  716. data/spec/unit/confiner_spec.rb +8 -8
  717. data/spec/unit/context/trusted_information_spec.rb +9 -2
  718. data/spec/unit/daemon_spec.rb +10 -21
  719. data/spec/unit/data_binding_spec.rb +1 -1
  720. data/spec/unit/data_providers/function_data_provider_spec.rb +96 -0
  721. data/spec/unit/data_providers/sample_data_provider_spec.rb +52 -0
  722. data/spec/unit/defaults_spec.rb +6 -6
  723. data/spec/unit/environments_spec.rb +4 -6
  724. data/spec/unit/{util → external}/pson_spec.rb +15 -25
  725. data/spec/unit/face/catalog_spec.rb +0 -0
  726. data/spec/unit/face/certificate_spec.rb +19 -19
  727. data/spec/unit/face/config_spec.rb +2 -7
  728. data/spec/unit/face/epp_face_spec.rb +303 -0
  729. data/spec/unit/face/facts_spec.rb +1 -15
  730. data/spec/unit/face/file_spec.rb +3 -5
  731. data/spec/unit/face/help_spec.rb +17 -16
  732. data/spec/unit/face/module/build_spec.rb +2 -2
  733. data/spec/unit/face/module/list_spec.rb +11 -11
  734. data/spec/unit/face/module/search_spec.rb +17 -17
  735. data/spec/unit/face/node_spec.rb +4 -122
  736. data/spec/unit/face/parser_spec.rb +1 -1
  737. data/spec/unit/face/plugin_spec.rb +2 -2
  738. data/spec/unit/face_spec.rb +0 -0
  739. data/spec/unit/file_bucket/dipper_spec.rb +23 -23
  740. data/spec/unit/file_bucket/file_spec.rb +12 -28
  741. data/spec/unit/file_serving/base_spec.rb +26 -26
  742. data/spec/unit/file_serving/configuration/parser_spec.rb +10 -10
  743. data/spec/unit/file_serving/configuration_spec.rb +17 -17
  744. data/spec/unit/file_serving/content_spec.rb +19 -31
  745. data/spec/unit/file_serving/fileset_spec.rb +32 -33
  746. data/spec/unit/file_serving/metadata_spec.rb +115 -71
  747. data/spec/unit/file_serving/mount/file_spec.rb +15 -15
  748. data/spec/unit/file_serving/mount/modules_spec.rb +2 -2
  749. data/spec/unit/file_serving/mount/pluginfacts_spec.rb +5 -5
  750. data/spec/unit/file_serving/mount/plugins_spec.rb +5 -5
  751. data/spec/unit/file_serving/mount_spec.rb +5 -5
  752. data/spec/unit/file_serving/terminus_helper_spec.rb +19 -0
  753. data/spec/unit/file_serving/terminus_selector_spec.rb +6 -6
  754. data/spec/unit/file_system/uniquefile_spec.rb +2 -2
  755. data/spec/unit/file_system_spec.rb +79 -117
  756. data/spec/unit/forge/errors_spec.rb +8 -8
  757. data/spec/unit/forge/module_release_spec.rb +2 -4
  758. data/spec/unit/forge/repository_spec.rb +38 -44
  759. data/spec/unit/forge_spec.rb +1 -1
  760. data/spec/unit/functions/assert_type_spec.rb +1 -1
  761. data/spec/unit/functions/each_spec.rb +19 -23
  762. data/spec/unit/functions/epp_spec.rb +9 -17
  763. data/spec/unit/functions/filter_spec.rb +0 -22
  764. data/spec/unit/functions/hiera_spec.rb +18 -24
  765. data/spec/unit/functions/inline_epp_spec.rb +8 -16
  766. data/spec/unit/functions/lookup_spec.rb +324 -0
  767. data/spec/unit/functions/map_spec.rb +1 -7
  768. data/spec/unit/functions/reduce_spec.rb +0 -11
  769. data/spec/unit/functions/regsubst_spec.rb +94 -0
  770. data/spec/unit/functions/scanf_spec.rb +0 -4
  771. data/spec/unit/functions/slice_spec.rb +0 -12
  772. data/spec/unit/functions/split_spec.rb +46 -0
  773. data/spec/unit/functions/with_spec.rb +4 -13
  774. data/spec/unit/functions4_spec.rb +57 -162
  775. data/spec/unit/graph/rb_tree_map_spec.rb +78 -78
  776. data/spec/unit/graph/relationship_graph_spec.rb +17 -17
  777. data/spec/unit/graph/{simple_graph.rb → simple_graph_spec.rb} +122 -126
  778. data/spec/unit/hiera/scope_spec.rb +13 -12
  779. data/spec/unit/hiera_puppet_spec.rb +12 -12
  780. data/spec/unit/indirector/catalog/compiler_spec.rb +10 -15
  781. data/spec/unit/indirector/catalog/json_spec.rb +2 -2
  782. data/spec/unit/indirector/catalog/msgpack_spec.rb +2 -2
  783. data/spec/unit/indirector/catalog/rest_spec.rb +1 -1
  784. data/spec/unit/indirector/catalog/static_compiler_spec.rb +14 -14
  785. data/spec/unit/indirector/catalog/store_configs_spec.rb +0 -0
  786. data/spec/unit/indirector/catalog/yaml_spec.rb +4 -4
  787. data/spec/unit/indirector/certificate/ca_spec.rb +3 -3
  788. data/spec/unit/indirector/certificate/disabled_ca_spec.rb +0 -0
  789. data/spec/unit/indirector/certificate/file_spec.rb +3 -3
  790. data/spec/unit/indirector/certificate/rest_spec.rb +6 -6
  791. data/spec/unit/indirector/certificate_request/ca_spec.rb +8 -8
  792. data/spec/unit/indirector/certificate_request/disabled_ca_spec.rb +0 -0
  793. data/spec/unit/indirector/certificate_request/file_spec.rb +2 -2
  794. data/spec/unit/indirector/certificate_request/rest_spec.rb +4 -4
  795. data/spec/unit/indirector/certificate_revocation_list/ca_spec.rb +2 -2
  796. data/spec/unit/indirector/certificate_revocation_list/disabled_ca_spec.rb +0 -0
  797. data/spec/unit/indirector/certificate_revocation_list/file_spec.rb +2 -2
  798. data/spec/unit/indirector/certificate_revocation_list/rest_spec.rb +4 -4
  799. data/spec/unit/indirector/certificate_status/file_spec.rb +18 -18
  800. data/spec/unit/indirector/certificate_status/rest_spec.rb +2 -2
  801. data/spec/unit/indirector/code_spec.rb +3 -3
  802. data/spec/unit/indirector/data_binding/hiera_spec.rb +3 -3
  803. data/spec/unit/indirector/data_binding/none_spec.rb +5 -5
  804. data/spec/unit/indirector/direct_file_server_spec.rb +14 -4
  805. data/spec/unit/indirector/envelope_spec.rb +4 -4
  806. data/spec/unit/indirector/exec_spec.rb +4 -4
  807. data/spec/unit/indirector/face_spec.rb +13 -8
  808. data/spec/unit/indirector/facts/facter_spec.rb +10 -20
  809. data/spec/unit/indirector/facts/network_device_spec.rb +10 -20
  810. data/spec/unit/indirector/facts/store_configs_spec.rb +0 -0
  811. data/spec/unit/indirector/facts/yaml_spec.rb +6 -6
  812. data/spec/unit/indirector/file_bucket_file/file_spec.rb +34 -34
  813. data/spec/unit/indirector/file_bucket_file/rest_spec.rb +1 -1
  814. data/spec/unit/indirector/file_content/file_server_spec.rb +2 -2
  815. data/spec/unit/indirector/file_content/file_spec.rb +2 -2
  816. data/spec/unit/indirector/file_content/rest_spec.rb +1 -1
  817. data/spec/unit/indirector/file_metadata/file_server_spec.rb +2 -2
  818. data/spec/unit/indirector/file_metadata/file_spec.rb +13 -5
  819. data/spec/unit/indirector/file_metadata/rest_spec.rb +1 -1
  820. data/spec/unit/indirector/file_server_spec.rb +35 -17
  821. data/spec/unit/indirector/indirection_spec.rb +56 -56
  822. data/spec/unit/indirector/json_spec.rb +15 -16
  823. data/spec/unit/indirector/key/ca_spec.rb +3 -3
  824. data/spec/unit/indirector/key/disabled_ca_spec.rb +0 -0
  825. data/spec/unit/indirector/key/file_spec.rb +5 -5
  826. data/spec/unit/indirector/ldap_spec.rb +13 -13
  827. data/spec/unit/indirector/memory_spec.rb +0 -0
  828. data/spec/unit/indirector/msgpack_spec.rb +15 -15
  829. data/spec/unit/indirector/node/exec_spec.rb +20 -9
  830. data/spec/unit/indirector/node/ldap_spec.rb +48 -48
  831. data/spec/unit/indirector/node/memory_spec.rb +0 -0
  832. data/spec/unit/indirector/node/msgpack_spec.rb +4 -4
  833. data/spec/unit/indirector/node/plain_spec.rb +2 -2
  834. data/spec/unit/indirector/node/rest_spec.rb +0 -0
  835. data/spec/unit/indirector/node/store_configs_spec.rb +0 -0
  836. data/spec/unit/indirector/node/yaml_spec.rb +4 -4
  837. data/spec/unit/indirector/none_spec.rb +2 -2
  838. data/spec/unit/indirector/plain_spec.rb +1 -1
  839. data/spec/unit/indirector/report/msgpack_spec.rb +5 -5
  840. data/spec/unit/indirector/report/processor_spec.rb +4 -4
  841. data/spec/unit/indirector/report/rest_spec.rb +8 -8
  842. data/spec/unit/indirector/report/yaml_spec.rb +5 -5
  843. data/spec/unit/indirector/request_spec.rb +103 -206
  844. data/spec/unit/indirector/resource/ral_spec.rb +8 -10
  845. data/spec/unit/indirector/resource/store_configs_spec.rb +2 -4
  846. data/spec/unit/indirector/resource_type/parser_spec.rb +37 -37
  847. data/spec/unit/indirector/resource_type/rest_spec.rb +2 -2
  848. data/spec/unit/indirector/rest_spec.rb +70 -55
  849. data/spec/unit/indirector/ssl_file_spec.rb +13 -13
  850. data/spec/unit/indirector/status/rest_spec.rb +1 -1
  851. data/spec/unit/indirector/store_configs_spec.rb +0 -0
  852. data/spec/unit/indirector/terminus_spec.rb +17 -17
  853. data/spec/unit/indirector/yaml_spec.rb +12 -12
  854. data/spec/unit/indirector_spec.rb +7 -7
  855. data/spec/unit/interface/action_builder_spec.rb +15 -15
  856. data/spec/unit/interface/action_manager_spec.rb +31 -56
  857. data/spec/unit/interface/action_spec.rb +62 -65
  858. data/spec/unit/interface/documentation_spec.rb +2 -2
  859. data/spec/unit/interface/face_collection_spec.rb +33 -33
  860. data/spec/unit/interface/option_builder_spec.rb +8 -8
  861. data/spec/unit/interface/option_spec.rb +23 -23
  862. data/spec/unit/interface_spec.rb +19 -24
  863. data/spec/unit/man_spec.rb +0 -0
  864. data/spec/unit/module_spec.rb +163 -115
  865. data/spec/unit/module_tool/applications/builder_spec.rb +0 -19
  866. data/spec/unit/module_tool/applications/installer_spec.rb +29 -29
  867. data/spec/unit/module_tool/applications/searcher_spec.rb +4 -4
  868. data/spec/unit/module_tool/applications/uninstaller_spec.rb +15 -15
  869. data/spec/unit/module_tool/applications/unpacker_spec.rb +3 -3
  870. data/spec/unit/module_tool/applications/upgrader_spec.rb +28 -28
  871. data/spec/unit/module_tool/install_directory_spec.rb +3 -3
  872. data/spec/unit/module_tool/metadata_spec.rb +26 -26
  873. data/spec/unit/module_tool/tar/gnu_spec.rb +1 -1
  874. data/spec/unit/module_tool/tar/mini_spec.rb +2 -2
  875. data/spec/unit/module_tool/tar_spec.rb +2 -2
  876. data/spec/unit/module_tool_spec.rb +13 -34
  877. data/spec/unit/network/auth_config_parser_spec.rb +7 -7
  878. data/spec/unit/network/authconfig_spec.rb +9 -9
  879. data/spec/unit/network/authstore_spec.rb +38 -39
  880. data/spec/unit/network/format_handler_spec.rb +14 -14
  881. data/spec/unit/network/format_spec.rb +34 -34
  882. data/spec/unit/network/format_support_spec.rb +10 -10
  883. data/spec/unit/network/formats_spec.rb +50 -136
  884. data/spec/unit/network/http/api/ca/v1_spec.rb +26 -0
  885. data/spec/unit/network/http/api/{v1_spec.rb → indirected_routes_spec.rb} +128 -184
  886. data/spec/unit/network/http/api/{v2 → master/v3}/authorization_spec.rb +23 -21
  887. data/spec/unit/network/http/api/{v2 → master/v3}/environments_spec.rb +5 -5
  888. data/spec/unit/network/http/api/master/v3_spec.rb +39 -0
  889. data/spec/unit/network/http/api_spec.rb +127 -0
  890. data/spec/unit/network/http/compression_spec.rb +20 -26
  891. data/spec/unit/network/http/connection_spec.rb +2 -5
  892. data/spec/unit/network/http/factory_spec.rb +6 -8
  893. data/spec/unit/network/http/handler_spec.rb +31 -84
  894. data/spec/unit/network/http/nocache_pool_spec.rb +0 -0
  895. data/spec/unit/network/http/pool_spec.rb +0 -0
  896. data/spec/unit/network/http/rack/rest_spec.rb +38 -39
  897. data/spec/unit/network/http/rack_spec.rb +1 -1
  898. data/spec/unit/network/http/route_spec.rb +3 -3
  899. data/spec/unit/network/http/session_spec.rb +4 -4
  900. data/spec/unit/network/http/site_spec.rb +1 -1
  901. data/spec/unit/network/http/webrick/rest_spec.rb +36 -55
  902. data/spec/unit/network/http/webrick_spec.rb +16 -27
  903. data/spec/unit/network/http_pool_spec.rb +11 -11
  904. data/spec/unit/network/http_spec.rb +0 -0
  905. data/spec/unit/network/resolver_spec.rb +10 -10
  906. data/spec/unit/network/rights_spec.rb +67 -67
  907. data/spec/unit/network/server_spec.rb +3 -3
  908. data/spec/unit/node/environment_spec.rb +177 -273
  909. data/spec/unit/node/facts_spec.rb +71 -33
  910. data/spec/unit/node_spec.rb +150 -158
  911. data/spec/unit/other/selinux_spec.rb +6 -6
  912. data/spec/unit/parameter/boolean_spec.rb +4 -3
  913. data/spec/unit/parameter/package_options_spec.rb +5 -5
  914. data/spec/unit/parameter/path_spec.rb +1 -1
  915. data/spec/unit/parameter/value_collection_spec.rb +23 -28
  916. data/spec/unit/parameter/value_spec.rb +20 -24
  917. data/spec/unit/parameter_spec.rb +26 -26
  918. data/spec/unit/parser/ast/block_expression_spec.rb +3 -2
  919. data/spec/unit/parser/ast/leaf_spec.rb +5 -378
  920. data/spec/unit/parser/compiler_spec.rb +84 -74
  921. data/spec/unit/parser/files_spec.rb +55 -121
  922. data/spec/unit/parser/functions/contain_spec.rb +8 -11
  923. data/spec/unit/parser/functions/create_resources_spec.rb +29 -29
  924. data/spec/unit/parser/functions/defined_spec.rb +52 -51
  925. data/spec/unit/parser/functions/digest_spec.rb +2 -2
  926. data/spec/unit/parser/functions/fail_spec.rb +1 -1
  927. data/spec/unit/parser/functions/file_spec.rb +7 -13
  928. data/spec/unit/parser/functions/fqdn_rand_spec.rb +5 -5
  929. data/spec/unit/parser/functions/generate_spec.rb +20 -20
  930. data/spec/unit/parser/functions/hiera_array_spec.rb +2 -16
  931. data/spec/unit/parser/functions/hiera_hash_spec.rb +2 -12
  932. data/spec/unit/parser/functions/hiera_include_spec.rb +2 -29
  933. data/spec/unit/parser/functions/hiera_spec.rb +2 -12
  934. data/spec/unit/parser/functions/include_spec.rb +9 -19
  935. data/spec/unit/parser/functions/inline_template_spec.rb +3 -3
  936. data/spec/unit/parser/functions/lookup_spec.rb +3 -140
  937. data/spec/unit/parser/functions/realize_spec.rb +0 -0
  938. data/spec/unit/parser/functions/regsubst_spec.rb +7 -179
  939. data/spec/unit/parser/functions/require_spec.rb +14 -21
  940. data/spec/unit/parser/functions/scanf_spec.rb +0 -0
  941. data/spec/unit/parser/functions/shellquote_spec.rb +20 -20
  942. data/spec/unit/parser/functions/split_spec.rb +2 -37
  943. data/spec/unit/parser/functions/sprintf_spec.rb +7 -11
  944. data/spec/unit/parser/functions/tag_spec.rb +3 -3
  945. data/spec/unit/parser/functions/template_spec.rb +10 -10
  946. data/spec/unit/parser/functions/versioncmp_spec.rb +3 -3
  947. data/spec/unit/parser/functions_spec.rb +8 -8
  948. data/spec/unit/parser/relationship_spec.rb +14 -32
  949. data/spec/unit/parser/resource/param_spec.rb +0 -0
  950. data/spec/unit/parser/resource_spec.rb +57 -57
  951. data/spec/unit/parser/scope_spec.rb +89 -101
  952. data/spec/unit/parser/templatewrapper_spec.rb +15 -32
  953. data/spec/unit/parser/type_loader_spec.rb +53 -73
  954. data/spec/unit/pops/adaptable_spec.rb +22 -22
  955. data/spec/unit/pops/binder/bindings_checker_spec.rb +14 -14
  956. data/spec/unit/pops/binder/bindings_composer_spec.rb +4 -6
  957. data/spec/unit/pops/binder/bindings_validator_factory_spec.rb +3 -3
  958. data/spec/unit/pops/binder/config/binder_config_spec.rb +8 -1
  959. data/spec/unit/pops/binder/injector_spec.rb +92 -92
  960. data/spec/unit/pops/containment_spec.rb +4 -4
  961. data/spec/unit/pops/evaluator/access_ops_spec.rb +5 -24
  962. data/spec/unit/pops/evaluator/arithmetic_ops_spec.rb +23 -23
  963. data/spec/unit/pops/evaluator/basic_expressions_spec.rb +22 -22
  964. data/spec/unit/pops/evaluator/collections_ops_spec.rb +1 -3
  965. data/spec/unit/pops/evaluator/comparison_ops_spec.rb +104 -107
  966. data/spec/unit/pops/evaluator/conditionals_spec.rb +39 -39
  967. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +75 -143
  968. data/spec/unit/pops/evaluator/evaluator_rspec_helper.rb +1 -5
  969. data/spec/unit/pops/evaluator/logical_ops_spec.rb +15 -15
  970. data/spec/unit/pops/evaluator/string_interpolation_spec.rb +5 -5
  971. data/spec/unit/pops/evaluator/variables_spec.rb +18 -18
  972. data/spec/unit/pops/factory_rspec_helper.rb +0 -8
  973. data/spec/unit/pops/factory_spec.rb +104 -104
  974. data/spec/unit/pops/issues_spec.rb +21 -21
  975. data/spec/unit/pops/label_provider_spec.rb +6 -6
  976. data/spec/unit/pops/loaders/loaders_spec.rb +3 -3
  977. data/spec/unit/pops/model/model_spec.rb +10 -10
  978. data/spec/unit/pops/parser/epp_parser_spec.rb +20 -20
  979. data/spec/unit/pops/parser/evaluating_parser_spec.rb +2 -2
  980. data/spec/unit/pops/parser/lexer2_spec.rb +65 -276
  981. data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +91 -91
  982. data/spec/unit/pops/parser/parse_calls_spec.rb +19 -19
  983. data/spec/unit/pops/parser/parse_conditionals_spec.rb +38 -22
  984. data/spec/unit/pops/parser/parse_containers_spec.rb +47 -47
  985. data/spec/unit/pops/parser/parse_heredoc_spec.rb +15 -62
  986. data/spec/unit/pops/parser/parse_resource_spec.rb +75 -70
  987. data/spec/unit/pops/parser/parser_rspec_helper.rb +0 -5
  988. data/spec/unit/pops/parser/parser_spec.rb +7 -7
  989. data/spec/unit/pops/parser/parsing_typed_parameters_spec.rb +0 -7
  990. data/spec/unit/pops/parser/rgen_sanitycheck_spec.rb +2 -2
  991. data/spec/unit/pops/types/class_loader_spec.rb +10 -0
  992. data/spec/unit/pops/types/type_calculator_spec.rb +456 -651
  993. data/spec/unit/pops/types/type_factory_spec.rb +59 -59
  994. data/spec/unit/pops/types/type_parser_spec.rb +2 -10
  995. data/spec/unit/pops/validator/validator_spec.rb +3 -57
  996. data/spec/unit/pops/visitor_spec.rb +4 -4
  997. data/spec/unit/property/boolean_spec.rb +2 -2
  998. data/spec/unit/property/ensure_spec.rb +1 -1
  999. data/spec/unit/property/keyvalue_spec.rb +16 -16
  1000. data/spec/unit/property/list_spec.rb +18 -18
  1001. data/spec/unit/property/ordered_list_spec.rb +7 -7
  1002. data/spec/unit/property_spec.rb +72 -96
  1003. data/spec/unit/provider/aixobject_spec.rb +12 -12
  1004. data/spec/unit/provider/augeas/augeas_spec.rb +171 -149
  1005. data/spec/unit/provider/cisco_spec.rb +2 -2
  1006. data/spec/unit/provider/command_spec.rb +1 -1
  1007. data/spec/unit/provider/cron/crontab_spec.rb +9 -9
  1008. data/spec/unit/provider/cron/parsed_spec.rb +59 -38
  1009. data/spec/unit/provider/exec/posix_spec.rb +9 -19
  1010. data/spec/unit/provider/exec/shell_spec.rb +13 -13
  1011. data/spec/unit/provider/exec/windows_spec.rb +10 -10
  1012. data/spec/unit/provider/exec_spec.rb +2 -2
  1013. data/spec/unit/provider/file/posix_spec.rb +27 -27
  1014. data/spec/unit/provider/file/windows_spec.rb +15 -15
  1015. data/spec/unit/provider/group/groupadd_spec.rb +1 -1
  1016. data/spec/unit/provider/group/ldap_spec.rb +11 -11
  1017. data/spec/unit/provider/group/pw_spec.rb +3 -3
  1018. data/spec/unit/provider/group/windows_adsi_spec.rb +48 -62
  1019. data/spec/unit/provider/host/parsed_spec.rb +58 -22
  1020. data/spec/unit/provider/interface/cisco_spec.rb +3 -3
  1021. data/spec/unit/provider/ldap_spec.rb +23 -23
  1022. data/spec/unit/provider/macauthorization_spec.rb +6 -6
  1023. data/spec/unit/provider/mcx/mcxcontent_spec.rb +6 -6
  1024. data/spec/unit/provider/mount/parsed_spec.rb +101 -119
  1025. data/spec/unit/provider/mount_spec.rb +0 -0
  1026. data/spec/unit/provider/naginator_spec.rb +8 -8
  1027. data/spec/unit/provider/nameservice/directoryservice_spec.rb +5 -27
  1028. data/spec/unit/provider/nameservice_spec.rb +26 -26
  1029. data/spec/unit/provider/network_device_spec.rb +11 -11
  1030. data/spec/unit/provider/package/aix_spec.rb +3 -3
  1031. data/spec/unit/provider/package/appdmg_spec.rb +1 -1
  1032. data/spec/unit/provider/package/apt_spec.rb +4 -4
  1033. data/spec/unit/provider/package/aptitude_spec.rb +1 -1
  1034. data/spec/unit/provider/package/aptrpm_spec.rb +3 -3
  1035. data/spec/unit/provider/package/dpkg_spec.rb +0 -0
  1036. data/spec/unit/provider/package/freebsd_spec.rb +1 -1
  1037. data/spec/unit/provider/package/gem_spec.rb +12 -12
  1038. data/spec/unit/provider/package/hpux_spec.rb +3 -3
  1039. data/spec/unit/provider/package/macports_spec.rb +15 -15
  1040. data/spec/unit/provider/package/nim_spec.rb +11 -11
  1041. data/spec/unit/provider/package/openbsd_spec.rb +72 -37
  1042. data/spec/unit/provider/package/opkg_spec.rb +14 -11
  1043. data/spec/unit/provider/package/pacman_spec.rb +185 -86
  1044. data/spec/unit/provider/package/pip_spec.rb +25 -54
  1045. data/spec/unit/provider/package/pkg_spec.rb +145 -71
  1046. data/spec/unit/provider/package/pkgdmg_spec.rb +9 -9
  1047. data/spec/unit/provider/package/pkgin_spec.rb +18 -18
  1048. data/spec/unit/provider/package/pkgutil_spec.rb +19 -19
  1049. data/spec/unit/provider/package/portage_spec.rb +8 -4
  1050. data/spec/unit/provider/package/rpm_spec.rb +103 -9
  1051. data/spec/unit/provider/package/sun_spec.rb +14 -14
  1052. data/spec/unit/provider/package/up2date_spec.rb +1 -1
  1053. data/spec/unit/provider/package/{urpmi.rb → urpmi_spec.rb} +3 -3
  1054. data/spec/unit/provider/package/windows/exe_package_spec.rb +15 -13
  1055. data/spec/unit/provider/package/windows/msi_package_spec.rb +16 -16
  1056. data/spec/unit/provider/package/windows/package_spec.rb +14 -14
  1057. data/spec/unit/provider/package/windows_spec.rb +26 -26
  1058. data/spec/unit/provider/package/yum_spec.rb +292 -98
  1059. data/spec/unit/provider/package/zypper_spec.rb +20 -31
  1060. data/spec/unit/provider/parsedfile_spec.rb +9 -9
  1061. data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +192 -434
  1062. data/spec/unit/provider/selboolean_spec.rb +2 -2
  1063. data/spec/unit/provider/selmodule_spec.rb +8 -8
  1064. data/spec/unit/provider/service/base_spec.rb +27 -38
  1065. data/spec/unit/provider/service/daemontools_spec.rb +11 -11
  1066. data/spec/unit/provider/service/debian_spec.rb +8 -8
  1067. data/spec/unit/provider/service/freebsd_spec.rb +7 -8
  1068. data/spec/unit/provider/service/gentoo_spec.rb +12 -13
  1069. data/spec/unit/provider/service/init_spec.rb +25 -38
  1070. data/spec/unit/provider/service/launchd_spec.rb +19 -125
  1071. data/spec/unit/provider/service/openbsd_spec.rb +90 -144
  1072. data/spec/unit/provider/service/openrc_spec.rb +14 -14
  1073. data/spec/unit/provider/service/openwrt_spec.rb +9 -9
  1074. data/spec/unit/provider/service/redhat_spec.rb +14 -15
  1075. data/spec/unit/provider/service/runit_spec.rb +11 -11
  1076. data/spec/unit/provider/service/smf_spec.rb +19 -19
  1077. data/spec/unit/provider/service/src_spec.rb +9 -9
  1078. data/spec/unit/provider/service/systemd_spec.rb +33 -15
  1079. data/spec/unit/provider/service/upstart_spec.rb +59 -59
  1080. data/spec/unit/provider/service/windows_spec.rb +6 -6
  1081. data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +18 -18
  1082. data/spec/unit/provider/sshkey/parsed_spec.rb +11 -11
  1083. data/spec/unit/provider/user/aix_spec.rb +19 -19
  1084. data/spec/unit/provider/user/directoryservice_spec.rb +51 -95
  1085. data/spec/unit/provider/user/hpux_spec.rb +24 -3
  1086. data/spec/unit/provider/user/ldap_spec.rb +12 -12
  1087. data/spec/unit/provider/user/openbsd_spec.rb +77 -0
  1088. data/spec/unit/provider/user/pw_spec.rb +5 -5
  1089. data/spec/unit/provider/user/user_role_add_spec.rb +20 -20
  1090. data/spec/unit/provider/user/useradd_spec.rb +48 -32
  1091. data/spec/unit/provider/user/windows_adsi_spec.rb +9 -31
  1092. data/spec/unit/provider/vlan/cisco_spec.rb +3 -3
  1093. data/spec/unit/provider/yumrepo/inifile_spec.rb +3 -3
  1094. data/spec/unit/provider/zfs/zfs_spec.rb +11 -11
  1095. data/spec/unit/provider/zone/solaris_spec.rb +22 -55
  1096. data/spec/unit/provider/zpool/zpool_spec.rb +22 -22
  1097. data/spec/unit/provider_spec.rb +110 -102
  1098. data/spec/unit/puppet_spec.rb +15 -8
  1099. data/spec/unit/relationship_spec.rb +37 -41
  1100. data/spec/unit/reports/http_spec.rb +0 -0
  1101. data/spec/unit/reports/store_spec.rb +3 -3
  1102. data/spec/unit/reports_spec.rb +5 -5
  1103. data/spec/unit/resource/catalog_spec.rb +93 -111
  1104. data/spec/unit/resource/status_spec.rb +49 -75
  1105. data/spec/unit/resource/type_collection_helper_spec.rb +1 -1
  1106. data/spec/unit/resource/type_collection_spec.rb +59 -164
  1107. data/spec/unit/resource/type_spec.rb +115 -120
  1108. data/spec/unit/resource_spec.rb +176 -159
  1109. data/spec/unit/scheduler/job_spec.rb +12 -12
  1110. data/spec/unit/scheduler/scheduler_spec.rb +8 -8
  1111. data/spec/unit/scheduler/splay_job_spec.rb +4 -4
  1112. data/spec/unit/semver_spec.rb +66 -64
  1113. data/spec/unit/settings/autosign_setting_spec.rb +1 -0
  1114. data/spec/unit/settings/config_file_spec.rb +13 -40
  1115. data/spec/unit/settings/directory_setting_spec.rb +1 -1
  1116. data/spec/unit/settings/duration_setting_spec.rb +9 -5
  1117. data/spec/unit/settings/environment_conf_spec.rb +0 -11
  1118. data/spec/unit/settings/file_setting_spec.rb +38 -69
  1119. data/spec/unit/settings/ini_file_spec.rb +2 -2
  1120. data/spec/unit/settings/path_setting_spec.rb +5 -5
  1121. data/spec/unit/settings/priority_setting_spec.rb +7 -7
  1122. data/spec/unit/settings/string_setting_spec.rb +7 -7
  1123. data/spec/unit/settings/terminus_setting_spec.rb +4 -4
  1124. data/spec/unit/settings/value_translator_spec.rb +22 -22
  1125. data/spec/unit/settings_spec.rb +189 -338
  1126. data/spec/unit/ssl/base_spec.rb +5 -5
  1127. data/spec/unit/ssl/certificate_authority/autosign_command_spec.rb +2 -2
  1128. data/spec/unit/ssl/certificate_authority/interface_spec.rb +40 -13
  1129. data/spec/unit/ssl/certificate_authority_spec.rb +23 -23
  1130. data/spec/unit/ssl/certificate_factory_spec.rb +39 -26
  1131. data/spec/unit/ssl/certificate_request_attributes_spec.rb +2 -2
  1132. data/spec/unit/ssl/certificate_request_spec.rb +52 -40
  1133. data/spec/unit/ssl/certificate_revocation_list_spec.rb +10 -10
  1134. data/spec/unit/ssl/certificate_spec.rb +35 -38
  1135. data/spec/unit/ssl/configuration_spec.rb +12 -14
  1136. data/spec/unit/ssl/digest_spec.rb +5 -5
  1137. data/spec/unit/ssl/host_spec.rb +91 -91
  1138. data/spec/unit/ssl/inventory_spec.rb +11 -34
  1139. data/spec/unit/ssl/key_spec.rb +23 -23
  1140. data/spec/unit/ssl/oids_spec.rb +28 -15
  1141. data/spec/unit/ssl/validator_spec.rb +16 -17
  1142. data/spec/unit/status_spec.rb +6 -12
  1143. data/spec/unit/transaction/additional_resource_generator_spec.rb +2 -2
  1144. data/spec/unit/transaction/event_manager_spec.rb +38 -8
  1145. data/spec/unit/transaction/event_spec.rb +29 -29
  1146. data/spec/unit/transaction/report_spec.rb +76 -90
  1147. data/spec/unit/transaction/resource_harness_spec.rb +42 -42
  1148. data/spec/unit/transaction_spec.rb +66 -59
  1149. data/spec/unit/type/augeas_spec.rb +20 -20
  1150. data/spec/unit/type/component_spec.rb +10 -10
  1151. data/spec/unit/type/computer_spec.rb +10 -10
  1152. data/spec/unit/type/cron_spec.rb +21 -21
  1153. data/spec/unit/type/exec_spec.rb +65 -73
  1154. data/spec/unit/type/file/checksum_spec.rb +8 -8
  1155. data/spec/unit/type/file/content_spec.rb +144 -85
  1156. data/spec/unit/type/file/ctime_spec.rb +4 -4
  1157. data/spec/unit/type/file/ensure_spec.rb +11 -11
  1158. data/spec/unit/type/file/group_spec.rb +5 -5
  1159. data/spec/unit/type/file/mode_spec.rb +30 -28
  1160. data/spec/unit/type/file/mtime_spec.rb +4 -4
  1161. data/spec/unit/type/file/owner_spec.rb +5 -5
  1162. data/spec/unit/type/file/selinux_spec.rb +8 -8
  1163. data/spec/unit/type/file/source_spec.rb +118 -135
  1164. data/spec/unit/type/file/type_spec.rb +2 -2
  1165. data/spec/unit/type/file_spec.rb +161 -160
  1166. data/spec/unit/type/filebucket_spec.rb +8 -8
  1167. data/spec/unit/type/group_spec.rb +12 -12
  1168. data/spec/unit/type/host_spec.rb +41 -25
  1169. data/spec/unit/type/interface_spec.rb +6 -6
  1170. data/spec/unit/type/k5login_spec.rb +18 -18
  1171. data/spec/unit/type/macauthorization_spec.rb +17 -17
  1172. data/spec/unit/type/mailalias_spec.rb +34 -6
  1173. data/spec/unit/type/maillist_spec.rb +2 -2
  1174. data/spec/unit/type/mcx_spec.rb +13 -13
  1175. data/spec/unit/type/mount_spec.rb +40 -40
  1176. data/spec/unit/type/nagios_spec.rb +23 -23
  1177. data/spec/unit/type/noop_metaparam_spec.rb +5 -5
  1178. data/spec/unit/type/package/package_settings_spec.rb +9 -9
  1179. data/spec/unit/type/package_spec.rb +87 -18
  1180. data/spec/unit/type/resources_spec.rb +46 -46
  1181. data/spec/unit/type/schedule_spec.rb +83 -83
  1182. data/spec/unit/type/scheduled_task_spec.rb +15 -15
  1183. data/spec/unit/type/selboolean_spec.rb +2 -2
  1184. data/spec/unit/type/selmodule_spec.rb +2 -2
  1185. data/spec/unit/type/service_spec.rb +24 -24
  1186. data/spec/unit/type/ssh_authorized_key_spec.rb +2 -2
  1187. data/spec/unit/type/sshkey_spec.rb +0 -0
  1188. data/spec/unit/type/stage_spec.rb +1 -1
  1189. data/spec/unit/type/tidy_spec.rb +58 -39
  1190. data/spec/unit/type/user_spec.rb +56 -56
  1191. data/spec/unit/type/vlan_spec.rb +6 -6
  1192. data/spec/unit/type/whit_spec.rb +1 -1
  1193. data/spec/unit/type/yumrepo_spec.rb +15 -0
  1194. data/spec/unit/type/zfs_spec.rb +3 -3
  1195. data/spec/unit/type/zone_spec.rb +19 -19
  1196. data/spec/unit/type/zpool_spec.rb +15 -15
  1197. data/spec/unit/type_spec.rb +236 -163
  1198. data/spec/unit/util/autoload_spec.rb +31 -25
  1199. data/spec/unit/util/backups_spec.rb +4 -4
  1200. data/spec/unit/util/checksums_spec.rb +55 -27
  1201. data/spec/unit/util/colors_spec.rb +6 -50
  1202. data/spec/unit/util/command_line_spec.rb +13 -41
  1203. data/spec/unit/util/command_line_utils/puppet_option_parser_spec.rb +2 -2
  1204. data/spec/unit/util/constant_inflector_spec.rb +12 -12
  1205. data/spec/unit/util/diff_spec.rb +4 -4
  1206. data/spec/unit/util/errors_spec.rb +5 -5
  1207. data/spec/unit/util/execution_spec.rb +74 -29
  1208. data/spec/unit/util/execution_stub_spec.rb +10 -10
  1209. data/spec/unit/util/feature_spec.rb +15 -19
  1210. data/spec/unit/util/filetype_spec.rb +9 -9
  1211. data/spec/unit/util/http_proxy_spec.rb +18 -18
  1212. data/spec/unit/util/inifile_spec.rb +2 -2
  1213. data/spec/unit/util/json_lockfile_spec.rb +1 -1
  1214. data/spec/unit/util/ldap/connection_spec.rb +6 -6
  1215. data/spec/unit/util/ldap/generator_spec.rb +8 -8
  1216. data/spec/unit/util/ldap/manager_spec.rb +40 -40
  1217. data/spec/unit/util/lockfile_spec.rb +13 -13
  1218. data/spec/unit/util/log/destinations_spec.rb +52 -49
  1219. data/spec/unit/util/log_spec.rb +48 -173
  1220. data/spec/unit/util/logging_spec.rb +120 -3
  1221. data/spec/unit/util/metric_spec.rb +18 -33
  1222. data/spec/unit/util/monkey_patches_spec.rb +18 -139
  1223. data/spec/unit/util/nagios_maker_spec.rb +2 -2
  1224. data/spec/unit/util/network_device/cisco/device_spec.rb +23 -23
  1225. data/spec/unit/util/network_device/cisco/facts_spec.rb +3 -3
  1226. data/spec/unit/util/network_device/cisco/interface_spec.rb +0 -0
  1227. data/spec/unit/util/network_device/config_spec.rb +10 -16
  1228. data/spec/unit/util/network_device/ipcalc_spec.rb +10 -10
  1229. data/spec/unit/util/network_device/transport/base_spec.rb +2 -2
  1230. data/spec/unit/util/network_device/transport/ssh_spec.rb +10 -10
  1231. data/spec/unit/util/network_device/transport/telnet_spec.rb +3 -3
  1232. data/spec/unit/util/network_device_spec.rb +2 -2
  1233. data/spec/unit/util/package_spec.rb +2 -2
  1234. data/spec/unit/util/pidlock_spec.rb +38 -38
  1235. data/spec/unit/util/posix_spec.rb +25 -25
  1236. data/spec/unit/util/profiler/aggregate_spec.rb +14 -18
  1237. data/spec/unit/util/profiler/around_profiler_spec.rb +6 -6
  1238. data/spec/unit/util/profiler/logging_spec.rb +8 -8
  1239. data/spec/unit/util/profiler/object_counts_spec.rb +3 -5
  1240. data/spec/unit/util/profiler/wall_clock_spec.rb +1 -1
  1241. data/spec/unit/util/profiler_spec.rb +6 -14
  1242. data/spec/unit/util/rdoc_spec.rb +0 -85
  1243. data/spec/unit/util/reference_spec.rb +1 -1
  1244. data/spec/unit/util/resource_template_spec.rb +2 -2
  1245. data/spec/unit/util/{retryaction_spec.rb → retry_action_spec.rb} +25 -2
  1246. data/spec/unit/util/rubygems_spec.rb +8 -8
  1247. data/spec/unit/util/run_mode_spec.rb +159 -17
  1248. data/spec/unit/util/selinux_spec.rb +61 -39
  1249. data/spec/unit/util/ssl_spec.rb +13 -13
  1250. data/spec/unit/util/storage_spec.rb +27 -27
  1251. data/spec/unit/util/suidmanager_spec.rb +56 -67
  1252. data/spec/unit/util/symbolic_file_mode_spec.rb +15 -16
  1253. data/spec/unit/util/tag_set_spec.rb +5 -5
  1254. data/spec/unit/util/tagging_spec.rb +0 -0
  1255. data/spec/unit/util/terminal_spec.rb +5 -5
  1256. data/spec/unit/util/user_attr_spec.rb +6 -6
  1257. data/spec/unit/util/warnings_spec.rb +9 -1
  1258. data/spec/unit/util/watcher_spec.rb +1 -1
  1259. data/spec/unit/util/windows/access_control_entry_spec.rb +9 -9
  1260. data/spec/unit/util/windows/access_control_list_spec.rb +21 -21
  1261. data/spec/unit/util/windows/adsi_spec.rb +71 -209
  1262. data/spec/unit/util/windows/api_types_spec.rb +3 -3
  1263. data/spec/unit/util/windows/registry_spec.rb +71 -46
  1264. data/spec/unit/util/windows/root_certs_spec.rb +1 -1
  1265. data/spec/unit/util/windows/security_descriptor_spec.rb +18 -18
  1266. data/spec/unit/util/windows/sid_spec.rb +40 -20
  1267. data/spec/unit/util/windows/string_spec.rb +4 -4
  1268. data/spec/unit/util/yaml_spec.rb +1 -1
  1269. data/spec/unit/util_spec.rb +73 -124
  1270. data/spec/unit/version_spec.rb +4 -4
  1271. data/spec/watchr.rb +1 -5
  1272. data/tasks/benchmark.rake +1 -6
  1273. data/tasks/ci.rake +1 -1
  1274. data/tasks/manpages.rake +0 -9
  1275. data/tasks/parallel.rake +4 -7
  1276. data/tasks/parser.rake +0 -5
  1277. metadata +175 -461
  1278. data/conf/tagmail.conf +0 -16
  1279. data/ext/debian/puppet.conf +0 -14
  1280. data/ext/debian/puppetmaster-common.puppetqd.default +0 -27
  1281. data/ext/debian/puppetmaster-common.puppetqd.init +0 -84
  1282. data/ext/gentoo/puppet/puppet.conf +0 -25
  1283. data/ext/ips/puppet.conf +0 -29
  1284. data/ext/nagios/naggen +0 -309
  1285. data/ext/puppet-load.rb +0 -393
  1286. data/ext/redhat/puppet.conf +0 -25
  1287. data/ext/redhat/queue.init +0 -105
  1288. data/lib/hiera/backend/puppet_backend.rb +0 -103
  1289. data/lib/puppet/application/instrumentation_data.rb +0 -7
  1290. data/lib/puppet/application/instrumentation_listener.rb +0 -7
  1291. data/lib/puppet/application/instrumentation_probe.rb +0 -7
  1292. data/lib/puppet/application/kick.rb +0 -351
  1293. data/lib/puppet/application/queue.rb +0 -161
  1294. data/lib/puppet/application/secret_agent.rb +0 -9
  1295. data/lib/puppet/dsl.rb +0 -7
  1296. data/lib/puppet/dsl/resource_api.rb +0 -120
  1297. data/lib/puppet/dsl/resource_type_api.rb +0 -34
  1298. data/lib/puppet/face/instrumentation_data.rb +0 -30
  1299. data/lib/puppet/face/instrumentation_listener.rb +0 -98
  1300. data/lib/puppet/face/instrumentation_probe.rb +0 -79
  1301. data/lib/puppet/face/secret_agent.rb +0 -54
  1302. data/lib/puppet/feature/pson.rb +0 -4
  1303. data/lib/puppet/feature/rails.rb +0 -47
  1304. data/lib/puppet/feature/rdoc1.rb +0 -16
  1305. data/lib/puppet/feature/rubygems.rb +0 -7
  1306. data/lib/puppet/feature/stomp.rb +0 -5
  1307. data/lib/puppet/file_collection.rb +0 -19
  1308. data/lib/puppet/file_collection/lookup.rb +0 -10
  1309. data/lib/puppet/file_system/file18.rb +0 -5
  1310. data/lib/puppet/functions/defined.rb +0 -130
  1311. data/lib/puppet/indirector/active_record.rb +0 -29
  1312. data/lib/puppet/indirector/catalog/active_record.rb +0 -39
  1313. data/lib/puppet/indirector/catalog/queue.rb +0 -9
  1314. data/lib/puppet/indirector/couch.rb +0 -78
  1315. data/lib/puppet/indirector/facts/active_record.rb +0 -44
  1316. data/lib/puppet/indirector/facts/couch.rb +0 -36
  1317. data/lib/puppet/indirector/facts/inventory_active_record.rb +0 -110
  1318. data/lib/puppet/indirector/facts/inventory_service.rb +0 -20
  1319. data/lib/puppet/indirector/facts/rest.rb +0 -8
  1320. data/lib/puppet/indirector/instrumentation_data.rb +0 -3
  1321. data/lib/puppet/indirector/instrumentation_data/local.rb +0 -22
  1322. data/lib/puppet/indirector/instrumentation_data/rest.rb +0 -8
  1323. data/lib/puppet/indirector/instrumentation_listener.rb +0 -3
  1324. data/lib/puppet/indirector/instrumentation_listener/local.rb +0 -26
  1325. data/lib/puppet/indirector/instrumentation_listener/rest.rb +0 -8
  1326. data/lib/puppet/indirector/instrumentation_probe.rb +0 -3
  1327. data/lib/puppet/indirector/instrumentation_probe/local.rb +0 -27
  1328. data/lib/puppet/indirector/instrumentation_probe/rest.rb +0 -8
  1329. data/lib/puppet/indirector/node/active_record.rb +0 -22
  1330. data/lib/puppet/indirector/queue.rb +0 -80
  1331. data/lib/puppet/indirector/resource/active_record.rb +0 -104
  1332. data/lib/puppet/indirector/resource/rest.rb +0 -17
  1333. data/lib/puppet/indirector/run/local.rb +0 -15
  1334. data/lib/puppet/indirector/run/rest.rb +0 -12
  1335. data/lib/puppet/module_tool/modulefile.rb +0 -78
  1336. data/lib/puppet/network/authentication.rb +0 -35
  1337. data/lib/puppet/network/http/api/v2.rb +0 -32
  1338. data/lib/puppet/network/http/api/v2/authorization.rb +0 -15
  1339. data/lib/puppet/parser/ast/arithmetic_operator.rb +0 -91
  1340. data/lib/puppet/parser/ast/astarray.rb +0 -50
  1341. data/lib/puppet/parser/ast/asthash.rb +0 -37
  1342. data/lib/puppet/parser/ast/boolean_operator.rb +0 -46
  1343. data/lib/puppet/parser/ast/caseopt.rb +0 -52
  1344. data/lib/puppet/parser/ast/casestatement.rb +0 -41
  1345. data/lib/puppet/parser/ast/collection.rb +0 -53
  1346. data/lib/puppet/parser/ast/collexpr.rb +0 -109
  1347. data/lib/puppet/parser/ast/comparison_operator.rb +0 -38
  1348. data/lib/puppet/parser/ast/definition.rb +0 -17
  1349. data/lib/puppet/parser/ast/else.rb +0 -22
  1350. data/lib/puppet/parser/ast/function.rb +0 -59
  1351. data/lib/puppet/parser/ast/ifstatement.rb +0 -34
  1352. data/lib/puppet/parser/ast/in_operator.rb +0 -24
  1353. data/lib/puppet/parser/ast/lambda.rb +0 -135
  1354. data/lib/puppet/parser/ast/match_operator.rb +0 -28
  1355. data/lib/puppet/parser/ast/method_call.rb +0 -77
  1356. data/lib/puppet/parser/ast/minus.rb +0 -23
  1357. data/lib/puppet/parser/ast/nop.rb +0 -11
  1358. data/lib/puppet/parser/ast/not.rb +0 -19
  1359. data/lib/puppet/parser/ast/relationship.rb +0 -47
  1360. data/lib/puppet/parser/ast/resource_defaults.rb +0 -24
  1361. data/lib/puppet/parser/ast/resource_override.rb +0 -62
  1362. data/lib/puppet/parser/ast/resource_reference.rb +0 -28
  1363. data/lib/puppet/parser/ast/selector.rb +0 -50
  1364. data/lib/puppet/parser/ast/vardef.rb +0 -38
  1365. data/lib/puppet/parser/code_merger.rb +0 -13
  1366. data/lib/puppet/parser/collector.rb +0 -177
  1367. data/lib/puppet/parser/functions/extlookup.rb +0 -153
  1368. data/lib/puppet/parser/functions/search.rb +0 -12
  1369. data/lib/puppet/parser/grammar.ra +0 -806
  1370. data/lib/puppet/parser/lexer.rb +0 -608
  1371. data/lib/puppet/parser/makefile +0 -8
  1372. data/lib/puppet/parser/methods.rb +0 -69
  1373. data/lib/puppet/parser/parser.rb +0 -2559
  1374. data/lib/puppet/parser/parser_support.rb +0 -195
  1375. data/lib/puppet/pops/binder/lookup.rb +0 -216
  1376. data/lib/puppet/pops/migration/migration_checker.rb +0 -45
  1377. data/lib/puppet/pops/model/ast_tree_dumper.rb +0 -386
  1378. data/lib/puppet/provider/package/msi.rb +0 -125
  1379. data/lib/puppet/provider/package/yumhelper.py +0 -159
  1380. data/lib/puppet/rails.rb +0 -139
  1381. data/lib/puppet/rails/benchmark.rb +0 -63
  1382. data/lib/puppet/rails/database/001_add_created_at_to_all_tables.rb +0 -13
  1383. data/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb +0 -13
  1384. data/lib/puppet/rails/database/003_add_environment_to_host.rb +0 -9
  1385. data/lib/puppet/rails/database/004_add_inventory_service_tables.rb +0 -36
  1386. data/lib/puppet/rails/database/schema.rb +0 -136
  1387. data/lib/puppet/rails/fact_name.rb +0 -7
  1388. data/lib/puppet/rails/fact_value.rb +0 -10
  1389. data/lib/puppet/rails/host.rb +0 -258
  1390. data/lib/puppet/rails/inventory_fact.rb +0 -5
  1391. data/lib/puppet/rails/inventory_node.rb +0 -43
  1392. data/lib/puppet/rails/param_name.rb +0 -25
  1393. data/lib/puppet/rails/param_value.rb +0 -74
  1394. data/lib/puppet/rails/puppet_tag.rb +0 -10
  1395. data/lib/puppet/rails/resource.rb +0 -235
  1396. data/lib/puppet/rails/resource_tag.rb +0 -26
  1397. data/lib/puppet/rails/source_file.rb +0 -8
  1398. data/lib/puppet/reports/rrdgraph.rb +0 -128
  1399. data/lib/puppet/reports/tagmail.rb +0 -179
  1400. data/lib/puppet/run.rb +0 -109
  1401. data/lib/puppet/util/cacher.rb +0 -74
  1402. data/lib/puppet/util/inline_docs.rb +0 -26
  1403. data/lib/puppet/util/instrumentation.rb +0 -152
  1404. data/lib/puppet/util/instrumentation/data.rb +0 -46
  1405. data/lib/puppet/util/instrumentation/indirection_probe.rb +0 -41
  1406. data/lib/puppet/util/instrumentation/instrumentable.rb +0 -136
  1407. data/lib/puppet/util/instrumentation/listener.rb +0 -72
  1408. data/lib/puppet/util/instrumentation/listeners/log.rb +0 -23
  1409. data/lib/puppet/util/instrumentation/listeners/performance.rb +0 -24
  1410. data/lib/puppet/util/log/rate_limited_logger.rb +0 -40
  1411. data/lib/puppet/util/monkey_patches/lines.rb +0 -13
  1412. data/lib/puppet/util/plugins.rb +0 -82
  1413. data/lib/puppet/util/pson.rb +0 -13
  1414. data/lib/puppet/util/queue.rb +0 -96
  1415. data/lib/puppet/util/queue/stomp.rb +0 -60
  1416. data/lib/puppet/util/rails/cache_accumulator.rb +0 -65
  1417. data/lib/puppet/util/rails/collection_merger.rb +0 -17
  1418. data/lib/puppet/util/rails/reference_serializer.rb +0 -32
  1419. data/lib/puppet/util/rdoc/parser/puppet_parser_rdoc1.rb +0 -19
  1420. data/lib/puppet/util/retryaction.rb +0 -47
  1421. data/lib/puppet/util/zaml.rb +0 -419
  1422. data/lib/puppet/vendor/load_safe_yaml.rb +0 -1
  1423. data/lib/puppet/vendor/safe_yaml/CHANGES.md +0 -104
  1424. data/lib/puppet/vendor/safe_yaml/Gemfile +0 -11
  1425. data/lib/puppet/vendor/safe_yaml/LICENSE.txt +0 -22
  1426. data/lib/puppet/vendor/safe_yaml/PUPPET_README.md +0 -6
  1427. data/lib/puppet/vendor/safe_yaml/README.md +0 -179
  1428. data/lib/puppet/vendor/safe_yaml/Rakefile +0 -6
  1429. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml.rb +0 -253
  1430. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/deep.rb +0 -34
  1431. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/parse/date.rb +0 -27
  1432. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/parse/hexadecimal.rb +0 -12
  1433. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/parse/sexagesimal.rb +0 -26
  1434. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/psych_handler.rb +0 -92
  1435. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/psych_resolver.rb +0 -52
  1436. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/resolver.rb +0 -94
  1437. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/safe_to_ruby_visitor.rb +0 -17
  1438. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/syck_hack.rb +0 -36
  1439. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/syck_node_monkeypatch.rb +0 -43
  1440. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/syck_resolver.rb +0 -38
  1441. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform.rb +0 -41
  1442. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_boolean.rb +0 -21
  1443. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_date.rb +0 -11
  1444. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_float.rb +0 -33
  1445. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_integer.rb +0 -25
  1446. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_nil.rb +0 -18
  1447. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_symbol.rb +0 -13
  1448. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/transformation_map.rb +0 -47
  1449. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/version.rb +0 -3
  1450. data/lib/puppet/vendor/safe_yaml/run_specs_all_ruby_versions.sh +0 -21
  1451. data/lib/puppet/vendor/safe_yaml/safe_yaml.gemspec +0 -18
  1452. data/lib/puppet/vendor/safe_yaml/spec/exploit.1.9.2.yaml +0 -2
  1453. data/lib/puppet/vendor/safe_yaml/spec/exploit.1.9.3.yaml +0 -2
  1454. data/lib/puppet/vendor/safe_yaml/spec/psych_resolver_spec.rb +0 -10
  1455. data/lib/puppet/vendor/safe_yaml/spec/resolver_specs.rb +0 -250
  1456. data/lib/puppet/vendor/safe_yaml/spec/safe_yaml_spec.rb +0 -702
  1457. data/lib/puppet/vendor/safe_yaml/spec/spec_helper.rb +0 -18
  1458. data/lib/puppet/vendor/safe_yaml/spec/support/exploitable_back_door.rb +0 -29
  1459. data/lib/puppet/vendor/safe_yaml/spec/syck_resolver_spec.rb +0 -10
  1460. data/lib/puppet/vendor/safe_yaml/spec/transform/base64_spec.rb +0 -11
  1461. data/lib/puppet/vendor/safe_yaml/spec/transform/to_date_spec.rb +0 -34
  1462. data/lib/puppet/vendor/safe_yaml/spec/transform/to_float_spec.rb +0 -42
  1463. data/lib/puppet/vendor/safe_yaml/spec/transform/to_integer_spec.rb +0 -59
  1464. data/lib/puppet/vendor/safe_yaml/spec/transform/to_symbol_spec.rb +0 -49
  1465. data/lib/puppet/vendor/safe_yaml_patches.rb +0 -9
  1466. data/lib/puppetx.rb +0 -89
  1467. data/man/man8/puppet-instrumentation_data.8 +0 -141
  1468. data/man/man8/puppet-instrumentation_listener.8 +0 -218
  1469. data/man/man8/puppet-instrumentation_probe.8 +0 -203
  1470. data/man/man8/puppet-kick.8 +0 -131
  1471. data/man/man8/puppet-queue.8 +0 -55
  1472. data/man/man8/puppet-secret_agent.8 +0 -70
  1473. data/spec/fixtures/module.tar.gz +0 -0
  1474. data/spec/fixtures/unit/provider/package/pkg/publisher +0 -2
  1475. data/spec/fixtures/unit/provider/package/pkg/simple +0 -2
  1476. data/spec/fixtures/yaml/report0.25.x.yaml +0 -64
  1477. data/spec/integration/indirector/catalog/queue_spec.rb +0 -55
  1478. data/spec/integration/module_tool/tar/mini_spec.rb +0 -28
  1479. data/spec/integration/parser/dynamic_scoping_spec.rb +0 -131
  1480. data/spec/integration/parser/future_compiler_spec.rb +0 -822
  1481. data/spec/integration/parser/parser_spec.rb +0 -207
  1482. data/spec/integration/parser/ruby_manifest_spec.rb +0 -119
  1483. data/spec/integration/type/sshkey_spec.rb +0 -22
  1484. data/spec/integration/util/feature_spec.rb +0 -53
  1485. data/spec/lib/puppet_spec/database.rb +0 -29
  1486. data/spec/monkey_patches/alias_should_to_must.rb +0 -21
  1487. data/spec/shared_contexts/platform.rb +0 -52
  1488. data/spec/unit/application/kick_spec.rb +0 -296
  1489. data/spec/unit/application/queue_spec.rb +0 -168
  1490. data/spec/unit/application/secret_agent_spec.rb +0 -34
  1491. data/spec/unit/dsl/resource_api_spec.rb +0 -180
  1492. data/spec/unit/dsl/resource_type_api_spec.rb +0 -53
  1493. data/spec/unit/face/instrumentation_data_spec.rb +0 -7
  1494. data/spec/unit/face/instrumentation_listener_spec.rb +0 -38
  1495. data/spec/unit/face/instrumentation_probe_spec.rb +0 -21
  1496. data/spec/unit/face/secret_agent_spec.rb +0 -27
  1497. data/spec/unit/functions/defined_spec.rb +0 -291
  1498. data/spec/unit/hiera/backend/puppet_backend_spec.rb +0 -148
  1499. data/spec/unit/indirector/active_record_spec.rb +0 -75
  1500. data/spec/unit/indirector/catalog/active_record_spec.rb +0 -107
  1501. data/spec/unit/indirector/catalog/queue_spec.rb +0 -19
  1502. data/spec/unit/indirector/facts/active_record_spec.rb +0 -113
  1503. data/spec/unit/indirector/facts/couch_spec.rb +0 -102
  1504. data/spec/unit/indirector/facts/inventory_active_record_spec.rb +0 -175
  1505. data/spec/unit/indirector/facts/inventory_service_spec.rb +0 -21
  1506. data/spec/unit/indirector/facts/rest_spec.rb +0 -10
  1507. data/spec/unit/indirector/instrumentation_data/local_spec.rb +0 -52
  1508. data/spec/unit/indirector/instrumentation_data/rest_spec.rb +0 -11
  1509. data/spec/unit/indirector/instrumentation_listener/local_spec.rb +0 -65
  1510. data/spec/unit/indirector/instrumentation_listener/rest_spec.rb +0 -11
  1511. data/spec/unit/indirector/instrumentation_probe/local_spec.rb +0 -65
  1512. data/spec/unit/indirector/instrumentation_probe/rest_spec.rb +0 -11
  1513. data/spec/unit/indirector/node/active_record_spec.rb +0 -48
  1514. data/spec/unit/indirector/queue_spec.rb +0 -115
  1515. data/spec/unit/indirector/resource/active_record_spec.rb +0 -166
  1516. data/spec/unit/indirector/resource/rest_spec.rb +0 -10
  1517. data/spec/unit/indirector/run/local_spec.rb +0 -21
  1518. data/spec/unit/indirector/run/rest_spec.rb +0 -10
  1519. data/spec/unit/network/authentication_spec.rb +0 -104
  1520. data/spec/unit/network/http/api/v2_spec.rb +0 -14
  1521. data/spec/unit/parser/ast/arithmetic_operator_spec.rb +0 -160
  1522. data/spec/unit/parser/ast/astarray_spec.rb +0 -56
  1523. data/spec/unit/parser/ast/asthash_spec.rb +0 -98
  1524. data/spec/unit/parser/ast/boolean_operator_spec.rb +0 -54
  1525. data/spec/unit/parser/ast/casestatement_spec.rb +0 -168
  1526. data/spec/unit/parser/ast/collection_spec.rb +0 -70
  1527. data/spec/unit/parser/ast/collexpr_spec.rb +0 -120
  1528. data/spec/unit/parser/ast/comparison_operator_spec.rb +0 -118
  1529. data/spec/unit/parser/ast/definition_spec.rb +0 -21
  1530. data/spec/unit/parser/ast/function_spec.rb +0 -92
  1531. data/spec/unit/parser/ast/hostclass_spec.rb +0 -72
  1532. data/spec/unit/parser/ast/ifstatement_spec.rb +0 -77
  1533. data/spec/unit/parser/ast/in_operator_spec.rb +0 -61
  1534. data/spec/unit/parser/ast/match_operator_spec.rb +0 -51
  1535. data/spec/unit/parser/ast/minus_spec.rb +0 -37
  1536. data/spec/unit/parser/ast/node_spec.rb +0 -30
  1537. data/spec/unit/parser/ast/nop_spec.rb +0 -19
  1538. data/spec/unit/parser/ast/not_spec.rb +0 -31
  1539. data/spec/unit/parser/ast/relationship_spec.rb +0 -87
  1540. data/spec/unit/parser/ast/resource_defaults_spec.rb +0 -21
  1541. data/spec/unit/parser/ast/resource_override_spec.rb +0 -50
  1542. data/spec/unit/parser/ast/resource_reference_spec.rb +0 -56
  1543. data/spec/unit/parser/ast/resource_spec.rb +0 -183
  1544. data/spec/unit/parser/ast/resourceparam_spec.rb +0 -51
  1545. data/spec/unit/parser/ast/selector_spec.rb +0 -88
  1546. data/spec/unit/parser/ast/vardef_spec.rb +0 -68
  1547. data/spec/unit/parser/ast_spec.rb +0 -76
  1548. data/spec/unit/parser/collector_spec.rb +0 -438
  1549. data/spec/unit/parser/functions/extlookup_spec.rb +0 -102
  1550. data/spec/unit/parser/functions/search_spec.rb +0 -28
  1551. data/spec/unit/parser/lexer_spec.rb +0 -877
  1552. data/spec/unit/parser/parser_spec.rb +0 -535
  1553. data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +0 -19
  1554. data/spec/unit/pops/migration_spec.rb +0 -180
  1555. data/spec/unit/pops/model/ast_transformer_spec.rb +0 -76
  1556. data/spec/unit/pops/transformer/transform_basic_expressions_spec.rb +0 -243
  1557. data/spec/unit/pops/transformer/transform_calls_spec.rb +0 -115
  1558. data/spec/unit/pops/transformer/transform_conditionals_spec.rb +0 -123
  1559. data/spec/unit/pops/transformer/transform_containers_spec.rb +0 -190
  1560. data/spec/unit/pops/transformer/transformer_rspec_helper.rb +0 -27
  1561. data/spec/unit/pops/validation_spec.rb +0 -66
  1562. data/spec/unit/provider/package/msi_spec.rb +0 -229
  1563. data/spec/unit/rails/host_spec.rb +0 -162
  1564. data/spec/unit/rails/param_value_spec.rb +0 -46
  1565. data/spec/unit/rails/resource_spec.rb +0 -115
  1566. data/spec/unit/rails_spec.rb +0 -244
  1567. data/spec/unit/reports/rrdgraph_spec.rb +0 -29
  1568. data/spec/unit/reports/tagmail_spec.rb +0 -218
  1569. data/spec/unit/run_spec.rb +0 -175
  1570. data/spec/unit/util/cache_accumulator_spec.rb +0 -74
  1571. data/spec/unit/util/cacher_spec.rb +0 -107
  1572. data/spec/unit/util/inline_docs_spec.rb +0 -31
  1573. data/spec/unit/util/instrumentation/data_spec.rb +0 -46
  1574. data/spec/unit/util/instrumentation/indirection_probe_spec.rb +0 -21
  1575. data/spec/unit/util/instrumentation/instrumentable_spec.rb +0 -186
  1576. data/spec/unit/util/instrumentation/listener_spec.rb +0 -101
  1577. data/spec/unit/util/instrumentation/listeners/log_spec.rb +0 -34
  1578. data/spec/unit/util/instrumentation/listeners/performance_spec.rb +0 -36
  1579. data/spec/unit/util/instrumentation_spec.rb +0 -181
  1580. data/spec/unit/util/log/rate_limited_logger_spec.rb +0 -51
  1581. data/spec/unit/util/monkey_patches/lines_spec.rb +0 -83
  1582. data/spec/unit/util/queue/stomp_spec.rb +0 -137
  1583. data/spec/unit/util/queue_spec.rb +0 -94
  1584. data/spec/unit/util/rdoc/parser_spec.rb +0 -608
  1585. data/spec/unit/util/reference_serializer_spec.rb +0 -51
  1586. data/spec/unit/util/zaml_spec.rb +0 -308
@@ -8,9 +8,4 @@ module ParserRspecHelper
8
8
  parser = Puppet::Pops::Parser::Parser.new()
9
9
  parser.parse_string(code)
10
10
  end
11
-
12
- def parse_epp(code)
13
- parser = Puppet::Pops::Parser::EppParser.new()
14
- parser.parse_string(code)
15
- end
16
11
  end
@@ -4,28 +4,28 @@ require 'puppet/pops'
4
4
  describe Puppet::Pops::Parser::Parser do
5
5
  it "should instantiate a parser" do
6
6
  parser = Puppet::Pops::Parser::Parser.new()
7
- parser.class.should == Puppet::Pops::Parser::Parser
7
+ expect(parser.class).to eq(Puppet::Pops::Parser::Parser)
8
8
  end
9
9
 
10
10
  it "should parse a code string and return a model" do
11
11
  parser = Puppet::Pops::Parser::Parser.new()
12
12
  model = parser.parse_string("$a = 10").current
13
- model.class.should == Puppet::Pops::Model::Program
14
- model.body.class.should == Puppet::Pops::Model::AssignmentExpression
13
+ expect(model.class).to eq(Puppet::Pops::Model::Program)
14
+ expect(model.body.class).to eq(Puppet::Pops::Model::AssignmentExpression)
15
15
  end
16
16
 
17
17
  it "should accept empty input and return a model" do
18
18
  parser = Puppet::Pops::Parser::Parser.new()
19
19
  model = parser.parse_string("").current
20
- model.class.should == Puppet::Pops::Model::Program
21
- model.body.class.should == Puppet::Pops::Model::Nop
20
+ expect(model.class).to eq(Puppet::Pops::Model::Program)
21
+ expect(model.body.class).to eq(Puppet::Pops::Model::Nop)
22
22
  end
23
23
 
24
24
  it "should accept empty input containing only comments and report location at end of input" do
25
25
  parser = Puppet::Pops::Parser::Parser.new()
26
26
  model = parser.parse_string("# comment\n").current
27
- model.class.should == Puppet::Pops::Model::Program
28
- model.body.class.should == Puppet::Pops::Model::Nop
27
+ expect(model.class).to eq(Puppet::Pops::Model::Program)
28
+ expect(model.body.class).to eq(Puppet::Pops::Model::Nop)
29
29
  adapter = Puppet::Pops::Adapters::SourcePosAdapter.adapt(model.body)
30
30
  expect(adapter.offset).to eq(10)
31
31
  expect(adapter.length).to eq(0)
@@ -13,13 +13,6 @@ require 'puppet/parser/e4_parser_adapter'
13
13
  describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
14
14
  include PuppetSpec::Pops
15
15
  include PuppetSpec::Scope
16
- before(:each) do
17
-
18
- # These must be set since the is 3x logic that triggers on these even if the tests are explicit
19
- # about selection of parser and evaluator
20
- #
21
- Puppet[:parser] = 'future'
22
- end
23
16
 
24
17
  let(:parser) { Puppet::Pops::Parser::EvaluatingParser.new }
25
18
 
@@ -17,7 +17,7 @@ describe "RGen extensions to core classes" do
17
17
  # When this fails it means that rgen has incorrectly implemented
18
18
  # method_missing on array and is returning an array for to_str instead of
19
19
  # failing as is expected allowing stringification to occur
20
- [[]].join(":").should == ""
21
- ["1", []].join(":").should == "1:"
20
+ expect([[]].join(":")).to eq("")
21
+ expect(["1", []].join(":")).to eq("1:")
22
22
  end
23
23
  end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+ require 'puppet/pops'
3
+
4
+ describe 'the Puppet::Pops::Types::ClassLoader' do
5
+ it 'should produce path alternatives for CamelCase classes' do
6
+ expected_paths = ['puppet_x/some_thing', 'puppetx/something']
7
+ # path_for_name method is private
8
+ expect(Puppet::Pops::Types::ClassLoader.send(:paths_for_name, ['PuppetX', 'SomeThing'])).to include(*expected_paths)
9
+ end
10
+ end
@@ -89,10 +89,6 @@ describe 'The type calculator' do
89
89
  Puppet::Pops::Types::TypeFactory.optional(t)
90
90
  end
91
91
 
92
- def not_undef_t(t = nil)
93
- Puppet::Pops::Types::TypeFactory.not_undef(t)
94
- end
95
-
96
92
  def undef_t
97
93
  Puppet::Pops::Types::TypeFactory.undef
98
94
  end
@@ -112,7 +108,6 @@ describe 'The type calculator' do
112
108
  def all_types
113
109
  [ Puppet::Pops::Types::PAnyType,
114
110
  Puppet::Pops::Types::PUndefType,
115
- Puppet::Pops::Types::PNotUndefType,
116
111
  Puppet::Pops::Types::PDataType,
117
112
  Puppet::Pops::Types::PScalarType,
118
113
  Puppet::Pops::Types::PStringType,
@@ -189,7 +184,6 @@ describe 'The type calculator' do
189
184
  result << array_t(types::PDataType.new)
190
185
  result << types::TypeFactory.hash_of_data
191
186
  result << Puppet::Pops::Types::PUndefType
192
- result << not_undef_t(types::PDataType.new)
193
187
  tmp = tuple_t(types::PDataType.new)
194
188
  result << (tmp)
195
189
  tmp.size_type = range_t(0, nil)
@@ -204,45 +198,45 @@ describe 'The type calculator' do
204
198
  context 'when inferring ruby' do
205
199
 
206
200
  it 'fixnum translates to PIntegerType' do
207
- calculator.infer(1).class.should == Puppet::Pops::Types::PIntegerType
201
+ expect(calculator.infer(1).class).to eq(Puppet::Pops::Types::PIntegerType)
208
202
  end
209
203
 
210
204
  it 'large fixnum (or bignum depending on architecture) translates to PIntegerType' do
211
- calculator.infer(2**33).class.should == Puppet::Pops::Types::PIntegerType
205
+ expect(calculator.infer(2**33).class).to eq(Puppet::Pops::Types::PIntegerType)
212
206
  end
213
207
 
214
208
  it 'float translates to PFloatType' do
215
- calculator.infer(1.3).class.should == Puppet::Pops::Types::PFloatType
209
+ expect(calculator.infer(1.3).class).to eq(Puppet::Pops::Types::PFloatType)
216
210
  end
217
211
 
218
212
  it 'string translates to PStringType' do
219
- calculator.infer('foo').class.should == Puppet::Pops::Types::PStringType
213
+ expect(calculator.infer('foo').class).to eq(Puppet::Pops::Types::PStringType)
220
214
  end
221
215
 
222
216
  it 'inferred string type knows the string value' do
223
217
  t = calculator.infer('foo')
224
- t.class.should == Puppet::Pops::Types::PStringType
225
- t.values.should == ['foo']
218
+ expect(t.class).to eq(Puppet::Pops::Types::PStringType)
219
+ expect(t.values).to eq(['foo'])
226
220
  end
227
221
 
228
222
  it 'boolean true translates to PBooleanType' do
229
- calculator.infer(true).class.should == Puppet::Pops::Types::PBooleanType
223
+ expect(calculator.infer(true).class).to eq(Puppet::Pops::Types::PBooleanType)
230
224
  end
231
225
 
232
226
  it 'boolean false translates to PBooleanType' do
233
- calculator.infer(false).class.should == Puppet::Pops::Types::PBooleanType
227
+ expect(calculator.infer(false).class).to eq(Puppet::Pops::Types::PBooleanType)
234
228
  end
235
229
 
236
230
  it 'regexp translates to PRegexpType' do
237
- calculator.infer(/^a regular expression$/).class.should == Puppet::Pops::Types::PRegexpType
231
+ expect(calculator.infer(/^a regular expression$/).class).to eq(Puppet::Pops::Types::PRegexpType)
238
232
  end
239
233
 
240
234
  it 'nil translates to PUndefType' do
241
- calculator.infer(nil).class.should == Puppet::Pops::Types::PUndefType
235
+ expect(calculator.infer(nil).class).to eq(Puppet::Pops::Types::PUndefType)
242
236
  end
243
237
 
244
- it ':undef translates to PUndefType' do
245
- calculator.infer(:undef).class.should == Puppet::Pops::Types::PUndefType
238
+ it ':undef translates to PRuntimeType' do
239
+ expect(calculator.infer(:undef).class).to eq(Puppet::Pops::Types::PRuntimeType)
246
240
  end
247
241
 
248
242
  it 'an instance of class Foo translates to PRuntimeType[ruby, Foo]' do
@@ -250,137 +244,137 @@ describe 'The type calculator' do
250
244
  end
251
245
 
252
246
  t = calculator.infer(Foo.new)
253
- t.class.should == Puppet::Pops::Types::PRuntimeType
254
- t.runtime.should == :ruby
255
- t.runtime_type_name.should == 'Foo'
247
+ expect(t.class).to eq(Puppet::Pops::Types::PRuntimeType)
248
+ expect(t.runtime).to eq(:ruby)
249
+ expect(t.runtime_type_name).to eq('Foo')
256
250
  end
257
251
 
258
252
  context 'array' do
259
253
  it 'translates to PArrayType' do
260
- calculator.infer([1,2]).class.should == Puppet::Pops::Types::PArrayType
254
+ expect(calculator.infer([1,2]).class).to eq(Puppet::Pops::Types::PArrayType)
261
255
  end
262
256
 
263
257
  it 'with fixnum values translates to PArrayType[PIntegerType]' do
264
- calculator.infer([1,2]).element_type.class.should == Puppet::Pops::Types::PIntegerType
258
+ expect(calculator.infer([1,2]).element_type.class).to eq(Puppet::Pops::Types::PIntegerType)
265
259
  end
266
260
 
267
261
  it 'with 32 and 64 bit integer values translates to PArrayType[PIntegerType]' do
268
- calculator.infer([1,2**33]).element_type.class.should == Puppet::Pops::Types::PIntegerType
262
+ expect(calculator.infer([1,2**33]).element_type.class).to eq(Puppet::Pops::Types::PIntegerType)
269
263
  end
270
264
 
271
265
  it 'Range of integer values are computed' do
272
266
  t = calculator.infer([-3,0,42]).element_type
273
- t.class.should == Puppet::Pops::Types::PIntegerType
274
- t.from.should == -3
275
- t.to.should == 42
267
+ expect(t.class).to eq(Puppet::Pops::Types::PIntegerType)
268
+ expect(t.from).to eq(-3)
269
+ expect(t.to).to eq(42)
276
270
  end
277
271
 
278
272
  it "Compound string values are computed" do
279
273
  t = calculator.infer(['a','b', 'c']).element_type
280
- t.class.should == Puppet::Pops::Types::PStringType
281
- t.values.should == ['a', 'b', 'c']
274
+ expect(t.class).to eq(Puppet::Pops::Types::PStringType)
275
+ expect(t.values).to eq(['a', 'b', 'c'])
282
276
  end
283
277
 
284
278
  it 'with fixnum and float values translates to PArrayType[PNumericType]' do
285
- calculator.infer([1,2.0]).element_type.class.should == Puppet::Pops::Types::PNumericType
279
+ expect(calculator.infer([1,2.0]).element_type.class).to eq(Puppet::Pops::Types::PNumericType)
286
280
  end
287
281
 
288
282
  it 'with fixnum and string values translates to PArrayType[PScalarType]' do
289
- calculator.infer([1,'two']).element_type.class.should == Puppet::Pops::Types::PScalarType
283
+ expect(calculator.infer([1,'two']).element_type.class).to eq(Puppet::Pops::Types::PScalarType)
290
284
  end
291
285
 
292
286
  it 'with float and string values translates to PArrayType[PScalarType]' do
293
- calculator.infer([1.0,'two']).element_type.class.should == Puppet::Pops::Types::PScalarType
287
+ expect(calculator.infer([1.0,'two']).element_type.class).to eq(Puppet::Pops::Types::PScalarType)
294
288
  end
295
289
 
296
290
  it 'with fixnum, float, and string values translates to PArrayType[PScalarType]' do
297
- calculator.infer([1, 2.0,'two']).element_type.class.should == Puppet::Pops::Types::PScalarType
291
+ expect(calculator.infer([1, 2.0,'two']).element_type.class).to eq(Puppet::Pops::Types::PScalarType)
298
292
  end
299
293
 
300
294
  it 'with fixnum and regexp values translates to PArrayType[PScalarType]' do
301
- calculator.infer([1, /two/]).element_type.class.should == Puppet::Pops::Types::PScalarType
295
+ expect(calculator.infer([1, /two/]).element_type.class).to eq(Puppet::Pops::Types::PScalarType)
302
296
  end
303
297
 
304
298
  it 'with string and regexp values translates to PArrayType[PScalarType]' do
305
- calculator.infer(['one', /two/]).element_type.class.should == Puppet::Pops::Types::PScalarType
299
+ expect(calculator.infer(['one', /two/]).element_type.class).to eq(Puppet::Pops::Types::PScalarType)
306
300
  end
307
301
 
308
302
  it 'with string and symbol values translates to PArrayType[PAnyType]' do
309
- calculator.infer(['one', :two]).element_type.class.should == Puppet::Pops::Types::PAnyType
303
+ expect(calculator.infer(['one', :two]).element_type.class).to eq(Puppet::Pops::Types::PAnyType)
310
304
  end
311
305
 
312
306
  it 'with fixnum and nil values translates to PArrayType[PIntegerType]' do
313
- calculator.infer([1, nil]).element_type.class.should == Puppet::Pops::Types::PIntegerType
307
+ expect(calculator.infer([1, nil]).element_type.class).to eq(Puppet::Pops::Types::PIntegerType)
314
308
  end
315
309
 
316
310
  it 'with arrays of string values translates to PArrayType[PArrayType[PStringType]]' do
317
311
  et = calculator.infer([['first' 'array'], ['second','array']])
318
- et.class.should == Puppet::Pops::Types::PArrayType
312
+ expect(et.class).to eq(Puppet::Pops::Types::PArrayType)
319
313
  et = et.element_type
320
- et.class.should == Puppet::Pops::Types::PArrayType
314
+ expect(et.class).to eq(Puppet::Pops::Types::PArrayType)
321
315
  et = et.element_type
322
- et.class.should == Puppet::Pops::Types::PStringType
316
+ expect(et.class).to eq(Puppet::Pops::Types::PStringType)
323
317
  end
324
318
 
325
319
  it 'with array of string values and array of fixnums translates to PArrayType[PArrayType[PScalarType]]' do
326
320
  et = calculator.infer([['first' 'array'], [1,2]])
327
- et.class.should == Puppet::Pops::Types::PArrayType
321
+ expect(et.class).to eq(Puppet::Pops::Types::PArrayType)
328
322
  et = et.element_type
329
- et.class.should == Puppet::Pops::Types::PArrayType
323
+ expect(et.class).to eq(Puppet::Pops::Types::PArrayType)
330
324
  et = et.element_type
331
- et.class.should == Puppet::Pops::Types::PScalarType
325
+ expect(et.class).to eq(Puppet::Pops::Types::PScalarType)
332
326
  end
333
327
 
334
328
  it 'with hashes of string values translates to PArrayType[PHashType[PStringType]]' do
335
329
  et = calculator.infer([{:first => 'first', :second => 'second' }, {:first => 'first', :second => 'second' }])
336
- et.class.should == Puppet::Pops::Types::PArrayType
330
+ expect(et.class).to eq(Puppet::Pops::Types::PArrayType)
337
331
  et = et.element_type
338
- et.class.should == Puppet::Pops::Types::PHashType
332
+ expect(et.class).to eq(Puppet::Pops::Types::PHashType)
339
333
  et = et.element_type
340
- et.class.should == Puppet::Pops::Types::PStringType
334
+ expect(et.class).to eq(Puppet::Pops::Types::PStringType)
341
335
  end
342
336
 
343
337
  it 'with hash of string values and hash of fixnums translates to PArrayType[PHashType[PScalarType]]' do
344
338
  et = calculator.infer([{:first => 'first', :second => 'second' }, {:first => 1, :second => 2 }])
345
- et.class.should == Puppet::Pops::Types::PArrayType
339
+ expect(et.class).to eq(Puppet::Pops::Types::PArrayType)
346
340
  et = et.element_type
347
- et.class.should == Puppet::Pops::Types::PHashType
341
+ expect(et.class).to eq(Puppet::Pops::Types::PHashType)
348
342
  et = et.element_type
349
- et.class.should == Puppet::Pops::Types::PScalarType
343
+ expect(et.class).to eq(Puppet::Pops::Types::PScalarType)
350
344
  end
351
345
  end
352
346
 
353
347
  context 'hash' do
354
348
  it 'translates to PHashType' do
355
- calculator.infer({:first => 1, :second => 2}).class.should == Puppet::Pops::Types::PHashType
349
+ expect(calculator.infer({:first => 1, :second => 2}).class).to eq(Puppet::Pops::Types::PHashType)
356
350
  end
357
351
 
358
352
  it 'with symbolic keys translates to PHashType[PRuntimeType[ruby, Symbol], value]' do
359
353
  k = calculator.infer({:first => 1, :second => 2}).key_type
360
- k.class.should == Puppet::Pops::Types::PRuntimeType
361
- k.runtime.should == :ruby
362
- k.runtime_type_name.should == 'Symbol'
354
+ expect(k.class).to eq(Puppet::Pops::Types::PRuntimeType)
355
+ expect(k.runtime).to eq(:ruby)
356
+ expect(k.runtime_type_name).to eq('Symbol')
363
357
  end
364
358
 
365
359
  it 'with string keys translates to PHashType[PStringType, value]' do
366
- calculator.infer({'first' => 1, 'second' => 2}).key_type.class.should == Puppet::Pops::Types::PStringType
360
+ expect(calculator.infer({'first' => 1, 'second' => 2}).key_type.class).to eq(Puppet::Pops::Types::PStringType)
367
361
  end
368
362
 
369
363
  it 'with fixnum values translates to PHashType[key, PIntegerType]' do
370
- calculator.infer({:first => 1, :second => 2}).element_type.class.should == Puppet::Pops::Types::PIntegerType
364
+ expect(calculator.infer({:first => 1, :second => 2}).element_type.class).to eq(Puppet::Pops::Types::PIntegerType)
371
365
  end
372
366
 
373
367
  it 'when empty infers a type that answers true to is_the_empty_hash?' do
374
- expect(calculator.infer({}).is_the_empty_hash?).to be_true
375
- expect(calculator.infer_set({}).is_the_empty_hash?).to be_true
368
+ expect(calculator.infer({}).is_the_empty_hash?).to eq(true)
369
+ expect(calculator.infer_set({}).is_the_empty_hash?).to eq(true)
376
370
  end
377
371
 
378
372
  it 'when empty is assignable to any PHashType' do
379
- expect(calculator.assignable?(hash_t(string_t, string_t), calculator.infer({}))).to be_true
373
+ expect(calculator.assignable?(hash_t(string_t, string_t), calculator.infer({}))).to eq(true)
380
374
  end
381
375
 
382
376
  it 'when empty is not assignable to a PHashType with from size > 0' do
383
- expect(calculator.assignable?(constrained_t(hash_t(string_t,string_t), 1, 1), calculator.infer({}))).to be_false
377
+ expect(calculator.assignable?(constrained_t(hash_t(string_t,string_t), 1, 1), calculator.infer({}))).to eq(false)
384
378
  end
385
379
 
386
380
  context 'using infer_set' do
@@ -395,9 +389,9 @@ describe 'The type calculator' do
395
389
  t = calculator.infer_set({ 'mode' => 'read', 'path' => ['foo', 'fee' ] })
396
390
  expect(t.class).to eq(Puppet::Pops::Types::PStructType)
397
391
  expect(t.elements.size).to eq(2)
398
- els = t.elements.map { |e| e.value_type }.sort {|a,b| a.to_s <=> b.to_s }
399
- els[0].class.should == Puppet::Pops::Types::PStringType
400
- els[1].class.should == Puppet::Pops::Types::PTupleType
392
+ els = t.elements.map { |e| e.type }.sort {|a,b| a.to_s <=> b.to_s }
393
+ expect(els[0].class).to eq(Puppet::Pops::Types::PStringType)
394
+ expect(els[1].class).to eq(Puppet::Pops::Types::PTupleType)
401
395
  end
402
396
 
403
397
  it 'with mixed string and non-string keys translates to PHashType' do
@@ -416,16 +410,16 @@ describe 'The type calculator' do
416
410
  context 'patterns' do
417
411
  it "constructs a PPatternType" do
418
412
  t = pattern_t('a(b)c')
419
- t.class.should == Puppet::Pops::Types::PPatternType
420
- t.patterns.size.should == 1
421
- t.patterns[0].class.should == Puppet::Pops::Types::PRegexpType
422
- t.patterns[0].pattern.should == 'a(b)c'
423
- t.patterns[0].regexp.match('abc')[1].should == 'b'
413
+ expect(t.class).to eq(Puppet::Pops::Types::PPatternType)
414
+ expect(t.patterns.size).to eq(1)
415
+ expect(t.patterns[0].class).to eq(Puppet::Pops::Types::PRegexpType)
416
+ expect(t.patterns[0].pattern).to eq('a(b)c')
417
+ expect(t.patterns[0].regexp.match('abc')[1]).to eq('b')
424
418
  end
425
419
 
426
420
  it "constructs a PStringType with multiple strings" do
427
421
  t = string_t('a', 'b', 'c', 'abc')
428
- t.values.should == ['a', 'b', 'c', 'abc']
422
+ expect(t.values).to eq(['a', 'b', 'c', 'abc'])
429
423
  end
430
424
  end
431
425
 
@@ -436,27 +430,27 @@ describe 'The type calculator' do
436
430
  r1.type_name = 'File'
437
431
  r2 = Puppet::Pops::Types::PResourceType.new()
438
432
  r2.type_name = 'File'
439
- calculator.string(calculator.common_type(r1, r2)).should == "File"
433
+ expect(calculator.string(calculator.common_type(r1, r2))).to eq("File")
440
434
 
441
435
  r2 = Puppet::Pops::Types::PResourceType.new()
442
436
  r2.type_name = 'File'
443
437
  r2.title = '/tmp/foo'
444
- calculator.string(calculator.common_type(r1, r2)).should == "File"
438
+ expect(calculator.string(calculator.common_type(r1, r2))).to eq("File")
445
439
 
446
440
  r1 = Puppet::Pops::Types::PResourceType.new()
447
441
  r1.type_name = 'File'
448
442
  r1.title = '/tmp/foo'
449
- calculator.string(calculator.common_type(r1, r2)).should == "File['/tmp/foo']"
443
+ expect(calculator.string(calculator.common_type(r1, r2))).to eq("File['/tmp/foo']")
450
444
 
451
445
  r1 = Puppet::Pops::Types::PResourceType.new()
452
446
  r1.type_name = 'File'
453
447
  r1.title = '/tmp/bar'
454
- calculator.string(calculator.common_type(r1, r2)).should == "File"
448
+ expect(calculator.string(calculator.common_type(r1, r2))).to eq("File")
455
449
 
456
450
  r2 = Puppet::Pops::Types::PResourceType.new()
457
451
  r2.type_name = 'Package'
458
452
  r2.title = 'apache'
459
- calculator.string(calculator.common_type(r1, r2)).should == "Resource"
453
+ expect(calculator.string(calculator.common_type(r1, r2))).to eq("Resource")
460
454
  end
461
455
 
462
456
  it 'computes given hostclass type commonality' do
@@ -464,72 +458,33 @@ describe 'The type calculator' do
464
458
  r1.class_name = 'foo'
465
459
  r2 = Puppet::Pops::Types::PHostClassType.new()
466
460
  r2.class_name = 'foo'
467
- calculator.string(calculator.common_type(r1, r2)).should == "Class[foo]"
461
+ expect(calculator.string(calculator.common_type(r1, r2))).to eq("Class[foo]")
468
462
 
469
463
  r2 = Puppet::Pops::Types::PHostClassType.new()
470
464
  r2.class_name = 'bar'
471
- calculator.string(calculator.common_type(r1, r2)).should == "Class"
465
+ expect(calculator.string(calculator.common_type(r1, r2))).to eq("Class")
472
466
 
473
467
  r2 = Puppet::Pops::Types::PHostClassType.new()
474
- calculator.string(calculator.common_type(r1, r2)).should == "Class"
468
+ expect(calculator.string(calculator.common_type(r1, r2))).to eq("Class")
475
469
 
476
470
  r1 = Puppet::Pops::Types::PHostClassType.new()
477
- calculator.string(calculator.common_type(r1, r2)).should == "Class"
478
- end
479
-
480
- context 'of strings' do
481
- it 'computes commonality' do
482
- t1 = string_t('abc')
483
- t2 = string_t('xyz')
484
- common_t = calculator.common_type(t1,t2)
485
- expect(common_t.class).to eq(Puppet::Pops::Types::PStringType)
486
- expect(common_t.values).to eq(['abc', 'xyz'])
487
- end
488
-
489
- it 'computes common size_type' do
490
- t1 = string_t
491
- t1.size_type = range_t(3,6)
492
- t2 = string_t
493
- t2.size_type = range_t(2,4)
494
- common_t = calculator.common_type(t1,t2)
495
- expect(common_t.class).to eq(Puppet::Pops::Types::PStringType)
496
- expect(common_t.size_type).to eq(range_t(2,6))
497
- end
498
-
499
- it 'computes common size_type to be undef when one of the types has no size_type' do
500
- t1 = string_t
501
- t2 = string_t
502
- t2.size_type = range_t(2,4)
503
- common_t = calculator.common_type(t1,t2)
504
- expect(common_t.class).to eq(Puppet::Pops::Types::PStringType)
505
- expect(common_t.size_type).to be_nil
506
- end
507
-
508
- it 'computes values to be empty if the one has empty values' do
509
- t1 = string_t('apa')
510
- t1.size_type = range_t(3,6)
511
- t2 = string_t
512
- t2.size_type = range_t(2,4)
513
- common_t = calculator.common_type(t1,t2)
514
- expect(common_t.class).to eq(Puppet::Pops::Types::PStringType)
515
- expect(common_t.values).to be_empty
516
- end
471
+ expect(calculator.string(calculator.common_type(r1, r2))).to eq("Class")
517
472
  end
518
473
 
519
474
  it 'computes pattern commonality' do
520
475
  t1 = pattern_t('abc')
521
476
  t2 = pattern_t('xyz')
522
477
  common_t = calculator.common_type(t1,t2)
523
- common_t.class.should == Puppet::Pops::Types::PPatternType
524
- common_t.patterns.map { |pr| pr.pattern }.should == ['abc', 'xyz']
525
- calculator.string(common_t).should == "Pattern[/abc/, /xyz/]"
478
+ expect(common_t.class).to eq(Puppet::Pops::Types::PPatternType)
479
+ expect(common_t.patterns.map { |pr| pr.pattern }).to eq(['abc', 'xyz'])
480
+ expect(calculator.string(common_t)).to eq("Pattern[/abc/, /xyz/]")
526
481
  end
527
482
 
528
483
  it 'computes enum commonality to value set sum' do
529
484
  t1 = enum_t('a', 'b', 'c')
530
485
  t2 = enum_t('x', 'y', 'z')
531
486
  common_t = calculator.common_type(t1, t2)
532
- common_t.should == enum_t('a', 'b', 'c', 'x', 'y', 'z')
487
+ expect(common_t).to eq(enum_t('a', 'b', 'c', 'x', 'y', 'z'))
533
488
  end
534
489
 
535
490
  it 'computed variant commonality to type union where added types are not sub-types' do
@@ -539,8 +494,8 @@ describe 'The type calculator' do
539
494
  b_t1 = enum_t('a')
540
495
  v_b = variant_t(b_t1)
541
496
  common_t = calculator.common_type(v_a, v_b)
542
- common_t.class.should == Puppet::Pops::Types::PVariantType
543
- Set.new(common_t.types).should == Set.new([a_t1, a_t2, b_t1])
497
+ expect(common_t.class).to eq(Puppet::Pops::Types::PVariantType)
498
+ expect(Set.new(common_t.types)).to eq(Set.new([a_t1, a_t2, b_t1]))
544
499
  end
545
500
 
546
501
  it 'computed variant commonality to type union where added types are sub-types' do
@@ -550,8 +505,8 @@ describe 'The type calculator' do
550
505
  b_t1 = enum_t('a')
551
506
  v_b = variant_t(b_t1)
552
507
  common_t = calculator.common_type(v_a, v_b)
553
- common_t.class.should == Puppet::Pops::Types::PVariantType
554
- Set.new(common_t.types).should == Set.new([a_t1, a_t2])
508
+ expect(common_t.class).to eq(Puppet::Pops::Types::PVariantType)
509
+ expect(Set.new(common_t.types)).to eq(Set.new([a_t1, a_t2]))
555
510
  end
556
511
 
557
512
  context "of callables" do
@@ -598,83 +553,34 @@ describe 'The type calculator' do
598
553
  context 'computes assignability' do
599
554
  include_context "types_setup"
600
555
 
601
- it 'such that all types are assignable to themselves' do
602
- all_types.each do |tc|
603
- t = tc.new
604
- expect(t).to be_assignable_to(t)
605
- end
606
- end
607
-
608
556
  context 'for Unit, such that' do
609
557
  it 'all types are assignable to Unit' do
610
558
  t = Puppet::Pops::Types::PUnitType.new()
611
- all_types.each { |t2| t2.new.should be_assignable_to(t) }
559
+ all_types.each { |t2| expect(t2.new).to be_assignable_to(t) }
612
560
  end
613
561
 
614
562
  it 'Unit is assignable to all other types' do
615
563
  t = Puppet::Pops::Types::PUnitType.new()
616
- all_types.each { |t2| t.should be_assignable_to(t2.new) }
564
+ all_types.each { |t2| expect(t).to be_assignable_to(t2.new) }
617
565
  end
618
566
 
619
567
  it 'Unit is assignable to Unit' do
620
568
  t = Puppet::Pops::Types::PUnitType.new()
621
569
  t2 = Puppet::Pops::Types::PUnitType.new()
622
- t.should be_assignable_to(t2)
570
+ expect(t).to be_assignable_to(t2)
623
571
  end
624
572
  end
625
573
 
626
574
  context "for Any, such that" do
627
575
  it 'all types are assignable to Any' do
628
576
  t = Puppet::Pops::Types::PAnyType.new()
629
- all_types.each { |t2| t2.new.should be_assignable_to(t) }
577
+ all_types.each { |t2| expect(t2.new).to be_assignable_to(t) }
630
578
  end
631
579
 
632
- it 'Any is not assignable to anything but Any and Optional (implied Optional[Any])' do
633
- tested_types = all_types() - [Puppet::Pops::Types::PAnyType, Puppet::Pops::Types::POptionalType]
580
+ it 'Any is not assignable to anything but Any' do
581
+ tested_types = all_types() - [Puppet::Pops::Types::PAnyType]
634
582
  t = Puppet::Pops::Types::PAnyType.new()
635
- tested_types.each { |t2| t.should_not be_assignable_to(t2.new) }
636
- end
637
- end
638
-
639
- context "for NotUndef, such that" do
640
- it 'all types except types assignable from Undef are assignable to NotUndef' do
641
- t = not_undef_t
642
- tc = Puppet::Pops::Types::TypeCalculator.singleton
643
- undef_t = Puppet::Pops::Types::PUndefType.new()
644
- all_types().each do |c|
645
- t2 = c.new
646
- if tc.assignable?(t2, undef_t)
647
- expect(t2).not_to be_assignable_to(t)
648
- else
649
- expect(t2).to be_assignable_to(t)
650
- end
651
- end
652
- end
653
-
654
- it 'type NotUndef[T] is assignable from T unless T is assignable from Undef ' do
655
- tc = Puppet::Pops::Types::TypeCalculator.singleton
656
- undef_t = Puppet::Pops::Types::PUndefType.new()
657
- all_types().select do |c|
658
- t2 = c.new
659
- not_undef_t = not_undef_t(t2)
660
- if tc.assignable?(t2, undef_t)
661
- expect(t2).not_to be_assignable_to(not_undef_t)
662
- else
663
- expect(t2).to be_assignable_to(not_undef_t)
664
- end
665
- end
666
- end
667
-
668
- it 'type T is assignable from NotUndef[T] unless T is assignable from Undef' do
669
- tc = Puppet::Pops::Types::TypeCalculator.singleton
670
- undef_t = Puppet::Pops::Types::PUndefType.new()
671
- all_types().select do |c|
672
- t2 = c.new
673
- not_undef_t = not_undef_t(t2)
674
- unless tc.assignable?(t2, undef_t)
675
- expect(not_undef_t).to be_assignable_to(t2)
676
- end
677
- end
583
+ tested_types.each { |t2| expect(t).not_to be_assignable_to(t2.new) }
678
584
  end
679
585
  end
680
586
 
@@ -682,112 +588,110 @@ describe 'The type calculator' do
682
588
  it 'all scalars + array and hash are assignable to Data' do
683
589
  t = Puppet::Pops::Types::PDataType.new()
684
590
  data_compatible_types.each { |t2|
685
- type_from_class(t2).should be_assignable_to(t)
591
+ expect(type_from_class(t2)).to be_assignable_to(t)
686
592
  }
687
593
  end
688
594
 
689
595
  it 'a Variant of scalar, hash, or array is assignable to Data' do
690
596
  t = Puppet::Pops::Types::PDataType.new()
691
- data_compatible_types.each { |t2| variant_t(type_from_class(t2)).should be_assignable_to(t) }
597
+ data_compatible_types.each { |t2| expect(variant_t(type_from_class(t2))).to be_assignable_to(t) }
692
598
  end
693
599
 
694
600
  it 'Data is not assignable to any of its subtypes' do
695
601
  t = Puppet::Pops::Types::PDataType.new()
696
602
  types_to_test = data_compatible_types- [Puppet::Pops::Types::PDataType]
697
- types_to_test.each {|t2| t.should_not be_assignable_to(type_from_class(t2)) }
603
+ types_to_test.each {|t2| expect(t).not_to be_assignable_to(type_from_class(t2)) }
698
604
  end
699
605
 
700
606
  it 'Data is not assignable to a Variant of Data subtype' do
701
607
  t = Puppet::Pops::Types::PDataType.new()
702
608
  types_to_test = data_compatible_types- [Puppet::Pops::Types::PDataType]
703
- types_to_test.each { |t2| t.should_not be_assignable_to(variant_t(type_from_class(t2))) }
609
+ types_to_test.each { |t2| expect(t).not_to be_assignable_to(variant_t(type_from_class(t2))) }
704
610
  end
705
611
 
706
612
  it 'Data is not assignable to any disjunct type' do
707
- tested_types = all_types - [Puppet::Pops::Types::PAnyType, Puppet::Pops::Types::POptionalType, Puppet::Pops::Types::PDataType] - scalar_types
613
+ tested_types = all_types - [Puppet::Pops::Types::PAnyType, Puppet::Pops::Types::PDataType] - scalar_types
708
614
  t = Puppet::Pops::Types::PDataType.new()
709
- tested_types.each {|t2| t.should_not be_assignable_to(t2.new) }
615
+ tested_types.each {|t2| expect(t).not_to be_assignable_to(t2.new) }
710
616
  end
711
617
  end
712
618
 
713
619
  context 'for Variant, such that' do
714
620
  it 'it is assignable to a type if all contained types are assignable to that type' do
715
621
  v = variant_t(range_t(10, 12),range_t(14, 20))
716
- v.should be_assignable_to(integer_t)
717
- v.should be_assignable_to(range_t(10, 20))
622
+ expect(v).to be_assignable_to(integer_t)
623
+ expect(v).to be_assignable_to(range_t(10, 20))
718
624
 
719
625
  # test that both types are assignable to one of the variants OK
720
- v.should be_assignable_to(variant_t(range_t(10, 20), range_t(30, 40)))
626
+ expect(v).to be_assignable_to(variant_t(range_t(10, 20), range_t(30, 40)))
721
627
 
722
628
  # test where each type is assignable to different types in a variant is OK
723
- v.should be_assignable_to(variant_t(range_t(10, 13), range_t(14, 40)))
629
+ expect(v).to be_assignable_to(variant_t(range_t(10, 13), range_t(14, 40)))
724
630
 
725
631
  # not acceptable
726
- v.should_not be_assignable_to(range_t(0, 4))
727
- v.should_not be_assignable_to(string_t)
632
+ expect(v).not_to be_assignable_to(range_t(0, 4))
633
+ expect(v).not_to be_assignable_to(string_t)
728
634
  end
729
635
  end
730
636
 
731
637
  context "for Scalar, such that" do
732
638
  it "all scalars are assignable to Scalar" do
733
639
  t = Puppet::Pops::Types::PScalarType.new()
734
- scalar_types.each {|t2| t2.new.should be_assignable_to(t) }
640
+ scalar_types.each {|t2| expect(t2.new).to be_assignable_to(t) }
735
641
  end
736
642
 
737
643
  it 'Scalar is not assignable to any of its subtypes' do
738
- t = Puppet::Pops::Types::PScalarType.new()
644
+ t = Puppet::Pops::Types::PScalarType.new()
739
645
  types_to_test = scalar_types - [Puppet::Pops::Types::PScalarType]
740
- types_to_test.each {|t2| t.should_not be_assignable_to(t2.new) }
646
+ types_to_test.each {|t2| expect(t).not_to be_assignable_to(t2.new) }
741
647
  end
742
648
 
743
649
  it 'Scalar is not assignable to any disjunct type' do
744
- tested_types = all_types - [Puppet::Pops::Types::PAnyType, Puppet::Pops::Types::POptionalType, Puppet::Pops::Types::PNotUndefType, Puppet::Pops::Types::PDataType] - scalar_types
650
+ tested_types = all_types - [Puppet::Pops::Types::PAnyType, Puppet::Pops::Types::PDataType] - scalar_types
745
651
  t = Puppet::Pops::Types::PScalarType.new()
746
- tested_types.each {|t2| t.should_not be_assignable_to(t2.new) }
652
+ tested_types.each {|t2| expect(t).not_to be_assignable_to(t2.new) }
747
653
  end
748
654
  end
749
655
 
750
656
  context "for Numeric, such that" do
751
657
  it "all numerics are assignable to Numeric" do
752
658
  t = Puppet::Pops::Types::PNumericType.new()
753
- numeric_types.each {|t2| t2.new.should be_assignable_to(t) }
659
+ numeric_types.each {|t2| expect(t2.new).to be_assignable_to(t) }
754
660
  end
755
661
 
756
662
  it 'Numeric is not assignable to any of its subtypes' do
757
663
  t = Puppet::Pops::Types::PNumericType.new()
758
664
  types_to_test = numeric_types - [Puppet::Pops::Types::PNumericType]
759
- types_to_test.each {|t2| t.should_not be_assignable_to(t2.new) }
665
+ types_to_test.each {|t2| expect(t).not_to be_assignable_to(t2.new) }
760
666
  end
761
667
 
762
668
  it 'Numeric is not assignable to any disjunct type' do
763
669
  tested_types = all_types - [
764
670
  Puppet::Pops::Types::PAnyType,
765
- Puppet::Pops::Types::POptionalType,
766
- Puppet::Pops::Types::PNotUndefType,
767
671
  Puppet::Pops::Types::PDataType,
768
672
  Puppet::Pops::Types::PScalarType,
769
673
  ] - numeric_types
770
674
  t = Puppet::Pops::Types::PNumericType.new()
771
- tested_types.each {|t2| t.should_not be_assignable_to(t2.new) }
675
+ tested_types.each {|t2| expect(t).not_to be_assignable_to(t2.new) }
772
676
  end
773
677
  end
774
678
 
775
679
  context "for Collection, such that" do
776
680
  it "all collections are assignable to Collection" do
777
681
  t = Puppet::Pops::Types::PCollectionType.new()
778
- collection_types.each {|t2| t2.new.should be_assignable_to(t) }
682
+ collection_types.each {|t2| expect(t2.new).to be_assignable_to(t) }
779
683
  end
780
684
 
781
685
  it 'Collection is not assignable to any of its subtypes' do
782
686
  t = Puppet::Pops::Types::PCollectionType.new()
783
687
  types_to_test = collection_types - [Puppet::Pops::Types::PCollectionType]
784
- types_to_test.each {|t2| t.should_not be_assignable_to(t2.new) }
688
+ types_to_test.each {|t2| expect(t).not_to be_assignable_to(t2.new) }
785
689
  end
786
690
 
787
691
  it 'Collection is not assignable to any disjunct type' do
788
- tested_types = all_types - [Puppet::Pops::Types::PAnyType, Puppet::Pops::Types::POptionalType, Puppet::Pops::Types::PNotUndefType] - collection_types
692
+ tested_types = all_types - [Puppet::Pops::Types::PAnyType] - collection_types
789
693
  t = Puppet::Pops::Types::PCollectionType.new()
790
- tested_types.each {|t2| t.should_not be_assignable_to(t2.new) }
694
+ tested_types.each {|t2| expect(t).not_to be_assignable_to(t2.new) }
791
695
  end
792
696
  end
793
697
 
@@ -796,20 +700,17 @@ describe 'The type calculator' do
796
700
  t = Puppet::Pops::Types::PArrayType.new()
797
701
  tested_types = collection_types - [
798
702
  Puppet::Pops::Types::PCollectionType,
799
- Puppet::Pops::Types::PNotUndefType,
800
703
  Puppet::Pops::Types::PArrayType,
801
704
  Puppet::Pops::Types::PTupleType]
802
- tested_types.each {|t2| t.should_not be_assignable_to(t2.new) }
705
+ tested_types.each {|t2| expect(t).not_to be_assignable_to(t2.new) }
803
706
  end
804
707
 
805
708
  it 'Array is not assignable to any disjunct type' do
806
709
  tested_types = all_types - [
807
710
  Puppet::Pops::Types::PAnyType,
808
- Puppet::Pops::Types::POptionalType,
809
- Puppet::Pops::Types::PNotUndefType,
810
711
  Puppet::Pops::Types::PDataType] - collection_types
811
712
  t = Puppet::Pops::Types::PArrayType.new()
812
- tested_types.each {|t2| t.should_not be_assignable_to(t2.new) }
713
+ tested_types.each {|t2| expect(t).not_to be_assignable_to(t2.new) }
813
714
  end
814
715
  end
815
716
 
@@ -820,33 +721,31 @@ describe 'The type calculator' do
820
721
  Puppet::Pops::Types::PCollectionType,
821
722
  Puppet::Pops::Types::PStructType,
822
723
  Puppet::Pops::Types::PHashType]
823
- tested_types.each {|t2| t.should_not be_assignable_to(t2.new) }
724
+ tested_types.each {|t2| expect(t).not_to be_assignable_to(t2.new) }
824
725
  end
825
726
 
826
727
  it 'Hash is not assignable to any disjunct type' do
827
728
  tested_types = all_types - [
828
729
  Puppet::Pops::Types::PAnyType,
829
- Puppet::Pops::Types::POptionalType,
830
- Puppet::Pops::Types::PNotUndefType,
831
730
  Puppet::Pops::Types::PDataType] - collection_types
832
731
  t = Puppet::Pops::Types::PHashType.new()
833
- tested_types.each {|t2| t.should_not be_assignable_to(t2.new) }
732
+ tested_types.each {|t2| expect(t).not_to be_assignable_to(t2.new) }
834
733
  end
835
734
 
836
735
  it 'Struct is assignable to Hash with Pattern that matches all keys' do
837
- struct_t({'x' => integer_t, 'y' => integer_t}).should be_assignable_to(hash_t(pattern_t(/^\w+$/), factory.any))
736
+ expect(struct_t({'x' => integer_t, 'y' => integer_t})).to be_assignable_to(hash_t(pattern_t(/^\w+$/), factory.any))
838
737
  end
839
738
 
840
739
  it 'Struct is assignable to Hash with Enum that matches all keys' do
841
- struct_t({'x' => integer_t, 'y' => integer_t}).should be_assignable_to(hash_t(enum_t('x', 'y', 'z'), factory.any))
740
+ expect(struct_t({'x' => integer_t, 'y' => integer_t})).to be_assignable_to(hash_t(enum_t('x', 'y', 'z'), factory.any))
842
741
  end
843
742
 
844
743
  it 'Struct is not assignable to Hash with Pattern unless all keys match' do
845
- struct_t({'a' => integer_t, 'A' => integer_t}).should_not be_assignable_to(hash_t(pattern_t(/^[A-Z]+$/), factory.any))
744
+ expect(struct_t({'a' => integer_t, 'A' => integer_t})).not_to be_assignable_to(hash_t(pattern_t(/^[A-Z]+$/), factory.any))
846
745
  end
847
746
 
848
747
  it 'Struct is not assignable to Hash with Enum unless all keys match' do
849
- struct_t({'a' => integer_t, 'y' => integer_t}).should_not be_assignable_to(hash_t(enum_t('x', 'y', 'z'), factory.any))
748
+ expect(struct_t({'a' => integer_t, 'y' => integer_t})).not_to be_assignable_to(hash_t(enum_t('x', 'y', 'z'), factory.any))
850
749
  end
851
750
  end
852
751
 
@@ -857,17 +756,15 @@ describe 'The type calculator' do
857
756
  Puppet::Pops::Types::PCollectionType,
858
757
  Puppet::Pops::Types::PTupleType,
859
758
  Puppet::Pops::Types::PArrayType]
860
- tested_types.each {|t2| t.should_not be_assignable_to(t2.new) }
759
+ tested_types.each {|t2| expect(t).not_to be_assignable_to(t2.new) }
861
760
  end
862
761
 
863
762
  it 'Tuple is not assignable to any disjunct type' do
864
763
  tested_types = all_types - [
865
764
  Puppet::Pops::Types::PAnyType,
866
- Puppet::Pops::Types::POptionalType,
867
- Puppet::Pops::Types::PNotUndefType,
868
765
  Puppet::Pops::Types::PDataType] - collection_types
869
766
  t = Puppet::Pops::Types::PTupleType.new()
870
- tested_types.each {|t2| t.should_not be_assignable_to(t2.new) }
767
+ tested_types.each {|t2| expect(t).not_to be_assignable_to(t2.new) }
871
768
  end
872
769
  end
873
770
 
@@ -878,46 +775,15 @@ describe 'The type calculator' do
878
775
  Puppet::Pops::Types::PCollectionType,
879
776
  Puppet::Pops::Types::PStructType,
880
777
  Puppet::Pops::Types::PHashType]
881
- tested_types.each {|t2| t.should_not be_assignable_to(t2.new) }
778
+ tested_types.each {|t2| expect(t).not_to be_assignable_to(t2.new) }
882
779
  end
883
780
 
884
781
  it 'Struct is not assignable to any disjunct type' do
885
782
  tested_types = all_types - [
886
783
  Puppet::Pops::Types::PAnyType,
887
- Puppet::Pops::Types::POptionalType,
888
- Puppet::Pops::Types::PNotUndefType,
889
784
  Puppet::Pops::Types::PDataType] - collection_types
890
785
  t = Puppet::Pops::Types::PStructType.new()
891
- tested_types.each {|t2| t.should_not be_assignable_to(t2.new) }
892
- end
893
-
894
- it 'Default key optionality is controlled by value assignability to undef' do
895
- t1 = struct_t({'member' => string_t})
896
- expect(t1.elements[0].key_type).to eq(string_t('member'))
897
- t1 = struct_t({'member' => object_t})
898
- expect(t1.elements[0].key_type).to eq(optional_t(string_t('member')))
899
- end
900
-
901
- it "NotUndef['key'] becomes String['key'] (since its implied that String is required)" do
902
- t1 = struct_t({not_undef_t('member') => string_t})
903
- expect(t1.elements[0].key_type).to eq(string_t('member'))
904
- end
905
-
906
- it "Optional['key'] becomes Optional[String['key']]" do
907
- t1 = struct_t({optional_t('member') => string_t})
908
- expect(t1.elements[0].key_type).to eq(optional_t(string_t('member')))
909
- end
910
-
911
- it 'Optional members are not required' do
912
- t1 = struct_t({optional_t('optional_member') => string_t, not_undef_t('other_member') => string_t})
913
- t2 = struct_t({not_undef_t('other_member') => string_t})
914
- expect(t2).to be_assignable_to(t1)
915
- end
916
-
917
- it 'Required members not optional even when value is' do
918
- t1 = struct_t({not_undef_t('required_member') => object_t, not_undef_t('other_member') => string_t})
919
- t2 = struct_t({not_undef_t('other_member') => string_t})
920
- expect(t2).not_to be_assignable_to(t1)
786
+ tested_types.each {|t2| expect(t).not_to be_assignable_to(t2.new) }
921
787
  end
922
788
  end
923
789
 
@@ -926,10 +792,8 @@ describe 'The type calculator' do
926
792
  t = Puppet::Pops::Types::PCallableType.new()
927
793
  tested_types = all_types - [
928
794
  Puppet::Pops::Types::PCallableType,
929
- Puppet::Pops::Types::PAnyType,
930
- Puppet::Pops::Types::POptionalType,
931
- Puppet::Pops::Types::PNotUndefType]
932
- tested_types.each {|t2| t.should_not be_assignable_to(t2.new) }
795
+ Puppet::Pops::Types::PAnyType]
796
+ tested_types.each {|t2| expect(t).not_to be_assignable_to(t2.new) }
933
797
  end
934
798
  end
935
799
 
@@ -948,43 +812,43 @@ describe 'The type calculator' do
948
812
  Array => Puppet::Pops::Types::TypeFactory.array_of_data(),
949
813
  Hash => Puppet::Pops::Types::TypeFactory.hash_of_data()
950
814
  }.each do |ruby_type, puppet_type |
951
- ruby_type.should be_assignable_to(puppet_type)
815
+ expect(ruby_type).to be_assignable_to(puppet_type)
952
816
  end
953
817
  end
954
818
 
955
819
  context 'when dealing with integer ranges' do
956
820
  it 'should accept an equal range' do
957
- calculator.assignable?(range_t(2,5), range_t(2,5)).should == true
821
+ expect(calculator.assignable?(range_t(2,5), range_t(2,5))).to eq(true)
958
822
  end
959
823
 
960
824
  it 'should accept an equal reverse range' do
961
- calculator.assignable?(range_t(2,5), range_t(5,2)).should == true
825
+ expect(calculator.assignable?(range_t(2,5), range_t(5,2))).to eq(true)
962
826
  end
963
827
 
964
828
  it 'should accept a narrower range' do
965
- calculator.assignable?(range_t(2,10), range_t(3,5)).should == true
829
+ expect(calculator.assignable?(range_t(2,10), range_t(3,5))).to eq(true)
966
830
  end
967
831
 
968
832
  it 'should accept a narrower reverse range' do
969
- calculator.assignable?(range_t(2,10), range_t(5,3)).should == true
833
+ expect(calculator.assignable?(range_t(2,10), range_t(5,3))).to eq(true)
970
834
  end
971
835
 
972
836
  it 'should reject a wider range' do
973
- calculator.assignable?(range_t(3,5), range_t(2,10)).should == false
837
+ expect(calculator.assignable?(range_t(3,5), range_t(2,10))).to eq(false)
974
838
  end
975
839
 
976
840
  it 'should reject a wider reverse range' do
977
- calculator.assignable?(range_t(3,5), range_t(10,2)).should == false
841
+ expect(calculator.assignable?(range_t(3,5), range_t(10,2))).to eq(false)
978
842
  end
979
843
 
980
844
  it 'should reject a partially overlapping range' do
981
- calculator.assignable?(range_t(3,5), range_t(2,4)).should == false
982
- calculator.assignable?(range_t(3,5), range_t(4,6)).should == false
845
+ expect(calculator.assignable?(range_t(3,5), range_t(2,4))).to eq(false)
846
+ expect(calculator.assignable?(range_t(3,5), range_t(4,6))).to eq(false)
983
847
  end
984
848
 
985
849
  it 'should reject a partially overlapping reverse range' do
986
- calculator.assignable?(range_t(3,5), range_t(4,2)).should == false
987
- calculator.assignable?(range_t(3,5), range_t(6,4)).should == false
850
+ expect(calculator.assignable?(range_t(3,5), range_t(4,2))).to eq(false)
851
+ expect(calculator.assignable?(range_t(3,5), range_t(6,4))).to eq(false)
988
852
  end
989
853
  end
990
854
 
@@ -992,134 +856,134 @@ describe 'The type calculator' do
992
856
  it 'should accept a string matching a pattern' do
993
857
  p_t = pattern_t('abc')
994
858
  p_s = string_t('XabcY')
995
- calculator.assignable?(p_t, p_s).should == true
859
+ expect(calculator.assignable?(p_t, p_s)).to eq(true)
996
860
  end
997
861
 
998
862
  it 'should accept a regexp matching a pattern' do
999
863
  p_t = pattern_t(/abc/)
1000
864
  p_s = string_t('XabcY')
1001
- calculator.assignable?(p_t, p_s).should == true
865
+ expect(calculator.assignable?(p_t, p_s)).to eq(true)
1002
866
  end
1003
867
 
1004
868
  it 'should accept a pattern matching a pattern' do
1005
869
  p_t = pattern_t(pattern_t('abc'))
1006
870
  p_s = string_t('XabcY')
1007
- calculator.assignable?(p_t, p_s).should == true
871
+ expect(calculator.assignable?(p_t, p_s)).to eq(true)
1008
872
  end
1009
873
 
1010
874
  it 'should accept a regexp matching a pattern' do
1011
875
  p_t = pattern_t(regexp_t('abc'))
1012
876
  p_s = string_t('XabcY')
1013
- calculator.assignable?(p_t, p_s).should == true
877
+ expect(calculator.assignable?(p_t, p_s)).to eq(true)
1014
878
  end
1015
879
 
1016
880
  it 'should accept a string matching all patterns' do
1017
881
  p_t = pattern_t('abc', 'ab', 'c')
1018
882
  p_s = string_t('XabcY')
1019
- calculator.assignable?(p_t, p_s).should == true
883
+ expect(calculator.assignable?(p_t, p_s)).to eq(true)
1020
884
  end
1021
885
 
1022
886
  it 'should accept multiple strings if they all match any patterns' do
1023
887
  p_t = pattern_t('X', 'Y', 'abc')
1024
888
  p_s = string_t('Xa', 'aY', 'abc')
1025
- calculator.assignable?(p_t, p_s).should == true
889
+ expect(calculator.assignable?(p_t, p_s)).to eq(true)
1026
890
  end
1027
891
 
1028
892
  it 'should reject a string not matching any patterns' do
1029
893
  p_t = pattern_t('abc', 'ab', 'c')
1030
894
  p_s = string_t('XqqqY')
1031
- calculator.assignable?(p_t, p_s).should == false
895
+ expect(calculator.assignable?(p_t, p_s)).to eq(false)
1032
896
  end
1033
897
 
1034
898
  it 'should reject multiple strings if not all match any patterns' do
1035
899
  p_t = pattern_t('abc', 'ab', 'c', 'q')
1036
900
  p_s = string_t('X', 'Y', 'Z')
1037
- calculator.assignable?(p_t, p_s).should == false
901
+ expect(calculator.assignable?(p_t, p_s)).to eq(false)
1038
902
  end
1039
903
 
1040
904
  it 'should accept enum matching patterns as instanceof' do
1041
905
  enum = enum_t('XS', 'S', 'M', 'L' 'XL', 'XXL')
1042
906
  pattern = pattern_t('S', 'M', 'L')
1043
- calculator.assignable?(pattern, enum).should == true
907
+ expect(calculator.assignable?(pattern, enum)).to eq(true)
1044
908
  end
1045
909
 
1046
910
  it 'pattern should accept a variant where all variants are acceptable' do
1047
911
  pattern = pattern_t(/^\w+$/)
1048
- calculator.assignable?(pattern, variant_t(string_t('a'), string_t('b'))).should == true
912
+ expect(calculator.assignable?(pattern, variant_t(string_t('a'), string_t('b')))).to eq(true)
1049
913
  end
1050
914
 
1051
915
  it 'pattern representing all patterns should accept any pattern' do
1052
- calculator.assignable?(pattern_t(), pattern_t('a')).should == true
1053
- calculator.assignable?(pattern_t(), pattern_t()).should == true
916
+ expect(calculator.assignable?(pattern_t(), pattern_t('a'))).to eq(true)
917
+ expect(calculator.assignable?(pattern_t(), pattern_t())).to eq(true)
1054
918
  end
1055
919
 
1056
920
  it 'pattern representing all patterns should accept any enum' do
1057
- calculator.assignable?(pattern_t(), enum_t('a')).should == true
1058
- calculator.assignable?(pattern_t(), enum_t()).should == true
921
+ expect(calculator.assignable?(pattern_t(), enum_t('a'))).to eq(true)
922
+ expect(calculator.assignable?(pattern_t(), enum_t())).to eq(true)
1059
923
  end
1060
924
 
1061
925
  it 'pattern representing all patterns should accept any string' do
1062
- calculator.assignable?(pattern_t(), string_t('a')).should == true
1063
- calculator.assignable?(pattern_t(), string_t()).should == true
926
+ expect(calculator.assignable?(pattern_t(), string_t('a'))).to eq(true)
927
+ expect(calculator.assignable?(pattern_t(), string_t())).to eq(true)
1064
928
  end
1065
929
 
1066
930
  end
1067
931
 
1068
932
  context 'when dealing with enums' do
1069
933
  it 'should accept a string with matching content' do
1070
- calculator.assignable?(enum_t('a', 'b'), string_t('a')).should == true
1071
- calculator.assignable?(enum_t('a', 'b'), string_t('b')).should == true
1072
- calculator.assignable?(enum_t('a', 'b'), string_t('c')).should == false
934
+ expect(calculator.assignable?(enum_t('a', 'b'), string_t('a'))).to eq(true)
935
+ expect(calculator.assignable?(enum_t('a', 'b'), string_t('b'))).to eq(true)
936
+ expect(calculator.assignable?(enum_t('a', 'b'), string_t('c'))).to eq(false)
1073
937
  end
1074
938
 
1075
939
  it 'should accept an enum with matching enum' do
1076
- calculator.assignable?(enum_t('a', 'b'), enum_t('a', 'b')).should == true
1077
- calculator.assignable?(enum_t('a', 'b'), enum_t('a')).should == true
1078
- calculator.assignable?(enum_t('a', 'b'), enum_t('c')).should == false
940
+ expect(calculator.assignable?(enum_t('a', 'b'), enum_t('a', 'b'))).to eq(true)
941
+ expect(calculator.assignable?(enum_t('a', 'b'), enum_t('a'))).to eq(true)
942
+ expect(calculator.assignable?(enum_t('a', 'b'), enum_t('c'))).to eq(false)
1079
943
  end
1080
944
 
1081
945
  it 'non parameterized enum accepts any other enum but not the reverse' do
1082
- calculator.assignable?(enum_t(), enum_t('a')).should == true
1083
- calculator.assignable?(enum_t('a'), enum_t()).should == false
946
+ expect(calculator.assignable?(enum_t(), enum_t('a'))).to eq(true)
947
+ expect(calculator.assignable?(enum_t('a'), enum_t())).to eq(false)
1084
948
  end
1085
949
 
1086
950
  it 'enum should accept a variant where all variants are acceptable' do
1087
951
  enum = enum_t('a', 'b')
1088
- calculator.assignable?(enum, variant_t(string_t('a'), string_t('b'))).should == true
952
+ expect(calculator.assignable?(enum, variant_t(string_t('a'), string_t('b')))).to eq(true)
1089
953
  end
1090
954
  end
1091
955
 
1092
956
  context 'when dealing with string and enum combinations' do
1093
957
  it 'should accept assigning any enum to unrestricted string' do
1094
- calculator.assignable?(string_t(), enum_t('blue')).should == true
1095
- calculator.assignable?(string_t(), enum_t('blue', 'red')).should == true
958
+ expect(calculator.assignable?(string_t(), enum_t('blue'))).to eq(true)
959
+ expect(calculator.assignable?(string_t(), enum_t('blue', 'red'))).to eq(true)
1096
960
  end
1097
961
 
1098
962
  it 'should not accept assigning longer enum value to size restricted string' do
1099
- calculator.assignable?(constrained_t(string_t(),2,2), enum_t('a','blue')).should == false
963
+ expect(calculator.assignable?(constrained_t(string_t(),2,2), enum_t('a','blue'))).to eq(false)
1100
964
  end
1101
965
 
1102
966
  it 'should accept assigning any string to empty enum' do
1103
- calculator.assignable?(enum_t(), string_t()).should == true
967
+ expect(calculator.assignable?(enum_t(), string_t())).to eq(true)
1104
968
  end
1105
969
 
1106
970
  it 'should accept assigning empty enum to any string' do
1107
- calculator.assignable?(string_t(), enum_t()).should == true
971
+ expect(calculator.assignable?(string_t(), enum_t())).to eq(true)
1108
972
  end
1109
973
 
1110
974
  it 'should not accept assigning empty enum to size constrained string' do
1111
- calculator.assignable?(constrained_t(string_t(),2,2), enum_t()).should == false
975
+ expect(calculator.assignable?(constrained_t(string_t(),2,2), enum_t())).to eq(false)
1112
976
  end
1113
977
  end
1114
978
 
1115
979
  context 'when dealing with string/pattern/enum combinations' do
1116
980
  it 'any string is equal to any enum is equal to any pattern' do
1117
- calculator.assignable?(string_t(), enum_t()).should == true
1118
- calculator.assignable?(string_t(), pattern_t()).should == true
1119
- calculator.assignable?(enum_t(), string_t()).should == true
1120
- calculator.assignable?(enum_t(), pattern_t()).should == true
1121
- calculator.assignable?(pattern_t(), string_t()).should == true
1122
- calculator.assignable?(pattern_t(), enum_t()).should == true
981
+ expect(calculator.assignable?(string_t(), enum_t())).to eq(true)
982
+ expect(calculator.assignable?(string_t(), pattern_t())).to eq(true)
983
+ expect(calculator.assignable?(enum_t(), string_t())).to eq(true)
984
+ expect(calculator.assignable?(enum_t(), pattern_t())).to eq(true)
985
+ expect(calculator.assignable?(pattern_t(), string_t())).to eq(true)
986
+ expect(calculator.assignable?(pattern_t(), enum_t())).to eq(true)
1123
987
  end
1124
988
  end
1125
989
 
@@ -1128,8 +992,8 @@ describe 'The type calculator' do
1128
992
  tuple1 = tuple_t()
1129
993
  tuple2 = tuple_t()
1130
994
 
1131
- calculator.assignable?(tuple1, tuple2).should == true
1132
- calculator.assignable?(tuple2, tuple1).should == true
995
+ expect(calculator.assignable?(tuple1, tuple2)).to eq(true)
996
+ expect(calculator.assignable?(tuple2, tuple1)).to eq(true)
1133
997
  end
1134
998
 
1135
999
  it 'accepts an empty tuple as assignable to a tuple with a min size of 0' do
@@ -1137,46 +1001,46 @@ describe 'The type calculator' do
1137
1001
  factory.constrain_size(tuple1, 0, :default)
1138
1002
  tuple2 = tuple_t()
1139
1003
 
1140
- calculator.assignable?(tuple1, tuple2).should == true
1141
- calculator.assignable?(tuple2, tuple1).should == false
1004
+ expect(calculator.assignable?(tuple1, tuple2)).to eq(true)
1005
+ expect(calculator.assignable?(tuple2, tuple1)).to eq(false)
1142
1006
  end
1143
1007
 
1144
1008
  it 'should accept matching tuples' do
1145
1009
  tuple1 = tuple_t(1,2)
1146
1010
  tuple2 = tuple_t(Integer,Integer)
1147
- calculator.assignable?(tuple1, tuple2).should == true
1148
- calculator.assignable?(tuple2, tuple1).should == true
1011
+ expect(calculator.assignable?(tuple1, tuple2)).to eq(true)
1012
+ expect(calculator.assignable?(tuple2, tuple1)).to eq(true)
1149
1013
  end
1150
1014
 
1151
1015
  it 'should accept matching tuples where one is more general than the other' do
1152
1016
  tuple1 = tuple_t(1,2)
1153
1017
  tuple2 = tuple_t(Numeric,Numeric)
1154
- calculator.assignable?(tuple1, tuple2).should == false
1155
- calculator.assignable?(tuple2, tuple1).should == true
1018
+ expect(calculator.assignable?(tuple1, tuple2)).to eq(false)
1019
+ expect(calculator.assignable?(tuple2, tuple1)).to eq(true)
1156
1020
  end
1157
1021
 
1158
1022
  it 'should accept ranged tuples' do
1159
1023
  tuple1 = tuple_t(1)
1160
1024
  factory.constrain_size(tuple1, 5, 5)
1161
1025
  tuple2 = tuple_t(Integer,Integer, Integer, Integer, Integer)
1162
- calculator.assignable?(tuple1, tuple2).should == true
1163
- calculator.assignable?(tuple2, tuple1).should == true
1026
+ expect(calculator.assignable?(tuple1, tuple2)).to eq(true)
1027
+ expect(calculator.assignable?(tuple2, tuple1)).to eq(true)
1164
1028
  end
1165
1029
 
1166
1030
  it 'should reject ranged tuples when ranges does not match' do
1167
1031
  tuple1 = tuple_t(1)
1168
1032
  factory.constrain_size(tuple1, 4, 5)
1169
1033
  tuple2 = tuple_t(Integer,Integer, Integer, Integer, Integer)
1170
- calculator.assignable?(tuple1, tuple2).should == true
1171
- calculator.assignable?(tuple2, tuple1).should == false
1034
+ expect(calculator.assignable?(tuple1, tuple2)).to eq(true)
1035
+ expect(calculator.assignable?(tuple2, tuple1)).to eq(false)
1172
1036
  end
1173
1037
 
1174
1038
  it 'should reject ranged tuples when ranges does not match (using infinite upper bound)' do
1175
1039
  tuple1 = tuple_t(1)
1176
1040
  factory.constrain_size(tuple1, 4, :default)
1177
1041
  tuple2 = tuple_t(Integer,Integer, Integer, Integer, Integer)
1178
- calculator.assignable?(tuple1, tuple2).should == true
1179
- calculator.assignable?(tuple2, tuple1).should == false
1042
+ expect(calculator.assignable?(tuple1, tuple2)).to eq(true)
1043
+ expect(calculator.assignable?(tuple2, tuple1)).to eq(false)
1180
1044
  end
1181
1045
 
1182
1046
  it 'should accept matching tuples with optional entries by repeating last' do
@@ -1184,25 +1048,25 @@ describe 'The type calculator' do
1184
1048
  factory.constrain_size(tuple1, 0, :default)
1185
1049
  tuple2 = tuple_t(Numeric,Numeric)
1186
1050
  factory.constrain_size(tuple2, 0, :default)
1187
- calculator.assignable?(tuple1, tuple2).should == false
1188
- calculator.assignable?(tuple2, tuple1).should == true
1051
+ expect(calculator.assignable?(tuple1, tuple2)).to eq(false)
1052
+ expect(calculator.assignable?(tuple2, tuple1)).to eq(true)
1189
1053
  end
1190
1054
 
1191
1055
  it 'should accept matching tuples with optional entries' do
1192
1056
  tuple1 = tuple_t(Integer, Integer, String)
1193
1057
  factory.constrain_size(tuple1, 1, 3)
1194
1058
  array2 = factory.constrain_size(array_t(Integer),2,2)
1195
- calculator.assignable?(tuple1, array2).should == true
1059
+ expect(calculator.assignable?(tuple1, array2)).to eq(true)
1196
1060
  factory.constrain_size(tuple1, 3, 3)
1197
- calculator.assignable?(tuple1, array2).should == false
1061
+ expect(calculator.assignable?(tuple1, array2)).to eq(false)
1198
1062
  end
1199
1063
 
1200
1064
  it 'should accept matching array' do
1201
1065
  tuple1 = tuple_t(1,2)
1202
1066
  array = array_t(Integer)
1203
1067
  factory.constrain_size(array, 2, 2)
1204
- calculator.assignable?(tuple1, array).should == true
1205
- calculator.assignable?(array, tuple1).should == true
1068
+ expect(calculator.assignable?(tuple1, array)).to eq(true)
1069
+ expect(calculator.assignable?(array, tuple1)).to eq(true)
1206
1070
  end
1207
1071
 
1208
1072
  it 'should accept empty array when tuple allows min of 0' do
@@ -1212,8 +1076,8 @@ describe 'The type calculator' do
1212
1076
  array = array_t(Integer)
1213
1077
  factory.constrain_size(array, 0, 0)
1214
1078
 
1215
- calculator.assignable?(tuple1, array).should == true
1216
- calculator.assignable?(array, tuple1).should == false
1079
+ expect(calculator.assignable?(tuple1, array)).to eq(true)
1080
+ expect(calculator.assignable?(array, tuple1)).to eq(false)
1217
1081
  end
1218
1082
  end
1219
1083
 
@@ -1221,39 +1085,39 @@ describe 'The type calculator' do
1221
1085
  it 'should accept matching structs' do
1222
1086
  struct1 = struct_t({'a'=>Integer, 'b'=>Integer})
1223
1087
  struct2 = struct_t({'a'=>Integer, 'b'=>Integer})
1224
- calculator.assignable?(struct1, struct2).should == true
1225
- calculator.assignable?(struct2, struct1).should == true
1088
+ expect(calculator.assignable?(struct1, struct2)).to eq(true)
1089
+ expect(calculator.assignable?(struct2, struct1)).to eq(true)
1226
1090
  end
1227
1091
 
1228
1092
  it 'should accept matching structs with less elements when unmatched elements are optional' do
1229
1093
  struct1 = struct_t({'a'=>Integer, 'b'=>Integer, 'c'=>optional_t(Integer)})
1230
1094
  struct2 = struct_t({'a'=>Integer, 'b'=>Integer})
1231
- calculator.assignable?(struct1, struct2).should == true
1095
+ expect(calculator.assignable?(struct1, struct2)).to eq(true)
1232
1096
  end
1233
1097
 
1234
1098
  it 'should reject matching structs with more elements even if excess elements are optional' do
1235
1099
  struct1 = struct_t({'a'=>Integer, 'b'=>Integer})
1236
1100
  struct2 = struct_t({'a'=>Integer, 'b'=>Integer, 'c'=>optional_t(Integer)})
1237
- calculator.assignable?(struct1, struct2).should == false
1101
+ expect(calculator.assignable?(struct1, struct2)).to eq(false)
1238
1102
  end
1239
1103
 
1240
1104
  it 'should accept matching structs where one is more general than the other with respect to optional' do
1241
1105
  struct1 = struct_t({'a'=>Integer, 'b'=>Integer, 'c'=>optional_t(Integer)})
1242
1106
  struct2 = struct_t({'a'=>Integer, 'b'=>Integer, 'c'=>Integer})
1243
- calculator.assignable?(struct1, struct2).should == true
1107
+ expect(calculator.assignable?(struct1, struct2)).to eq(true)
1244
1108
  end
1245
1109
 
1246
1110
  it 'should reject matching structs where one is more special than the other with respect to optional' do
1247
1111
  struct1 = struct_t({'a'=>Integer, 'b'=>Integer, 'c'=>Integer})
1248
1112
  struct2 = struct_t({'a'=>Integer, 'b'=>Integer, 'c'=>optional_t(Integer)})
1249
- calculator.assignable?(struct1, struct2).should == false
1113
+ expect(calculator.assignable?(struct1, struct2)).to eq(false)
1250
1114
  end
1251
1115
 
1252
1116
  it 'should accept matching structs where one is more general than the other' do
1253
1117
  struct1 = struct_t({'a'=>Integer, 'b'=>Integer})
1254
1118
  struct2 = struct_t({'a'=>Numeric, 'b'=>Numeric})
1255
- calculator.assignable?(struct1, struct2).should == false
1256
- calculator.assignable?(struct2, struct1).should == true
1119
+ expect(calculator.assignable?(struct1, struct2)).to eq(false)
1120
+ expect(calculator.assignable?(struct2, struct1)).to eq(true)
1257
1121
  end
1258
1122
 
1259
1123
  it 'should accept matching hash' do
@@ -1262,15 +1126,15 @@ describe 'The type calculator' do
1262
1126
  non_empty_string.size_type = range_t(1, nil)
1263
1127
  hsh = hash_t(non_empty_string, Integer)
1264
1128
  factory.constrain_size(hsh, 2, 2)
1265
- calculator.assignable?(struct1, hsh).should == true
1266
- calculator.assignable?(hsh, struct1).should == true
1129
+ expect(calculator.assignable?(struct1, hsh)).to eq(true)
1130
+ expect(calculator.assignable?(hsh, struct1)).to eq(true)
1267
1131
  end
1268
1132
 
1269
1133
  it 'should accept empty hash with key_type undef' do
1270
1134
  struct1 = struct_t({'a'=>optional_t(Integer)})
1271
1135
  hsh = hash_t(undef_t, undef_t)
1272
1136
  factory.constrain_size(hsh, 0, 0)
1273
- calculator.assignable?(struct1, hsh).should == true
1137
+ expect(calculator.assignable?(struct1, hsh)).to eq(true)
1274
1138
  end
1275
1139
  end
1276
1140
 
@@ -1284,62 +1148,62 @@ describe 'The type calculator' do
1284
1148
  fooType = calculator.infer(Foo.new)
1285
1149
  barType = calculator.infer(Bar.new)
1286
1150
 
1287
- calculator.assignable?(fooType, fooType).should == true
1288
- calculator.assignable?(Foo, fooType).should == true
1151
+ expect(calculator.assignable?(fooType, fooType)).to eq(true)
1152
+ expect(calculator.assignable?(Foo, fooType)).to eq(true)
1289
1153
 
1290
- calculator.assignable?(fooType, barType).should == true
1291
- calculator.assignable?(Foo, barType).should == true
1154
+ expect(calculator.assignable?(fooType, barType)).to eq(true)
1155
+ expect(calculator.assignable?(Foo, barType)).to eq(true)
1292
1156
 
1293
- calculator.assignable?(barType, fooType).should == false
1294
- calculator.assignable?(Bar, fooType).should == false
1157
+ expect(calculator.assignable?(barType, fooType)).to eq(false)
1158
+ expect(calculator.assignable?(Bar, fooType)).to eq(false)
1295
1159
  end
1296
1160
 
1297
1161
  it "should allow host class with same name" do
1298
1162
  hc1 = Puppet::Pops::Types::TypeFactory.host_class('the_name')
1299
1163
  hc2 = Puppet::Pops::Types::TypeFactory.host_class('the_name')
1300
- calculator.assignable?(hc1, hc2).should == true
1164
+ expect(calculator.assignable?(hc1, hc2)).to eq(true)
1301
1165
  end
1302
1166
 
1303
1167
  it "should allow host class with name assigned to hostclass without name" do
1304
1168
  hc1 = Puppet::Pops::Types::TypeFactory.host_class()
1305
1169
  hc2 = Puppet::Pops::Types::TypeFactory.host_class('the_name')
1306
- calculator.assignable?(hc1, hc2).should == true
1170
+ expect(calculator.assignable?(hc1, hc2)).to eq(true)
1307
1171
  end
1308
1172
 
1309
1173
  it "should reject host classes with different names" do
1310
1174
  hc1 = Puppet::Pops::Types::TypeFactory.host_class('the_name')
1311
1175
  hc2 = Puppet::Pops::Types::TypeFactory.host_class('another_name')
1312
- calculator.assignable?(hc1, hc2).should == false
1176
+ expect(calculator.assignable?(hc1, hc2)).to eq(false)
1313
1177
  end
1314
1178
 
1315
1179
  it "should reject host classes without name assigned to host class with name" do
1316
1180
  hc1 = Puppet::Pops::Types::TypeFactory.host_class('the_name')
1317
1181
  hc2 = Puppet::Pops::Types::TypeFactory.host_class()
1318
- calculator.assignable?(hc1, hc2).should == false
1182
+ expect(calculator.assignable?(hc1, hc2)).to eq(false)
1319
1183
  end
1320
1184
 
1321
1185
  it "should allow resource with same type_name and title" do
1322
1186
  r1 = Puppet::Pops::Types::TypeFactory.resource('file', 'foo')
1323
1187
  r2 = Puppet::Pops::Types::TypeFactory.resource('file', 'foo')
1324
- calculator.assignable?(r1, r2).should == true
1188
+ expect(calculator.assignable?(r1, r2)).to eq(true)
1325
1189
  end
1326
1190
 
1327
1191
  it "should allow more specific resource assignment" do
1328
1192
  r1 = Puppet::Pops::Types::TypeFactory.resource()
1329
1193
  r2 = Puppet::Pops::Types::TypeFactory.resource('file')
1330
- calculator.assignable?(r1, r2).should == true
1194
+ expect(calculator.assignable?(r1, r2)).to eq(true)
1331
1195
  r2 = Puppet::Pops::Types::TypeFactory.resource('file', '/tmp/foo')
1332
- calculator.assignable?(r1, r2).should == true
1196
+ expect(calculator.assignable?(r1, r2)).to eq(true)
1333
1197
  r1 = Puppet::Pops::Types::TypeFactory.resource('file')
1334
- calculator.assignable?(r1, r2).should == true
1198
+ expect(calculator.assignable?(r1, r2)).to eq(true)
1335
1199
  end
1336
1200
 
1337
1201
  it "should reject less specific resource assignment" do
1338
1202
  r1 = Puppet::Pops::Types::TypeFactory.resource('file', '/tmp/foo')
1339
1203
  r2 = Puppet::Pops::Types::TypeFactory.resource('file')
1340
- calculator.assignable?(r1, r2).should == false
1204
+ expect(calculator.assignable?(r1, r2)).to eq(false)
1341
1205
  r2 = Puppet::Pops::Types::TypeFactory.resource()
1342
- calculator.assignable?(r1, r2).should == false
1206
+ expect(calculator.assignable?(r1, r2)).to eq(false)
1343
1207
  end
1344
1208
 
1345
1209
  end
@@ -1348,26 +1212,26 @@ describe 'The type calculator' do
1348
1212
  include_context "types_setup"
1349
1213
 
1350
1214
  it 'should consider undef to be instance of Any, NilType, and optional' do
1351
- calculator.instance?(Puppet::Pops::Types::PUndefType.new(), nil).should == true
1352
- calculator.instance?(Puppet::Pops::Types::PAnyType.new(), nil).should == true
1353
- calculator.instance?(Puppet::Pops::Types::POptionalType.new(), nil).should == true
1215
+ expect(calculator.instance?(Puppet::Pops::Types::PUndefType.new(), nil)).to eq(true)
1216
+ expect(calculator.instance?(Puppet::Pops::Types::PAnyType.new(), nil)).to eq(true)
1217
+ expect(calculator.instance?(Puppet::Pops::Types::POptionalType.new(), nil)).to eq(true)
1354
1218
  end
1355
1219
 
1356
1220
  it 'all types should be (ruby) instance of PAnyType' do
1357
1221
  all_types.each do |t|
1358
- t.new.is_a?(Puppet::Pops::Types::PAnyType).should == true
1222
+ expect(t.new.is_a?(Puppet::Pops::Types::PAnyType)).to eq(true)
1359
1223
  end
1360
1224
  end
1361
1225
 
1362
- it "should consider :undef to be instance of Undef" do
1363
- calculator.instance?(Puppet::Pops::Types::PUndefType.new(), :undef).should == true
1226
+ it "should consider :undef to be instance of Runtime['ruby', 'Symbol]" do
1227
+ expect(calculator.instance?(Puppet::Pops::Types::PRuntimeType.new(:runtime => :ruby, :runtime_type_name => 'Symbol'), :undef)).to eq(true)
1364
1228
  end
1365
1229
 
1366
1230
  it "should consider :undef to be instance of an Optional type" do
1367
- calculator.instance?(Puppet::Pops::Types::POptionalType.new(), :undef).should == true
1231
+ expect(calculator.instance?(Puppet::Pops::Types::POptionalType.new(), :undef)).to eq(true)
1368
1232
  end
1369
1233
 
1370
- it 'should not consider undef to be an instance of any other type than Any, UndefType and Data' do
1234
+ it 'should not consider undef to be an instance of any other type than Any, NilType and Data' do
1371
1235
  types_to_test = all_types - [
1372
1236
  Puppet::Pops::Types::PAnyType,
1373
1237
  Puppet::Pops::Types::PUndefType,
@@ -1375,209 +1239,181 @@ describe 'The type calculator' do
1375
1239
  Puppet::Pops::Types::POptionalType,
1376
1240
  ]
1377
1241
 
1378
- types_to_test.each {|t| calculator.instance?(t.new, nil).should == false }
1379
- types_to_test.each {|t| calculator.instance?(t.new, :undef).should == false }
1242
+ types_to_test.each {|t| expect(calculator.instance?(t.new, nil)).to eq(false) }
1243
+ types_to_test.each {|t| expect(calculator.instance?(t.new, :undef)).to eq(false) }
1380
1244
  end
1381
1245
 
1382
1246
  it 'should consider default to be instance of Default and Any' do
1383
- calculator.instance?(Puppet::Pops::Types::PDefaultType.new(), :default).should == true
1384
- calculator.instance?(Puppet::Pops::Types::PAnyType.new(), :default).should == true
1247
+ expect(calculator.instance?(Puppet::Pops::Types::PDefaultType.new(), :default)).to eq(true)
1248
+ expect(calculator.instance?(Puppet::Pops::Types::PAnyType.new(), :default)).to eq(true)
1385
1249
  end
1386
1250
 
1387
- it 'should not consider "default" to be an instance of anything but Default, NotUndef, and Any' do
1251
+ it 'should not consider "default" to be an instance of anything but Default, and Any' do
1388
1252
  types_to_test = all_types - [
1389
1253
  Puppet::Pops::Types::PAnyType,
1390
- Puppet::Pops::Types::PNotUndefType,
1391
1254
  Puppet::Pops::Types::PDefaultType,
1392
1255
  ]
1393
1256
 
1394
- types_to_test.each {|t| calculator.instance?(t.new, :default).should == false }
1257
+ types_to_test.each {|t| expect(calculator.instance?(t.new, :default)).to eq(false) }
1395
1258
  end
1396
1259
 
1397
1260
  it 'should consider fixnum instanceof PIntegerType' do
1398
- calculator.instance?(Puppet::Pops::Types::PIntegerType.new(), 1).should == true
1261
+ expect(calculator.instance?(Puppet::Pops::Types::PIntegerType.new(), 1)).to eq(true)
1399
1262
  end
1400
1263
 
1401
1264
  it 'should consider fixnum instanceof Fixnum' do
1402
- calculator.instance?(Fixnum, 1).should == true
1265
+ expect(calculator.instance?(Fixnum, 1)).to eq(true)
1403
1266
  end
1404
1267
 
1405
1268
  it 'should consider integer in range' do
1406
1269
  range = range_t(0,10)
1407
- calculator.instance?(range, 1).should == true
1408
- calculator.instance?(range, 10).should == true
1409
- calculator.instance?(range, -1).should == false
1410
- calculator.instance?(range, 11).should == false
1270
+ expect(calculator.instance?(range, 1)).to eq(true)
1271
+ expect(calculator.instance?(range, 10)).to eq(true)
1272
+ expect(calculator.instance?(range, -1)).to eq(false)
1273
+ expect(calculator.instance?(range, 11)).to eq(false)
1411
1274
  end
1412
1275
 
1413
1276
  it 'should consider string in length range' do
1414
1277
  range = factory.constrain_size(string_t, 1,3)
1415
- calculator.instance?(range, 'a').should == true
1416
- calculator.instance?(range, 'abc').should == true
1417
- calculator.instance?(range, '').should == false
1418
- calculator.instance?(range, 'abcd').should == false
1419
- end
1420
-
1421
- it 'should consider string values' do
1422
- string = string_t('a', 'b')
1423
- expect(calculator.instance?(string, 'a')).to eq(true)
1424
- expect(calculator.instance?(string, 'b')).to eq(true)
1425
- expect(calculator.instance?(string, 'c')).to eq(false)
1278
+ expect(calculator.instance?(range, 'a')).to eq(true)
1279
+ expect(calculator.instance?(range, 'abc')).to eq(true)
1280
+ expect(calculator.instance?(range, '')).to eq(false)
1281
+ expect(calculator.instance?(range, 'abcd')).to eq(false)
1426
1282
  end
1427
1283
 
1428
1284
  it 'should consider array in length range' do
1429
1285
  range = factory.constrain_size(array_t(integer_t), 1,3)
1430
- calculator.instance?(range, [1]).should == true
1431
- calculator.instance?(range, [1,2,3]).should == true
1432
- calculator.instance?(range, []).should == false
1433
- calculator.instance?(range, [1,2,3,4]).should == false
1286
+ expect(calculator.instance?(range, [1])).to eq(true)
1287
+ expect(calculator.instance?(range, [1,2,3])).to eq(true)
1288
+ expect(calculator.instance?(range, [])).to eq(false)
1289
+ expect(calculator.instance?(range, [1,2,3,4])).to eq(false)
1434
1290
  end
1435
1291
 
1436
1292
  it 'should consider hash in length range' do
1437
1293
  range = factory.constrain_size(hash_t(integer_t, integer_t), 1,2)
1438
- calculator.instance?(range, {1=>1}).should == true
1439
- calculator.instance?(range, {1=>1, 2=>2}).should == true
1440
- calculator.instance?(range, {}).should == false
1441
- calculator.instance?(range, {1=>1, 2=>2, 3=>3}).should == false
1294
+ expect(calculator.instance?(range, {1=>1})).to eq(true)
1295
+ expect(calculator.instance?(range, {1=>1, 2=>2})).to eq(true)
1296
+ expect(calculator.instance?(range, {})).to eq(false)
1297
+ expect(calculator.instance?(range, {1=>1, 2=>2, 3=>3})).to eq(false)
1442
1298
  end
1443
1299
 
1444
1300
  it 'should consider collection in length range for array ' do
1445
1301
  range = factory.constrain_size(collection_t, 1,3)
1446
- calculator.instance?(range, [1]).should == true
1447
- calculator.instance?(range, [1,2,3]).should == true
1448
- calculator.instance?(range, []).should == false
1449
- calculator.instance?(range, [1,2,3,4]).should == false
1302
+ expect(calculator.instance?(range, [1])).to eq(true)
1303
+ expect(calculator.instance?(range, [1,2,3])).to eq(true)
1304
+ expect(calculator.instance?(range, [])).to eq(false)
1305
+ expect(calculator.instance?(range, [1,2,3,4])).to eq(false)
1450
1306
  end
1451
1307
 
1452
1308
  it 'should consider collection in length range for hash' do
1453
1309
  range = factory.constrain_size(collection_t, 1,2)
1454
- calculator.instance?(range, {1=>1}).should == true
1455
- calculator.instance?(range, {1=>1, 2=>2}).should == true
1456
- calculator.instance?(range, {}).should == false
1457
- calculator.instance?(range, {1=>1, 2=>2, 3=>3}).should == false
1310
+ expect(calculator.instance?(range, {1=>1})).to eq(true)
1311
+ expect(calculator.instance?(range, {1=>1, 2=>2})).to eq(true)
1312
+ expect(calculator.instance?(range, {})).to eq(false)
1313
+ expect(calculator.instance?(range, {1=>1, 2=>2, 3=>3})).to eq(false)
1458
1314
  end
1459
1315
 
1460
1316
  it 'should consider string matching enum as instanceof' do
1461
1317
  enum = enum_t('XS', 'S', 'M', 'L', 'XL', '0')
1462
- calculator.instance?(enum, 'XS').should == true
1463
- calculator.instance?(enum, 'S').should == true
1464
- calculator.instance?(enum, 'XXL').should == false
1465
- calculator.instance?(enum, '').should == false
1466
- calculator.instance?(enum, '0').should == true
1467
- calculator.instance?(enum, 0).should == false
1318
+ expect(calculator.instance?(enum, 'XS')).to eq(true)
1319
+ expect(calculator.instance?(enum, 'S')).to eq(true)
1320
+ expect(calculator.instance?(enum, 'XXL')).to eq(false)
1321
+ expect(calculator.instance?(enum, '')).to eq(false)
1322
+ expect(calculator.instance?(enum, '0')).to eq(true)
1323
+ expect(calculator.instance?(enum, 0)).to eq(false)
1468
1324
  end
1469
1325
 
1470
1326
  it 'should consider array[string] as instance of Array[Enum] when strings are instance of Enum' do
1471
1327
  enum = enum_t('XS', 'S', 'M', 'L', 'XL', '0')
1472
1328
  array = array_t(enum)
1473
- calculator.instance?(array, ['XS', 'S', 'XL']).should == true
1474
- calculator.instance?(array, ['XS', 'S', 'XXL']).should == false
1329
+ expect(calculator.instance?(array, ['XS', 'S', 'XL'])).to eq(true)
1330
+ expect(calculator.instance?(array, ['XS', 'S', 'XXL'])).to eq(false)
1475
1331
  end
1476
1332
 
1477
1333
  it 'should consider array[mixed] as instance of Variant[mixed] when mixed types are listed in Variant' do
1478
1334
  enum = enum_t('XS', 'S', 'M', 'L', 'XL')
1479
1335
  sizes = range_t(30, 50)
1480
1336
  array = array_t(variant_t(enum, sizes))
1481
- calculator.instance?(array, ['XS', 'S', 30, 50]).should == true
1482
- calculator.instance?(array, ['XS', 'S', 'XXL']).should == false
1483
- calculator.instance?(array, ['XS', 'S', 29]).should == false
1337
+ expect(calculator.instance?(array, ['XS', 'S', 30, 50])).to eq(true)
1338
+ expect(calculator.instance?(array, ['XS', 'S', 'XXL'])).to eq(false)
1339
+ expect(calculator.instance?(array, ['XS', 'S', 29])).to eq(false)
1484
1340
  end
1485
1341
 
1486
1342
  it 'should consider array[seq] as instance of Tuple[seq] when elements of seq are instance of' do
1487
1343
  tuple = tuple_t(Integer, String, Float)
1488
- calculator.instance?(tuple, [1, 'a', 3.14]).should == true
1489
- calculator.instance?(tuple, [1.2, 'a', 3.14]).should == false
1490
- calculator.instance?(tuple, [1, 1, 3.14]).should == false
1491
- calculator.instance?(tuple, [1, 'a', 1]).should == false
1344
+ expect(calculator.instance?(tuple, [1, 'a', 3.14])).to eq(true)
1345
+ expect(calculator.instance?(tuple, [1.2, 'a', 3.14])).to eq(false)
1346
+ expect(calculator.instance?(tuple, [1, 1, 3.14])).to eq(false)
1347
+ expect(calculator.instance?(tuple, [1, 'a', 1])).to eq(false)
1492
1348
  end
1493
1349
 
1494
1350
  context 'and t is Struct' do
1495
1351
  it 'should consider hash[cont] as instance of Struct[cont-t]' do
1496
1352
  struct = struct_t({'a'=>Integer, 'b'=>String, 'c'=>Float})
1497
- calculator.instance?(struct, {'a'=>1, 'b'=>'a', 'c'=>3.14}).should == true
1498
- calculator.instance?(struct, {'a'=>1.2, 'b'=>'a', 'c'=>3.14}).should == false
1499
- calculator.instance?(struct, {'a'=>1, 'b'=>1, 'c'=>3.14}).should == false
1500
- calculator.instance?(struct, {'a'=>1, 'b'=>'a', 'c'=>1}).should == false
1353
+ expect(calculator.instance?(struct, {'a'=>1, 'b'=>'a', 'c'=>3.14})).to eq(true)
1354
+ expect(calculator.instance?(struct, {'a'=>1.2, 'b'=>'a', 'c'=>3.14})).to eq(false)
1355
+ expect(calculator.instance?(struct, {'a'=>1, 'b'=>1, 'c'=>3.14})).to eq(false)
1356
+ expect(calculator.instance?(struct, {'a'=>1, 'b'=>'a', 'c'=>1})).to eq(false)
1501
1357
  end
1502
1358
 
1503
1359
  it 'should consider empty hash as instance of Struct[x=>Optional[String]]' do
1504
1360
  struct = struct_t({'a'=>optional_t(String)})
1505
- calculator.instance?(struct, {}).should == true
1361
+ expect(calculator.instance?(struct, {})).to eq(true)
1506
1362
  end
1507
1363
 
1508
1364
  it 'should consider hash[cont] as instance of Struct[cont-t,optionals]' do
1509
1365
  struct = struct_t({'a'=>Integer, 'b'=>String, 'c'=>optional_t(Float)})
1510
- calculator.instance?(struct, {'a'=>1, 'b'=>'a'}).should == true
1366
+ expect(calculator.instance?(struct, {'a'=>1, 'b'=>'a'})).to eq(true)
1511
1367
  end
1512
1368
 
1513
1369
  it 'should consider hash[cont] as instance of Struct[cont-t,variants with optionals]' do
1514
1370
  struct = struct_t({'a'=>Integer, 'b'=>String, 'c'=>variant_t(String, optional_t(Float))})
1515
- calculator.instance?(struct, {'a'=>1, 'b'=>'a'}).should == true
1371
+ expect(calculator.instance?(struct, {'a'=>1, 'b'=>'a'})).to eq(true)
1516
1372
  end
1517
1373
 
1518
1374
  it 'should not consider hash[cont,cont2] as instance of Struct[cont-t]' do
1519
1375
  struct = struct_t({'a'=>Integer, 'b'=>String})
1520
- calculator.instance?(struct, {'a'=>1, 'b'=>'a', 'c'=>'x'}).should == false
1376
+ expect(calculator.instance?(struct, {'a'=>1, 'b'=>'a', 'c'=>'x'})).to eq(false)
1521
1377
  end
1522
1378
 
1523
1379
  it 'should not consider hash[cont,cont2] as instance of Struct[cont-t,optional[cont3-t]' do
1524
1380
  struct = struct_t({'a'=>Integer, 'b'=>String, 'c'=>optional_t(Float)})
1525
- calculator.instance?(struct, {'a'=>1, 'b'=>'a', 'c'=>'x'}).should == false
1526
- end
1527
-
1528
- it 'should consider nil to be a valid element value' do
1529
- struct = struct_t({not_undef_t('a') => object_t, 'b'=>String})
1530
- expect(calculator.instance?(struct, {'a'=>nil , 'b'=>'a'})).to eq(true)
1531
- end
1532
-
1533
- it 'should consider nil to be a valid element value but subject to value type' do
1534
- struct = struct_t({not_undef_t('a') => String, 'b'=>String})
1535
- expect(calculator.instance?(struct, {'a'=>nil , 'b'=>'a'})).to eq(false)
1536
- end
1537
-
1538
- it 'should consider nil to be a valid element value but subject to value type even when key is optional' do
1539
- struct = struct_t({optional_t('a') => String, 'b'=>String})
1540
- expect(calculator.instance?(struct, {'a'=>nil , 'b'=>'a'})).to eq(false)
1541
- end
1542
-
1543
- it 'should consider a hash where optional key is missing as assignable even if value of optional key is required' do
1544
- struct = struct_t({optional_t('a') => String, 'b'=>String})
1545
- expect(calculator.instance?(struct, {'b'=>'a'})).to eq(true)
1381
+ expect(calculator.instance?(struct, {'a'=>1, 'b'=>'a', 'c'=>'x'})).to eq(false)
1546
1382
  end
1547
1383
  end
1548
1384
 
1549
1385
  context 'and t is Data' do
1550
1386
  it 'undef should be considered instance of Data' do
1551
- calculator.instance?(data_t, nil).should == true
1387
+ expect(calculator.instance?(data_t, nil)).to eq(true)
1552
1388
  end
1553
1389
 
1554
1390
  it 'other symbols should not be considered instance of Data' do
1555
- calculator.instance?(data_t, :love).should == false
1391
+ expect(calculator.instance?(data_t, :love)).to eq(false)
1556
1392
  end
1557
1393
 
1558
1394
  it 'an empty array should be considered instance of Data' do
1559
- calculator.instance?(data_t, []).should == true
1395
+ expect(calculator.instance?(data_t, [])).to eq(true)
1560
1396
  end
1561
1397
 
1562
1398
  it 'an empty hash should be considered instance of Data' do
1563
- calculator.instance?(data_t, {}).should == true
1399
+ expect(calculator.instance?(data_t, {})).to eq(true)
1564
1400
  end
1565
1401
 
1566
1402
  it 'a hash with nil/undef data should be considered instance of Data' do
1567
- calculator.instance?(data_t, {'a' => nil}).should == true
1403
+ expect(calculator.instance?(data_t, {'a' => nil})).to eq(true)
1568
1404
  end
1569
1405
 
1570
1406
  it 'a hash with nil/default key should not considered instance of Data' do
1571
- calculator.instance?(data_t, {nil => 10}).should == false
1572
- calculator.instance?(data_t, {:default => 10}).should == false
1407
+ expect(calculator.instance?(data_t, {nil => 10})).to eq(false)
1408
+ expect(calculator.instance?(data_t, {:default => 10})).to eq(false)
1573
1409
  end
1574
1410
 
1575
1411
  it 'an array with nil entries should be considered instance of Data' do
1576
- calculator.instance?(data_t, [nil]).should == true
1412
+ expect(calculator.instance?(data_t, [nil])).to eq(true)
1577
1413
  end
1578
1414
 
1579
1415
  it 'an array with nil + data entries should be considered instance of Data' do
1580
- calculator.instance?(data_t, [1, nil, 'a']).should == true
1416
+ expect(calculator.instance?(data_t, [1, nil, 'a'])).to eq(true)
1581
1417
  end
1582
1418
  end
1583
1419
 
@@ -1588,15 +1424,15 @@ describe 'The type calculator' do
1588
1424
  params = [factory.PARAM('a')]
1589
1425
  the_block = factory.LAMBDA(params,factory.literal(42))
1590
1426
  the_closure = Puppet::Pops::Evaluator::Closure.new(:fake_evaluator, the_block, :fake_scope)
1591
- expect(calculator.instance?(all_callables_t, the_closure)).to be_true
1592
- expect(calculator.instance?(callable_t(object_t), the_closure)).to be_true
1593
- expect(calculator.instance?(callable_t(object_t, object_t), the_closure)).to be_false
1427
+ expect(calculator.instance?(all_callables_t, the_closure)).to be_truthy
1428
+ expect(calculator.instance?(callable_t(object_t), the_closure)).to be_truthy
1429
+ expect(calculator.instance?(callable_t(object_t, object_t), the_closure)).to be_falsey
1594
1430
  end
1595
1431
 
1596
1432
  it 'a Function instance should be considered a Callable' do
1597
1433
  fc = Puppet::Functions.create_function(:foo) do
1598
1434
  dispatch :foo do
1599
- param 'String', 'a'
1435
+ param 'String', :a
1600
1436
  end
1601
1437
 
1602
1438
  def foo(a)
@@ -1605,9 +1441,9 @@ describe 'The type calculator' do
1605
1441
  end
1606
1442
  f = fc.new(:closure_scope, :loader)
1607
1443
  # Any callable
1608
- expect(calculator.instance?(all_callables_t, f)).to be_true
1444
+ expect(calculator.instance?(all_callables_t, f)).to be_truthy
1609
1445
  # Callable[String]
1610
- expect(calculator.instance?(callable_t(String), f)).to be_true
1446
+ expect(calculator.instance?(callable_t(String), f)).to be_truthy
1611
1447
  end
1612
1448
  end
1613
1449
  end
@@ -1615,148 +1451,148 @@ describe 'The type calculator' do
1615
1451
  context 'when converting a ruby class' do
1616
1452
  it 'should yield \'PIntegerType\' for Integer, Fixnum, and Bignum' do
1617
1453
  [Integer,Fixnum,Bignum].each do |c|
1618
- calculator.type(c).class.should == Puppet::Pops::Types::PIntegerType
1454
+ expect(calculator.type(c).class).to eq(Puppet::Pops::Types::PIntegerType)
1619
1455
  end
1620
1456
  end
1621
1457
 
1622
1458
  it 'should yield \'PFloatType\' for Float' do
1623
- calculator.type(Float).class.should == Puppet::Pops::Types::PFloatType
1459
+ expect(calculator.type(Float).class).to eq(Puppet::Pops::Types::PFloatType)
1624
1460
  end
1625
1461
 
1626
1462
  it 'should yield \'PBooleanType\' for FalseClass and TrueClass' do
1627
1463
  [FalseClass,TrueClass].each do |c|
1628
- calculator.type(c).class.should == Puppet::Pops::Types::PBooleanType
1464
+ expect(calculator.type(c).class).to eq(Puppet::Pops::Types::PBooleanType)
1629
1465
  end
1630
1466
  end
1631
1467
 
1632
1468
  it 'should yield \'PUndefType\' for NilClass' do
1633
- calculator.type(NilClass).class.should == Puppet::Pops::Types::PUndefType
1469
+ expect(calculator.type(NilClass).class).to eq(Puppet::Pops::Types::PUndefType)
1634
1470
  end
1635
1471
 
1636
1472
  it 'should yield \'PStringType\' for String' do
1637
- calculator.type(String).class.should == Puppet::Pops::Types::PStringType
1473
+ expect(calculator.type(String).class).to eq(Puppet::Pops::Types::PStringType)
1638
1474
  end
1639
1475
 
1640
1476
  it 'should yield \'PRegexpType\' for Regexp' do
1641
- calculator.type(Regexp).class.should == Puppet::Pops::Types::PRegexpType
1477
+ expect(calculator.type(Regexp).class).to eq(Puppet::Pops::Types::PRegexpType)
1642
1478
  end
1643
1479
 
1644
1480
  it 'should yield \'PArrayType[PDataType]\' for Array' do
1645
1481
  t = calculator.type(Array)
1646
- t.class.should == Puppet::Pops::Types::PArrayType
1647
- t.element_type.class.should == Puppet::Pops::Types::PDataType
1482
+ expect(t.class).to eq(Puppet::Pops::Types::PArrayType)
1483
+ expect(t.element_type.class).to eq(Puppet::Pops::Types::PDataType)
1648
1484
  end
1649
1485
 
1650
1486
  it 'should yield \'PHashType[PScalarType,PDataType]\' for Hash' do
1651
1487
  t = calculator.type(Hash)
1652
- t.class.should == Puppet::Pops::Types::PHashType
1653
- t.key_type.class.should == Puppet::Pops::Types::PScalarType
1654
- t.element_type.class.should == Puppet::Pops::Types::PDataType
1488
+ expect(t.class).to eq(Puppet::Pops::Types::PHashType)
1489
+ expect(t.key_type.class).to eq(Puppet::Pops::Types::PScalarType)
1490
+ expect(t.element_type.class).to eq(Puppet::Pops::Types::PDataType)
1655
1491
  end
1656
1492
  end
1657
1493
 
1658
1494
  context 'when representing the type as string' do
1659
1495
  it 'should yield \'Type\' for PType' do
1660
- calculator.string(Puppet::Pops::Types::PType.new()).should == 'Type'
1496
+ expect(calculator.string(Puppet::Pops::Types::PType.new())).to eq('Type')
1661
1497
  end
1662
1498
 
1663
1499
  it 'should yield \'Object\' for PAnyType' do
1664
- calculator.string(Puppet::Pops::Types::PAnyType.new()).should == 'Any'
1500
+ expect(calculator.string(Puppet::Pops::Types::PAnyType.new())).to eq('Any')
1665
1501
  end
1666
1502
 
1667
1503
  it 'should yield \'Scalar\' for PScalarType' do
1668
- calculator.string(Puppet::Pops::Types::PScalarType.new()).should == 'Scalar'
1504
+ expect(calculator.string(Puppet::Pops::Types::PScalarType.new())).to eq('Scalar')
1669
1505
  end
1670
1506
 
1671
1507
  it 'should yield \'Boolean\' for PBooleanType' do
1672
- calculator.string(Puppet::Pops::Types::PBooleanType.new()).should == 'Boolean'
1508
+ expect(calculator.string(Puppet::Pops::Types::PBooleanType.new())).to eq('Boolean')
1673
1509
  end
1674
1510
 
1675
1511
  it 'should yield \'Data\' for PDataType' do
1676
- calculator.string(Puppet::Pops::Types::PDataType.new()).should == 'Data'
1512
+ expect(calculator.string(Puppet::Pops::Types::PDataType.new())).to eq('Data')
1677
1513
  end
1678
1514
 
1679
1515
  it 'should yield \'Numeric\' for PNumericType' do
1680
- calculator.string(Puppet::Pops::Types::PNumericType.new()).should == 'Numeric'
1516
+ expect(calculator.string(Puppet::Pops::Types::PNumericType.new())).to eq('Numeric')
1681
1517
  end
1682
1518
 
1683
1519
  it 'should yield \'Integer\' and from/to for PIntegerType' do
1684
1520
  int_T = Puppet::Pops::Types::PIntegerType
1685
- calculator.string(int_T.new()).should == 'Integer'
1521
+ expect(calculator.string(int_T.new())).to eq('Integer')
1686
1522
  int = int_T.new()
1687
1523
  int.from = 1
1688
1524
  int.to = 1
1689
- calculator.string(int).should == 'Integer[1, 1]'
1525
+ expect(calculator.string(int)).to eq('Integer[1, 1]')
1690
1526
  int = int_T.new()
1691
1527
  int.from = 1
1692
1528
  int.to = 2
1693
- calculator.string(int).should == 'Integer[1, 2]'
1529
+ expect(calculator.string(int)).to eq('Integer[1, 2]')
1694
1530
  int = int_T.new()
1695
1531
  int.from = nil
1696
1532
  int.to = 2
1697
- calculator.string(int).should == 'Integer[default, 2]'
1533
+ expect(calculator.string(int)).to eq('Integer[default, 2]')
1698
1534
  int = int_T.new()
1699
1535
  int.from = 2
1700
1536
  int.to = nil
1701
- calculator.string(int).should == 'Integer[2, default]'
1537
+ expect(calculator.string(int)).to eq('Integer[2, default]')
1702
1538
  end
1703
1539
 
1704
1540
  it 'should yield \'Float\' for PFloatType' do
1705
- calculator.string(Puppet::Pops::Types::PFloatType.new()).should == 'Float'
1541
+ expect(calculator.string(Puppet::Pops::Types::PFloatType.new())).to eq('Float')
1706
1542
  end
1707
1543
 
1708
1544
  it 'should yield \'Regexp\' for PRegexpType' do
1709
- calculator.string(Puppet::Pops::Types::PRegexpType.new()).should == 'Regexp'
1545
+ expect(calculator.string(Puppet::Pops::Types::PRegexpType.new())).to eq('Regexp')
1710
1546
  end
1711
1547
 
1712
1548
  it 'should yield \'Regexp[/pat/]\' for parameterized PRegexpType' do
1713
1549
  t = Puppet::Pops::Types::PRegexpType.new()
1714
1550
  t.pattern = ('a/b')
1715
- calculator.string(Puppet::Pops::Types::PRegexpType.new()).should == 'Regexp'
1551
+ expect(calculator.string(Puppet::Pops::Types::PRegexpType.new())).to eq('Regexp')
1716
1552
  end
1717
1553
 
1718
1554
  it 'should yield \'String\' for PStringType' do
1719
- calculator.string(Puppet::Pops::Types::PStringType.new()).should == 'String'
1555
+ expect(calculator.string(Puppet::Pops::Types::PStringType.new())).to eq('String')
1720
1556
  end
1721
1557
 
1722
1558
  it 'should yield \'String\' for PStringType with multiple values' do
1723
- calculator.string(string_t('a', 'b', 'c')).should == 'String'
1559
+ expect(calculator.string(string_t('a', 'b', 'c'))).to eq('String')
1724
1560
  end
1725
1561
 
1726
1562
  it 'should yield \'String\' and from/to for PStringType' do
1727
1563
  string_T = Puppet::Pops::Types::PStringType
1728
- calculator.string(factory.constrain_size(string_T.new(), 1,1)).should == 'String[1, 1]'
1729
- calculator.string(factory.constrain_size(string_T.new(), 1,2)).should == 'String[1, 2]'
1730
- calculator.string(factory.constrain_size(string_T.new(), :default, 2)).should == 'String[default, 2]'
1731
- calculator.string(factory.constrain_size(string_T.new(), 2, :default)).should == 'String[2, default]'
1564
+ expect(calculator.string(factory.constrain_size(string_T.new(), 1,1))).to eq('String[1, 1]')
1565
+ expect(calculator.string(factory.constrain_size(string_T.new(), 1,2))).to eq('String[1, 2]')
1566
+ expect(calculator.string(factory.constrain_size(string_T.new(), :default, 2))).to eq('String[default, 2]')
1567
+ expect(calculator.string(factory.constrain_size(string_T.new(), 2, :default))).to eq('String[2, default]')
1732
1568
  end
1733
1569
 
1734
1570
  it 'should yield \'Array[Integer]\' for PArrayType[PIntegerType]' do
1735
1571
  t = Puppet::Pops::Types::PArrayType.new()
1736
1572
  t.element_type = Puppet::Pops::Types::PIntegerType.new()
1737
- calculator.string(t).should == 'Array[Integer]'
1573
+ expect(calculator.string(t)).to eq('Array[Integer]')
1738
1574
  end
1739
1575
 
1740
1576
  it 'should yield \'Collection\' and from/to for PCollectionType' do
1741
1577
  col = collection_t()
1742
- calculator.string(factory.constrain_size(col.copy, 1,1)).should == 'Collection[1, 1]'
1743
- calculator.string(factory.constrain_size(col.copy, 1,2)).should == 'Collection[1, 2]'
1744
- calculator.string(factory.constrain_size(col.copy, :default, 2)).should == 'Collection[default, 2]'
1745
- calculator.string(factory.constrain_size(col.copy, 2, :default)).should == 'Collection[2, default]'
1578
+ expect(calculator.string(factory.constrain_size(col.copy, 1,1))).to eq('Collection[1, 1]')
1579
+ expect(calculator.string(factory.constrain_size(col.copy, 1,2))).to eq('Collection[1, 2]')
1580
+ expect(calculator.string(factory.constrain_size(col.copy, :default, 2))).to eq('Collection[default, 2]')
1581
+ expect(calculator.string(factory.constrain_size(col.copy, 2, :default))).to eq('Collection[2, default]')
1746
1582
  end
1747
1583
 
1748
1584
  it 'should yield \'Array\' and from/to for PArrayType' do
1749
1585
  arr = array_t(string_t)
1750
- calculator.string(factory.constrain_size(arr.copy, 1,1)).should == 'Array[String, 1, 1]'
1751
- calculator.string(factory.constrain_size(arr.copy, 1,2)).should == 'Array[String, 1, 2]'
1752
- calculator.string(factory.constrain_size(arr.copy, :default, 2)).should == 'Array[String, default, 2]'
1753
- calculator.string(factory.constrain_size(arr.copy, 2, :default)).should == 'Array[String, 2, default]'
1586
+ expect(calculator.string(factory.constrain_size(arr.copy, 1,1))).to eq('Array[String, 1, 1]')
1587
+ expect(calculator.string(factory.constrain_size(arr.copy, 1,2))).to eq('Array[String, 1, 2]')
1588
+ expect(calculator.string(factory.constrain_size(arr.copy, :default, 2))).to eq('Array[String, default, 2]')
1589
+ expect(calculator.string(factory.constrain_size(arr.copy, 2, :default))).to eq('Array[String, 2, default]')
1754
1590
  end
1755
1591
 
1756
1592
  it 'should yield \'Tuple[Integer]\' for PTupleType[PIntegerType]' do
1757
1593
  t = Puppet::Pops::Types::PTupleType.new()
1758
1594
  t.addTypes(Puppet::Pops::Types::PIntegerType.new())
1759
- calculator.string(t).should == 'Tuple[Integer]'
1595
+ expect(calculator.string(t)).to eq('Tuple[Integer]')
1760
1596
  end
1761
1597
 
1762
1598
  it 'should yield \'Tuple[T, T,..]\' for PTupleType[T, T, ...]' do
@@ -1764,85 +1600,83 @@ describe 'The type calculator' do
1764
1600
  t.addTypes(Puppet::Pops::Types::PIntegerType.new())
1765
1601
  t.addTypes(Puppet::Pops::Types::PIntegerType.new())
1766
1602
  t.addTypes(Puppet::Pops::Types::PStringType.new())
1767
- calculator.string(t).should == 'Tuple[Integer, Integer, String]'
1603
+ expect(calculator.string(t)).to eq('Tuple[Integer, Integer, String]')
1768
1604
  end
1769
1605
 
1770
1606
  it 'should yield \'Tuple\' and from/to for PTupleType' do
1771
1607
  tuple_t = tuple_t(string_t)
1772
- calculator.string(factory.constrain_size(tuple_t.copy, 1,1)).should == 'Tuple[String, 1, 1]'
1773
- calculator.string(factory.constrain_size(tuple_t.copy, 1,2)).should == 'Tuple[String, 1, 2]'
1774
- calculator.string(factory.constrain_size(tuple_t.copy, :default, 2)).should == 'Tuple[String, default, 2]'
1775
- calculator.string(factory.constrain_size(tuple_t.copy, 2, :default)).should == 'Tuple[String, 2, default]'
1608
+ expect(calculator.string(factory.constrain_size(tuple_t.copy, 1,1))).to eq('Tuple[String, 1, 1]')
1609
+ expect(calculator.string(factory.constrain_size(tuple_t.copy, 1,2))).to eq('Tuple[String, 1, 2]')
1610
+ expect(calculator.string(factory.constrain_size(tuple_t.copy, :default, 2))).to eq('Tuple[String, default, 2]')
1611
+ expect(calculator.string(factory.constrain_size(tuple_t.copy, 2, :default))).to eq('Tuple[String, 2, default]')
1776
1612
  end
1777
1613
 
1778
1614
  it 'should yield \'Struct\' and details for PStructType' do
1779
1615
  struct_t = struct_t({'a'=>Integer, 'b'=>String})
1780
- s = calculator.string(struct_t)
1781
- # Ruby 1.8.7 - noone likes you...
1782
- (s == "Struct[{'a'=>Integer, 'b'=>String}]" || s == "Struct[{'b'=>String, 'a'=>Integer}]").should == true
1616
+ expect(calculator.string(struct_t)).to eq("Struct[{'a'=>Integer, 'b'=>String}]")
1783
1617
  struct_t = struct_t({})
1784
- calculator.string(struct_t).should == "Struct"
1618
+ expect(calculator.string(struct_t)).to eq("Struct")
1785
1619
  end
1786
1620
 
1787
1621
  it 'should yield \'Hash[String, Integer]\' for PHashType[PStringType, PIntegerType]' do
1788
1622
  t = Puppet::Pops::Types::PHashType.new()
1789
1623
  t.key_type = Puppet::Pops::Types::PStringType.new()
1790
1624
  t.element_type = Puppet::Pops::Types::PIntegerType.new()
1791
- calculator.string(t).should == 'Hash[String, Integer]'
1625
+ expect(calculator.string(t)).to eq('Hash[String, Integer]')
1792
1626
  end
1793
1627
 
1794
1628
  it 'should yield \'Hash\' and from/to for PHashType' do
1795
1629
  hsh = hash_t(string_t, string_t)
1796
- calculator.string(factory.constrain_size(hsh.copy, 1,1)).should == 'Hash[String, String, 1, 1]'
1797
- calculator.string(factory.constrain_size(hsh.copy, 1,2)).should == 'Hash[String, String, 1, 2]'
1798
- calculator.string(factory.constrain_size(hsh.copy, :default, 2)).should == 'Hash[String, String, default, 2]'
1799
- calculator.string(factory.constrain_size(hsh.copy, 2, :default)).should == 'Hash[String, String, 2, default]'
1630
+ expect(calculator.string(factory.constrain_size(hsh.copy, 1,1))).to eq('Hash[String, String, 1, 1]')
1631
+ expect(calculator.string(factory.constrain_size(hsh.copy, 1,2))).to eq('Hash[String, String, 1, 2]')
1632
+ expect(calculator.string(factory.constrain_size(hsh.copy, :default, 2))).to eq('Hash[String, String, default, 2]')
1633
+ expect(calculator.string(factory.constrain_size(hsh.copy, 2, :default))).to eq('Hash[String, String, 2, default]')
1800
1634
  end
1801
1635
 
1802
1636
  it "should yield 'Class' for a PHostClassType" do
1803
1637
  t = Puppet::Pops::Types::PHostClassType.new()
1804
- calculator.string(t).should == 'Class'
1638
+ expect(calculator.string(t)).to eq('Class')
1805
1639
  end
1806
1640
 
1807
1641
  it "should yield 'Class[x]' for a PHostClassType[x]" do
1808
1642
  t = Puppet::Pops::Types::PHostClassType.new()
1809
1643
  t.class_name = 'x'
1810
- calculator.string(t).should == 'Class[x]'
1644
+ expect(calculator.string(t)).to eq('Class[x]')
1811
1645
  end
1812
1646
 
1813
1647
  it "should yield 'Resource' for a PResourceType" do
1814
1648
  t = Puppet::Pops::Types::PResourceType.new()
1815
- calculator.string(t).should == 'Resource'
1649
+ expect(calculator.string(t)).to eq('Resource')
1816
1650
  end
1817
1651
 
1818
1652
  it 'should yield \'File\' for a PResourceType[\'File\']' do
1819
1653
  t = Puppet::Pops::Types::PResourceType.new()
1820
1654
  t.type_name = 'File'
1821
- calculator.string(t).should == 'File'
1655
+ expect(calculator.string(t)).to eq('File')
1822
1656
  end
1823
1657
 
1824
1658
  it "should yield 'File['/tmp/foo']' for a PResourceType['File', '/tmp/foo']" do
1825
1659
  t = Puppet::Pops::Types::PResourceType.new()
1826
1660
  t.type_name = 'File'
1827
1661
  t.title = '/tmp/foo'
1828
- calculator.string(t).should == "File['/tmp/foo']"
1662
+ expect(calculator.string(t)).to eq("File['/tmp/foo']")
1829
1663
  end
1830
1664
 
1831
1665
  it "should yield 'Enum[s,...]' for a PEnumType[s,...]" do
1832
1666
  t = enum_t('a', 'b', 'c')
1833
- calculator.string(t).should == "Enum['a', 'b', 'c']"
1667
+ expect(calculator.string(t)).to eq("Enum['a', 'b', 'c']")
1834
1668
  end
1835
1669
 
1836
1670
  it "should yield 'Pattern[/pat/,...]' for a PPatternType['pat',...]" do
1837
1671
  t = pattern_t('a')
1838
1672
  t2 = pattern_t('a', 'b', 'c')
1839
- calculator.string(t).should == "Pattern[/a/]"
1840
- calculator.string(t2).should == "Pattern[/a/, /b/, /c/]"
1673
+ expect(calculator.string(t)).to eq("Pattern[/a/]")
1674
+ expect(calculator.string(t2)).to eq("Pattern[/a/, /b/, /c/]")
1841
1675
  end
1842
1676
 
1843
1677
  it "should escape special characters in the string for a PPatternType['pat',...]" do
1844
1678
  t = pattern_t('a/b')
1845
- calculator.string(t).should == "Pattern[/a\\/b/]"
1679
+ expect(calculator.string(t)).to eq("Pattern[/a\\/b/]")
1846
1680
  end
1847
1681
 
1848
1682
  it "should yield 'Variant[t1,t2,...]' for a PVariantType[t1, t2,...]" do
@@ -1850,7 +1684,7 @@ describe 'The type calculator' do
1850
1684
  t2 = integer_t()
1851
1685
  t3 = pattern_t('a')
1852
1686
  t = variant_t(t1, t2, t3)
1853
- calculator.string(t).should == "Variant[String, Integer, Pattern[/a/]]"
1687
+ expect(calculator.string(t)).to eq("Variant[String, Integer, Pattern[/a/]]")
1854
1688
  end
1855
1689
 
1856
1690
  it "should yield 'Callable' for generic callable" do
@@ -1888,102 +1722,87 @@ describe 'The type calculator' do
1888
1722
  it "should yield Unit for a Unit type" do
1889
1723
  expect(calculator.string(unit_t)).to eql('Unit')
1890
1724
  end
1891
-
1892
- it "should yield 'NotUndef' for a PNotUndefType" do
1893
- t = not_undef_t
1894
- expect(calculator.string(t)).to eq('NotUndef')
1895
- end
1896
-
1897
- it "should yield 'NotUndef[T]' for a PNotUndefType[T]" do
1898
- t = not_undef_t(data_t)
1899
- expect(calculator.string(t)).to eq('NotUndef[Data]')
1900
- end
1901
-
1902
- it "should yield 'NotUndef['string']' for a PNotUndefType['string']" do
1903
- t = not_undef_t('hey')
1904
- expect(calculator.string(t)).to eq("NotUndef['hey']")
1905
- end
1906
1725
  end
1907
1726
 
1908
1727
  context 'when processing meta type' do
1909
1728
  it 'should infer PType as the type of all other types' do
1910
1729
  ptype = Puppet::Pops::Types::PType
1911
- calculator.infer(Puppet::Pops::Types::PUndefType.new() ).is_a?(ptype).should() == true
1912
- calculator.infer(Puppet::Pops::Types::PDataType.new() ).is_a?(ptype).should() == true
1913
- calculator.infer(Puppet::Pops::Types::PScalarType.new() ).is_a?(ptype).should() == true
1914
- calculator.infer(Puppet::Pops::Types::PStringType.new() ).is_a?(ptype).should() == true
1915
- calculator.infer(Puppet::Pops::Types::PNumericType.new() ).is_a?(ptype).should() == true
1916
- calculator.infer(Puppet::Pops::Types::PIntegerType.new() ).is_a?(ptype).should() == true
1917
- calculator.infer(Puppet::Pops::Types::PFloatType.new() ).is_a?(ptype).should() == true
1918
- calculator.infer(Puppet::Pops::Types::PRegexpType.new() ).is_a?(ptype).should() == true
1919
- calculator.infer(Puppet::Pops::Types::PBooleanType.new() ).is_a?(ptype).should() == true
1920
- calculator.infer(Puppet::Pops::Types::PCollectionType.new()).is_a?(ptype).should() == true
1921
- calculator.infer(Puppet::Pops::Types::PArrayType.new() ).is_a?(ptype).should() == true
1922
- calculator.infer(Puppet::Pops::Types::PHashType.new() ).is_a?(ptype).should() == true
1923
- calculator.infer(Puppet::Pops::Types::PRuntimeType.new() ).is_a?(ptype).should() == true
1924
- calculator.infer(Puppet::Pops::Types::PHostClassType.new() ).is_a?(ptype).should() == true
1925
- calculator.infer(Puppet::Pops::Types::PResourceType.new() ).is_a?(ptype).should() == true
1926
- calculator.infer(Puppet::Pops::Types::PEnumType.new() ).is_a?(ptype).should() == true
1927
- calculator.infer(Puppet::Pops::Types::PPatternType.new() ).is_a?(ptype).should() == true
1928
- calculator.infer(Puppet::Pops::Types::PVariantType.new() ).is_a?(ptype).should() == true
1929
- calculator.infer(Puppet::Pops::Types::PTupleType.new() ).is_a?(ptype).should() == true
1930
- calculator.infer(Puppet::Pops::Types::POptionalType.new() ).is_a?(ptype).should() == true
1931
- calculator.infer(Puppet::Pops::Types::PCallableType.new() ).is_a?(ptype).should() == true
1730
+ expect(calculator.infer(Puppet::Pops::Types::PUndefType.new() ).is_a?(ptype)).to eq(true)
1731
+ expect(calculator.infer(Puppet::Pops::Types::PDataType.new() ).is_a?(ptype)).to eq(true)
1732
+ expect(calculator.infer(Puppet::Pops::Types::PScalarType.new() ).is_a?(ptype)).to eq(true)
1733
+ expect(calculator.infer(Puppet::Pops::Types::PStringType.new() ).is_a?(ptype)).to eq(true)
1734
+ expect(calculator.infer(Puppet::Pops::Types::PNumericType.new() ).is_a?(ptype)).to eq(true)
1735
+ expect(calculator.infer(Puppet::Pops::Types::PIntegerType.new() ).is_a?(ptype)).to eq(true)
1736
+ expect(calculator.infer(Puppet::Pops::Types::PFloatType.new() ).is_a?(ptype)).to eq(true)
1737
+ expect(calculator.infer(Puppet::Pops::Types::PRegexpType.new() ).is_a?(ptype)).to eq(true)
1738
+ expect(calculator.infer(Puppet::Pops::Types::PBooleanType.new() ).is_a?(ptype)).to eq(true)
1739
+ expect(calculator.infer(Puppet::Pops::Types::PCollectionType.new()).is_a?(ptype)).to eq(true)
1740
+ expect(calculator.infer(Puppet::Pops::Types::PArrayType.new() ).is_a?(ptype)).to eq(true)
1741
+ expect(calculator.infer(Puppet::Pops::Types::PHashType.new() ).is_a?(ptype)).to eq(true)
1742
+ expect(calculator.infer(Puppet::Pops::Types::PRuntimeType.new() ).is_a?(ptype)).to eq(true)
1743
+ expect(calculator.infer(Puppet::Pops::Types::PHostClassType.new() ).is_a?(ptype)).to eq(true)
1744
+ expect(calculator.infer(Puppet::Pops::Types::PResourceType.new() ).is_a?(ptype)).to eq(true)
1745
+ expect(calculator.infer(Puppet::Pops::Types::PEnumType.new() ).is_a?(ptype)).to eq(true)
1746
+ expect(calculator.infer(Puppet::Pops::Types::PPatternType.new() ).is_a?(ptype)).to eq(true)
1747
+ expect(calculator.infer(Puppet::Pops::Types::PVariantType.new() ).is_a?(ptype)).to eq(true)
1748
+ expect(calculator.infer(Puppet::Pops::Types::PTupleType.new() ).is_a?(ptype)).to eq(true)
1749
+ expect(calculator.infer(Puppet::Pops::Types::POptionalType.new() ).is_a?(ptype)).to eq(true)
1750
+ expect(calculator.infer(Puppet::Pops::Types::PCallableType.new() ).is_a?(ptype)).to eq(true)
1932
1751
  end
1933
1752
 
1934
1753
  it 'should infer PType as the type of all other types' do
1935
1754
  ptype = Puppet::Pops::Types::PType
1936
- calculator.string(calculator.infer(Puppet::Pops::Types::PUndefType.new() )).should == "Type[Undef]"
1937
- calculator.string(calculator.infer(Puppet::Pops::Types::PDataType.new() )).should == "Type[Data]"
1938
- calculator.string(calculator.infer(Puppet::Pops::Types::PScalarType.new() )).should == "Type[Scalar]"
1939
- calculator.string(calculator.infer(Puppet::Pops::Types::PStringType.new() )).should == "Type[String]"
1940
- calculator.string(calculator.infer(Puppet::Pops::Types::PNumericType.new() )).should == "Type[Numeric]"
1941
- calculator.string(calculator.infer(Puppet::Pops::Types::PIntegerType.new() )).should == "Type[Integer]"
1942
- calculator.string(calculator.infer(Puppet::Pops::Types::PFloatType.new() )).should == "Type[Float]"
1943
- calculator.string(calculator.infer(Puppet::Pops::Types::PRegexpType.new() )).should == "Type[Regexp]"
1944
- calculator.string(calculator.infer(Puppet::Pops::Types::PBooleanType.new() )).should == "Type[Boolean]"
1945
- calculator.string(calculator.infer(Puppet::Pops::Types::PCollectionType.new())).should == "Type[Collection]"
1946
- calculator.string(calculator.infer(Puppet::Pops::Types::PArrayType.new() )).should == "Type[Array[?]]"
1947
- calculator.string(calculator.infer(Puppet::Pops::Types::PHashType.new() )).should == "Type[Hash[?, ?]]"
1948
- calculator.string(calculator.infer(Puppet::Pops::Types::PRuntimeType.new() )).should == "Type[Runtime[?, ?]]"
1949
- calculator.string(calculator.infer(Puppet::Pops::Types::PHostClassType.new() )).should == "Type[Class]"
1950
- calculator.string(calculator.infer(Puppet::Pops::Types::PResourceType.new() )).should == "Type[Resource]"
1951
- calculator.string(calculator.infer(Puppet::Pops::Types::PEnumType.new() )).should == "Type[Enum]"
1952
- calculator.string(calculator.infer(Puppet::Pops::Types::PVariantType.new() )).should == "Type[Variant]"
1953
- calculator.string(calculator.infer(Puppet::Pops::Types::PPatternType.new() )).should == "Type[Pattern]"
1954
- calculator.string(calculator.infer(Puppet::Pops::Types::PTupleType.new() )).should == "Type[Tuple]"
1955
- calculator.string(calculator.infer(Puppet::Pops::Types::POptionalType.new() )).should == "Type[Optional]"
1956
- calculator.string(calculator.infer(Puppet::Pops::Types::PCallableType.new() )).should == "Type[Callable]"
1957
-
1958
- calculator.infer(Puppet::Pops::Types::PResourceType.new(:type_name => 'foo::fee::fum')).to_s.should == "Type[Foo::Fee::Fum]"
1959
- calculator.string(calculator.infer(Puppet::Pops::Types::PResourceType.new(:type_name => 'foo::fee::fum'))).should == "Type[Foo::Fee::Fum]"
1960
- calculator.infer(Puppet::Pops::Types::PResourceType.new(:type_name => 'Foo::Fee::Fum')).to_s.should == "Type[Foo::Fee::Fum]"
1755
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PUndefType.new() ))).to eq("Type[Undef]")
1756
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PDataType.new() ))).to eq("Type[Data]")
1757
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PScalarType.new() ))).to eq("Type[Scalar]")
1758
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PStringType.new() ))).to eq("Type[String]")
1759
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PNumericType.new() ))).to eq("Type[Numeric]")
1760
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PIntegerType.new() ))).to eq("Type[Integer]")
1761
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PFloatType.new() ))).to eq("Type[Float]")
1762
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PRegexpType.new() ))).to eq("Type[Regexp]")
1763
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PBooleanType.new() ))).to eq("Type[Boolean]")
1764
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PCollectionType.new()))).to eq("Type[Collection]")
1765
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PArrayType.new() ))).to eq("Type[Array[?]]")
1766
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PHashType.new() ))).to eq("Type[Hash[?, ?]]")
1767
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PRuntimeType.new() ))).to eq("Type[Runtime[?, ?]]")
1768
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PHostClassType.new() ))).to eq("Type[Class]")
1769
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PResourceType.new() ))).to eq("Type[Resource]")
1770
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PEnumType.new() ))).to eq("Type[Enum]")
1771
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PVariantType.new() ))).to eq("Type[Variant]")
1772
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PPatternType.new() ))).to eq("Type[Pattern]")
1773
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PTupleType.new() ))).to eq("Type[Tuple]")
1774
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::POptionalType.new() ))).to eq("Type[Optional]")
1775
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PCallableType.new() ))).to eq("Type[Callable]")
1776
+
1777
+ expect(calculator.infer(Puppet::Pops::Types::PResourceType.new(:type_name => 'foo::fee::fum')).to_s).to eq("Type[Foo::Fee::Fum]")
1778
+ expect(calculator.string(calculator.infer(Puppet::Pops::Types::PResourceType.new(:type_name => 'foo::fee::fum')))).to eq("Type[Foo::Fee::Fum]")
1779
+ expect(calculator.infer(Puppet::Pops::Types::PResourceType.new(:type_name => 'Foo::Fee::Fum')).to_s).to eq("Type[Foo::Fee::Fum]")
1961
1780
  end
1962
1781
 
1963
1782
  it "computes the common type of PType's type parameter" do
1964
1783
  int_t = Puppet::Pops::Types::PIntegerType.new()
1965
1784
  string_t = Puppet::Pops::Types::PStringType.new()
1966
- calculator.string(calculator.infer([int_t])).should == "Array[Type[Integer], 1, 1]"
1967
- calculator.string(calculator.infer([int_t, string_t])).should == "Array[Type[Scalar], 2, 2]"
1785
+ expect(calculator.string(calculator.infer([int_t]))).to eq("Array[Type[Integer], 1, 1]")
1786
+ expect(calculator.string(calculator.infer([int_t, string_t]))).to eq("Array[Type[Scalar], 2, 2]")
1968
1787
  end
1969
1788
 
1970
1789
  it 'should infer PType as the type of ruby classes' do
1971
1790
  class Foo
1972
1791
  end
1973
1792
  [Object, Numeric, Integer, Fixnum, Bignum, Float, String, Regexp, Array, Hash, Foo].each do |c|
1974
- calculator.infer(c).is_a?(Puppet::Pops::Types::PType).should() == true
1793
+ expect(calculator.infer(c).is_a?(Puppet::Pops::Types::PType)).to eq(true)
1975
1794
  end
1976
1795
  end
1977
1796
 
1978
1797
  it 'should infer PType as the type of PType (meta regression short-circuit)' do
1979
- calculator.infer(Puppet::Pops::Types::PType.new()).is_a?(Puppet::Pops::Types::PType).should() == true
1798
+ expect(calculator.infer(Puppet::Pops::Types::PType.new()).is_a?(Puppet::Pops::Types::PType)).to eq(true)
1980
1799
  end
1981
1800
 
1982
1801
  it 'computes instance? to be true if parameterized and type match' do
1983
1802
  int_t = Puppet::Pops::Types::PIntegerType.new()
1984
1803
  type_t = Puppet::Pops::Types::TypeFactory.type_type(int_t)
1985
1804
  type_type_t = Puppet::Pops::Types::TypeFactory.type_type(type_t)
1986
- calculator.instance?(type_type_t, type_t).should == true
1805
+ expect(calculator.instance?(type_type_t, type_t)).to eq(true)
1987
1806
  end
1988
1807
 
1989
1808
  it 'computes instance? to be false if parameterized and type do not match' do
@@ -1993,13 +1812,13 @@ describe 'The type calculator' do
1993
1812
  type_t2 = Puppet::Pops::Types::TypeFactory.type_type(string_t)
1994
1813
  type_type_t = Puppet::Pops::Types::TypeFactory.type_type(type_t)
1995
1814
  # i.e. Type[Integer] =~ Type[Type[Integer]] # false
1996
- calculator.instance?(type_type_t, type_t2).should == false
1815
+ expect(calculator.instance?(type_type_t, type_t2)).to eq(false)
1997
1816
  end
1998
1817
 
1999
1818
  it 'computes instance? to be true if unparameterized and matched against a type[?]' do
2000
1819
  int_t = Puppet::Pops::Types::PIntegerType.new()
2001
1820
  type_t = Puppet::Pops::Types::TypeFactory.type_type(int_t)
2002
- calculator.instance?(Puppet::Pops::Types::PType.new, type_t).should == true
1821
+ expect(calculator.instance?(Puppet::Pops::Types::PType.new, type_t)).to eq(true)
2003
1822
  end
2004
1823
  end
2005
1824
 
@@ -2008,89 +1827,75 @@ describe 'The type calculator' do
2008
1827
  t = Puppet::Pops::Types::PIntegerType.new()
2009
1828
  t.from = 1
2010
1829
  t.to = 10
2011
- calculator.enumerable(t).respond_to?(:each).should == true
1830
+ expect(calculator.enumerable(t).respond_to?(:each)).to eq(true)
2012
1831
  end
2013
1832
 
2014
1833
  it "should not produce an enumerable for an Integer range that has an infinite side" do
2015
1834
  t = Puppet::Pops::Types::PIntegerType.new()
2016
1835
  t.from = nil
2017
1836
  t.to = 10
2018
- calculator.enumerable(t).should == nil
1837
+ expect(calculator.enumerable(t)).to eq(nil)
2019
1838
 
2020
1839
  t = Puppet::Pops::Types::PIntegerType.new()
2021
1840
  t.from = 1
2022
1841
  t.to = nil
2023
- calculator.enumerable(t).should == nil
1842
+ expect(calculator.enumerable(t)).to eq(nil)
2024
1843
  end
2025
1844
 
2026
1845
  it "all but Integer range are not enumerable" do
2027
1846
  [Object, Numeric, Float, String, Regexp, Array, Hash].each do |t|
2028
- calculator.enumerable(calculator.type(t)).should == nil
1847
+ expect(calculator.enumerable(calculator.type(t))).to eq(nil)
2029
1848
  end
2030
1849
  end
2031
1850
  end
2032
1851
 
2033
1852
  context "when dealing with different types of inference" do
2034
1853
  it "an instance specific inference is produced by infer" do
2035
- calculator.infer(['a','b']).element_type.values.should == ['a', 'b']
1854
+ expect(calculator.infer(['a','b']).element_type.values).to eq(['a', 'b'])
2036
1855
  end
2037
1856
 
2038
1857
  it "a generic inference is produced using infer_generic" do
2039
- calculator.infer_generic(['a','b']).element_type.values.should == []
1858
+ expect(calculator.infer_generic(['a','b']).element_type.values).to eq([])
2040
1859
  end
2041
1860
 
2042
1861
  it "a generic result is created by generalize! given an instance specific result for an Array" do
2043
1862
  generic = calculator.infer(['a','b'])
2044
- generic.element_type.values.should == ['a', 'b']
1863
+ expect(generic.element_type.values).to eq(['a', 'b'])
2045
1864
  calculator.generalize!(generic)
2046
- generic.element_type.values.should == []
1865
+ expect(generic.element_type.values).to eq([])
2047
1866
  end
2048
1867
 
2049
- it 'a generic result is created by generalize! given an instance specific result for a Hash' do
1868
+ it "a generic result is created by generalize! given an instance specific result for a Hash" do
2050
1869
  generic = calculator.infer({'a' =>1,'b' => 2})
2051
- generic.key_type.values.sort.should == ['a', 'b']
2052
- generic.element_type.from.should == 1
2053
- generic.element_type.to.should == 2
1870
+ expect(generic.key_type.values.sort).to eq(['a', 'b'])
1871
+ expect(generic.element_type.from).to eq(1)
1872
+ expect(generic.element_type.to).to eq(2)
2054
1873
  calculator.generalize!(generic)
2055
- generic.key_type.values.should == []
2056
- generic.element_type.from.should == nil
2057
- generic.element_type.to.should == nil
2058
- end
2059
-
2060
- it 'ensures that Struct key types are not generalized' do
2061
- generic = calculator.generalize!(struct_t({'a' => object_t}))
2062
- expect(calculator.string(generic)).to eq("Struct[{'a'=>Any}]")
2063
- generic = calculator.generalize!(struct_t({not_undef_t('a') => object_t}))
2064
- expect(calculator.string(generic)).to eq("Struct[{NotUndef['a']=>Any}]")
2065
- generic = calculator.generalize!(struct_t({optional_t('a') => string_t}))
2066
- expect(calculator.string(generic)).to eq("Struct[{Optional['a']=>String}]")
2067
- end
2068
-
2069
- it 'ensures that Struct value types are generalized' do
2070
- generic = calculator.generalize!(struct_t({'a' => range_t(1, 3)}))
2071
- expect(calculator.string(generic)).to eq("Struct[{'a'=>Integer}]")
1874
+ expect(generic.key_type.values).to eq([])
1875
+ expect(generic.element_type.from).to eq(nil)
1876
+ expect(generic.element_type.to).to eq(nil)
2072
1877
  end
2073
1878
 
2074
1879
  it "does not reduce by combining types when using infer_set" do
2075
1880
  element_type = calculator.infer(['a','b',1,2]).element_type
2076
- element_type.class.should == Puppet::Pops::Types::PScalarType
1881
+ expect(element_type.class).to eq(Puppet::Pops::Types::PScalarType)
2077
1882
  inferred_type = calculator.infer_set(['a','b',1,2])
2078
- inferred_type.class.should == Puppet::Pops::Types::PTupleType
1883
+ expect(inferred_type.class).to eq(Puppet::Pops::Types::PTupleType)
2079
1884
  element_types = inferred_type.types
2080
- element_types[0].class.should == Puppet::Pops::Types::PStringType
2081
- element_types[1].class.should == Puppet::Pops::Types::PStringType
2082
- element_types[2].class.should == Puppet::Pops::Types::PIntegerType
2083
- element_types[3].class.should == Puppet::Pops::Types::PIntegerType
1885
+ expect(element_types[0].class).to eq(Puppet::Pops::Types::PStringType)
1886
+ expect(element_types[1].class).to eq(Puppet::Pops::Types::PStringType)
1887
+ expect(element_types[2].class).to eq(Puppet::Pops::Types::PIntegerType)
1888
+ expect(element_types[3].class).to eq(Puppet::Pops::Types::PIntegerType)
2084
1889
  end
2085
1890
 
2086
1891
  it "does not reduce by combining types when using infer_set and values are undef" do
2087
1892
  element_type = calculator.infer(['a',nil]).element_type
2088
- element_type.class.should == Puppet::Pops::Types::PStringType
1893
+ expect(element_type.class).to eq(Puppet::Pops::Types::PStringType)
2089
1894
  inferred_type = calculator.infer_set(['a',nil])
2090
- inferred_type.class.should == Puppet::Pops::Types::PTupleType
1895
+ expect(inferred_type.class).to eq(Puppet::Pops::Types::PTupleType)
2091
1896
  element_types = inferred_type.types
2092
- element_types[0].class.should == Puppet::Pops::Types::PStringType
2093
- element_types[1].class.should == Puppet::Pops::Types::PUndefType
1897
+ expect(element_types[0].class).to eq(Puppet::Pops::Types::PStringType)
1898
+ expect(element_types[1].class).to eq(Puppet::Pops::Types::PUndefType)
2094
1899
  end
2095
1900
  end
2096
1901
 
@@ -2099,26 +1904,26 @@ describe 'The type calculator' do
2099
1904
  it 'with callable' do
2100
1905
  required = callable_t(string_t)
2101
1906
  given = callable_t(string_t)
2102
- calculator.callable?(required, given).should == true
1907
+ expect(calculator.callable?(required, given)).to eq(true)
2103
1908
  end
2104
1909
 
2105
1910
  it 'with args tuple' do
2106
1911
  required = callable_t(string_t)
2107
1912
  given = tuple_t(string_t)
2108
- calculator.callable?(required, given).should == true
1913
+ expect(calculator.callable?(required, given)).to eq(true)
2109
1914
  end
2110
1915
 
2111
1916
  it 'with args tuple having a block' do
2112
1917
  required = callable_t(string_t, callable_t(string_t))
2113
1918
  given = tuple_t(string_t, callable_t(string_t))
2114
- calculator.callable?(required, given).should == true
1919
+ expect(calculator.callable?(required, given)).to eq(true)
2115
1920
  end
2116
1921
 
2117
1922
  it 'with args array' do
2118
1923
  required = callable_t(string_t)
2119
1924
  given = array_t(string_t)
2120
1925
  factory.constrain_size(given, 1, 1)
2121
- calculator.callable?(required, given).should == true
1926
+ expect(calculator.callable?(required, given)).to eq(true)
2122
1927
  end
2123
1928
  end
2124
1929
 
@@ -2126,25 +1931,25 @@ describe 'The type calculator' do
2126
1931
  it 'with callable' do
2127
1932
  required = callable_t(string_t)
2128
1933
  given = callable_t(object_t)
2129
- calculator.callable?(required, given).should == true
1934
+ expect(calculator.callable?(required, given)).to eq(true)
2130
1935
  end
2131
1936
 
2132
1937
  it 'with args tuple' do
2133
1938
  required = callable_t(string_t)
2134
1939
  given = tuple_t(object_t)
2135
- calculator.callable?(required, given).should == false
1940
+ expect(calculator.callable?(required, given)).to eq(false)
2136
1941
  end
2137
1942
 
2138
1943
  it 'with args tuple having a block' do
2139
1944
  required = callable_t(string_t, callable_t(string_t))
2140
1945
  given = tuple_t(string_t, callable_t(object_t))
2141
- calculator.callable?(required, given).should == true
1946
+ expect(calculator.callable?(required, given)).to eq(true)
2142
1947
  end
2143
1948
 
2144
1949
  it 'with args tuple having a block with captures rest' do
2145
1950
  required = callable_t(string_t, callable_t(string_t))
2146
1951
  given = tuple_t(string_t, callable_t(object_t, 0, :default))
2147
- calculator.callable?(required, given).should == true
1952
+ expect(calculator.callable?(required, given)).to eq(true)
2148
1953
  end
2149
1954
  end
2150
1955
 
@@ -2152,41 +1957,41 @@ describe 'The type calculator' do
2152
1957
  it 'with callable' do
2153
1958
  required = callable_t(object_t)
2154
1959
  given = callable_t(string_t)
2155
- calculator.callable?(required, given).should == false
1960
+ expect(calculator.callable?(required, given)).to eq(false)
2156
1961
  end
2157
1962
 
2158
1963
  it 'with args tuple' do
2159
1964
  required = callable_t(object_t)
2160
1965
  given = tuple_t(string_t)
2161
- calculator.callable?(required, given).should == true
1966
+ expect(calculator.callable?(required, given)).to eq(true)
2162
1967
  end
2163
1968
 
2164
1969
  it 'with args tuple having a block' do
2165
1970
  required = callable_t(string_t, callable_t(object_t))
2166
1971
  given = tuple_t(string_t, callable_t(string_t))
2167
- calculator.callable?(required, given).should == false
1972
+ expect(calculator.callable?(required, given)).to eq(false)
2168
1973
  end
2169
1974
 
2170
1975
  it 'with args tuple having a block with captures rest' do
2171
1976
  required = callable_t(string_t, callable_t(object_t))
2172
1977
  given = tuple_t(string_t, callable_t(string_t, 0, :default))
2173
- calculator.callable?(required, given).should == false
1978
+ expect(calculator.callable?(required, given)).to eq(false)
2174
1979
  end
2175
1980
  end
2176
1981
  end
2177
1982
 
2178
1983
  matcher :be_assignable_to do |type|
2179
- calc = Puppet::Pops::Types::TypeCalculator.singleton
1984
+ calc = Puppet::Pops::Types::TypeCalculator.new
2180
1985
 
2181
1986
  match do |actual|
2182
1987
  calc.assignable?(type, actual)
2183
1988
  end
2184
1989
 
2185
- failure_message_for_should do |actual|
1990
+ failure_message do |actual|
2186
1991
  "#{calc.string(actual)} should be assignable to #{calc.string(type)}"
2187
1992
  end
2188
1993
 
2189
- failure_message_for_should_not do |actual|
1994
+ failure_message_when_negated do |actual|
2190
1995
  "#{calc.string(actual)} is assignable to #{calc.string(type)} when it should not"
2191
1996
  end
2192
1997
  end