puppet-retrospec 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (539) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/CHANGELOG.md +4 -0
  4. data/Gemfile +2 -1
  5. data/Gemfile.lock +121 -0
  6. data/README.md +3 -0
  7. data/Rakefile +1 -1
  8. data/VERSION +1 -1
  9. data/lib/retrospec-puppet.rb +3 -0
  10. data/lib/retrospec/{conditional.rb → plugins/v1/plugin/conditional.rb} +1 -1
  11. data/lib/retrospec/plugins/v1/plugin/helpers.rb +32 -0
  12. data/lib/retrospec/plugins/v1/plugin/puppet.rb +248 -0
  13. data/lib/retrospec/{puppet_module.rb → plugins/v1/plugin/puppet_module.rb} +0 -0
  14. data/lib/retrospec/{resource.rb → plugins/v1/plugin/resource.rb} +1 -1
  15. data/lib/retrospec/{spec_object.rb → plugins/v1/plugin/spec_object.rb} +17 -18
  16. data/lib/retrospec/plugins/v1/plugin/template_helpers.rb +72 -0
  17. data/lib/retrospec/{templates → plugins/v1/plugin/templates}/clone-hook +1 -1
  18. data/lib/retrospec/{type_code.rb → plugins/v1/plugin/type_code.rb} +2 -2
  19. data/lib/retrospec/{variable_store.rb → plugins/v1/plugin/variable_store.rb} +1 -1
  20. data/lib/retrospec/plugins/v1/plugin/version.rb +5 -0
  21. data/puppet-retrospec.gemspec +529 -18
  22. data/spec/fixtures/modules/concat/CHANGELOG.md +257 -0
  23. data/spec/fixtures/modules/concat/CONTRIBUTING.md +220 -0
  24. data/spec/fixtures/modules/concat/Gemfile +50 -0
  25. data/spec/fixtures/modules/concat/LICENSE +14 -0
  26. data/spec/fixtures/modules/concat/README.md +283 -0
  27. data/spec/fixtures/modules/concat/Rakefile +10 -0
  28. data/spec/fixtures/modules/concat/checksums.json +54 -0
  29. data/spec/fixtures/modules/concat/files/concatfragments.rb +153 -0
  30. data/spec/fixtures/modules/concat/lib/facter/concat_basedir.rb +11 -0
  31. data/spec/fixtures/modules/concat/lib/puppet/parser/functions/concat_getparam.rb +35 -0
  32. data/spec/fixtures/modules/concat/lib/puppet/parser/functions/concat_is_bool.rb +22 -0
  33. data/spec/fixtures/modules/concat/manifests/fragment.pp +133 -0
  34. data/spec/fixtures/modules/concat/manifests/init.pp +268 -0
  35. data/spec/fixtures/modules/concat/manifests/setup.pp +64 -0
  36. data/spec/fixtures/modules/concat/metadata.json +110 -0
  37. data/spec/fixtures/modules/concat/spec/acceptance/backup_spec.rb +115 -0
  38. data/spec/fixtures/modules/concat/spec/acceptance/concat_spec.rb +217 -0
  39. data/spec/fixtures/modules/concat/spec/acceptance/deprecation_warnings_spec.rb +238 -0
  40. data/spec/fixtures/modules/concat/spec/acceptance/empty_spec.rb +23 -0
  41. data/spec/fixtures/modules/concat/spec/acceptance/fragment_source_spec.rb +157 -0
  42. data/spec/fixtures/modules/concat/spec/acceptance/fragments_are_always_replaced_spec.rb +139 -0
  43. data/spec/fixtures/modules/concat/spec/acceptance/newline_spec.rb +67 -0
  44. data/spec/fixtures/modules/concat/spec/acceptance/nodesets/aix-71-vcloud.yml +19 -0
  45. data/spec/fixtures/modules/concat/spec/acceptance/nodesets/centos-59-x64.yml +10 -0
  46. data/spec/fixtures/modules/concat/spec/acceptance/nodesets/centos-64-x64-pe.yml +12 -0
  47. data/spec/fixtures/modules/concat/spec/acceptance/nodesets/centos-64-x64.yml +10 -0
  48. data/spec/fixtures/modules/concat/spec/acceptance/nodesets/centos-65-x64.yml +10 -0
  49. data/spec/fixtures/modules/concat/spec/acceptance/nodesets/debian-607-x64.yml +10 -0
  50. data/spec/fixtures/modules/concat/spec/acceptance/nodesets/debian-70rc1-x64.yml +10 -0
  51. data/spec/fixtures/modules/concat/spec/acceptance/nodesets/debian-73-x64.yml +11 -0
  52. data/spec/fixtures/modules/concat/spec/acceptance/nodesets/default.yml +10 -0
  53. data/spec/fixtures/modules/concat/spec/acceptance/nodesets/fedora-18-x64.yml +10 -0
  54. data/spec/fixtures/modules/concat/spec/acceptance/nodesets/sles-11-x64.yml +10 -0
  55. data/spec/fixtures/modules/concat/spec/acceptance/nodesets/sles-11sp1-x64.yml +10 -0
  56. data/spec/fixtures/modules/concat/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml +10 -0
  57. data/spec/fixtures/modules/concat/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml +10 -0
  58. data/spec/fixtures/modules/concat/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml +11 -0
  59. data/spec/fixtures/modules/concat/spec/acceptance/order_spec.rb +123 -0
  60. data/spec/fixtures/modules/concat/spec/acceptance/quoted_paths_spec.rb +42 -0
  61. data/spec/fixtures/modules/concat/spec/acceptance/replace_spec.rb +262 -0
  62. data/spec/fixtures/modules/concat/spec/acceptance/specinfra_stubs.rb +19 -0
  63. data/spec/fixtures/modules/concat/spec/acceptance/symbolic_name_spec.rb +35 -0
  64. data/spec/fixtures/modules/concat/spec/acceptance/validation_spec.rb +35 -0
  65. data/spec/fixtures/modules/concat/spec/acceptance/warn_spec.rb +104 -0
  66. data/spec/fixtures/modules/concat/spec/spec.opts +6 -0
  67. data/spec/fixtures/modules/concat/spec/spec_helper.rb +1 -0
  68. data/spec/fixtures/modules/concat/spec/spec_helper_acceptance.rb +61 -0
  69. data/spec/fixtures/modules/concat/spec/unit/classes/concat_setup_spec.rb +98 -0
  70. data/spec/fixtures/modules/concat/spec/unit/defines/concat_fragment_spec.rb +330 -0
  71. data/spec/fixtures/modules/concat/spec/unit/defines/concat_spec.rb +415 -0
  72. data/spec/fixtures/modules/concat/spec/unit/facts/concat_basedir_spec.rb +18 -0
  73. data/spec/fixtures/modules/concat/tests/fragment.pp +19 -0
  74. data/spec/fixtures/modules/concat/tests/init.pp +7 -0
  75. data/spec/fixtures/modules/staging/Gemfile +7 -0
  76. data/spec/fixtures/modules/staging/LICENSE +11 -0
  77. data/spec/fixtures/modules/staging/README.md +70 -0
  78. data/spec/fixtures/modules/staging/Rakefile +1 -0
  79. data/spec/fixtures/modules/staging/Vagrantfile +29 -0
  80. data/spec/fixtures/modules/staging/checksums.json +37 -0
  81. data/spec/fixtures/modules/staging/docs/deploy.html +113 -0
  82. data/spec/fixtures/modules/staging/docs/extract.html +176 -0
  83. data/spec/fixtures/modules/staging/docs/file.html +178 -0
  84. data/spec/fixtures/modules/staging/docs/init.html +87 -0
  85. data/spec/fixtures/modules/staging/files/sample +1 -0
  86. data/spec/fixtures/modules/staging/files/sample.tar.bz2 +0 -0
  87. data/spec/fixtures/modules/staging/files/sample.tar.gz +0 -0
  88. data/spec/fixtures/modules/staging/lib/facter/staging_http_get.rb +29 -0
  89. data/spec/fixtures/modules/staging/lib/facter/staging_windir.rb +11 -0
  90. data/spec/fixtures/modules/staging/lib/puppet/parser/functions/scope_defaults.rb +17 -0
  91. data/spec/fixtures/modules/staging/lib/puppet/parser/functions/staging_parse.rb +36 -0
  92. data/spec/fixtures/modules/staging/manifests/.init.pp.swp +0 -0
  93. data/spec/fixtures/modules/staging/manifests/deploy.pp +42 -0
  94. data/spec/fixtures/modules/staging/manifests/extract.pp +109 -0
  95. data/spec/fixtures/modules/staging/manifests/file.pp +125 -0
  96. data/spec/fixtures/modules/staging/manifests/init.pp +31 -0
  97. data/spec/fixtures/modules/staging/manifests/params.pp +33 -0
  98. data/spec/fixtures/modules/staging/metadata.json +106 -0
  99. data/spec/fixtures/modules/staging/spec/defines/staging_deploy_spec.rb +27 -0
  100. data/spec/fixtures/modules/staging/spec/defines/staging_extract_spec.rb +104 -0
  101. data/spec/fixtures/modules/staging/spec/defines/staging_file_spec.rb +163 -0
  102. data/spec/fixtures/modules/staging/spec/fixtures/hiera.yaml +7 -0
  103. data/spec/fixtures/modules/staging/spec/spec_helper.rb +29 -0
  104. data/spec/fixtures/modules/staging/spec/unit/puppet/parser/functions/scope_defaults_spec.rb +45 -0
  105. data/spec/fixtures/modules/staging/spec/unit/puppet/parser/functions/staging_parse_spec.rb +51 -0
  106. data/spec/fixtures/modules/staging/tests/deploy.pp +4 -0
  107. data/spec/fixtures/modules/staging/tests/extract.pp +25 -0
  108. data/spec/fixtures/modules/staging/tests/file.pp +17 -0
  109. data/spec/fixtures/modules/staging/tests/init.pp +1 -0
  110. data/spec/fixtures/modules/staging/tests/scope_defaults.pp +7 -0
  111. data/spec/fixtures/modules/staging/tests/staging_parse.pp +12 -0
  112. data/spec/fixtures/modules/stdlib/CHANGELOG.md +515 -0
  113. data/spec/fixtures/modules/stdlib/CONTRIBUTING.md +220 -0
  114. data/spec/fixtures/modules/stdlib/Gemfile +51 -0
  115. data/spec/fixtures/modules/stdlib/LICENSE +19 -0
  116. data/spec/fixtures/modules/stdlib/README.markdown +1042 -0
  117. data/spec/fixtures/modules/stdlib/README_DEVELOPER.markdown +35 -0
  118. data/spec/fixtures/modules/stdlib/README_SPECS.markdown +7 -0
  119. data/spec/fixtures/modules/stdlib/RELEASE_PROCESS.markdown +24 -0
  120. data/spec/fixtures/modules/stdlib/Rakefile +18 -0
  121. data/spec/fixtures/modules/stdlib/checksums.json +381 -0
  122. data/spec/fixtures/modules/stdlib/lib/facter/facter_dot_d.rb +202 -0
  123. data/spec/fixtures/modules/stdlib/lib/facter/pe_version.rb +53 -0
  124. data/spec/fixtures/modules/stdlib/lib/facter/puppet_vardir.rb +26 -0
  125. data/spec/fixtures/modules/stdlib/lib/facter/root_home.rb +32 -0
  126. data/spec/fixtures/modules/stdlib/lib/facter/util/puppet_settings.rb +21 -0
  127. data/spec/fixtures/modules/stdlib/lib/puppet/functions/type_of.rb +17 -0
  128. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/abs.rb +36 -0
  129. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/any2array.rb +33 -0
  130. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/assert_private.rb +29 -0
  131. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/base64.rb +37 -0
  132. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/basename.rb +34 -0
  133. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/bool2num.rb +26 -0
  134. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/bool2str.rb +27 -0
  135. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/camelcase.rb +33 -0
  136. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/capitalize.rb +33 -0
  137. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/ceiling.rb +25 -0
  138. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/chomp.rb +34 -0
  139. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/chop.rb +36 -0
  140. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/concat.rb +41 -0
  141. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/count.rb +22 -0
  142. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/deep_merge.rb +44 -0
  143. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb +35 -0
  144. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/delete.rb +49 -0
  145. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/delete_at.rb +49 -0
  146. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/delete_undef_values.rb +34 -0
  147. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/delete_values.rb +26 -0
  148. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/difference.rb +36 -0
  149. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/dirname.rb +21 -0
  150. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/downcase.rb +32 -0
  151. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/empty.rb +27 -0
  152. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb +35 -0
  153. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb +46 -0
  154. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/flatten.rb +33 -0
  155. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/floor.rb +25 -0
  156. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/fqdn_rand_string.rb +34 -0
  157. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb +57 -0
  158. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb +17 -0
  159. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getparam.rb +35 -0
  160. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb +29 -0
  161. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/grep.rb +33 -0
  162. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb +68 -0
  163. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb +25 -0
  164. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb +25 -0
  165. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/has_key.rb +28 -0
  166. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/hash.rb +41 -0
  167. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/intersection.rb +34 -0
  168. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/is_array.rb +22 -0
  169. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/is_bool.rb +22 -0
  170. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb +54 -0
  171. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/is_float.rb +30 -0
  172. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb +26 -0
  173. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/is_hash.rb +22 -0
  174. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/is_integer.rb +45 -0
  175. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb +32 -0
  176. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb +27 -0
  177. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb +75 -0
  178. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/is_string.rb +26 -0
  179. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/join.rb +41 -0
  180. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb +47 -0
  181. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/keys.rb +26 -0
  182. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb +20 -0
  183. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/lstrip.rb +32 -0
  184. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/max.rb +21 -0
  185. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/member.rb +62 -0
  186. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/merge.rb +34 -0
  187. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/min.rb +21 -0
  188. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/num2bool.rb +43 -0
  189. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/parsejson.rb +24 -0
  190. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb +24 -0
  191. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/pick.rb +29 -0
  192. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/pick_default.rb +35 -0
  193. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/prefix.rb +52 -0
  194. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/private.rb +17 -0
  195. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/pw_hash.rb +56 -0
  196. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/range.rb +88 -0
  197. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/reject.rb +31 -0
  198. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/reverse.rb +27 -0
  199. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/rstrip.rb +31 -0
  200. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/shuffle.rb +45 -0
  201. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/size.rb +48 -0
  202. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/sort.rb +27 -0
  203. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/squeeze.rb +36 -0
  204. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/str2bool.rb +46 -0
  205. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb +32 -0
  206. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/strftime.rb +107 -0
  207. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/strip.rb +38 -0
  208. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/suffix.rb +45 -0
  209. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/swapcase.rb +38 -0
  210. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/time.rb +49 -0
  211. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb +31 -0
  212. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/type.rb +19 -0
  213. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/type3x.rb +51 -0
  214. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/union.rb +34 -0
  215. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/unique.rb +50 -0
  216. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/upcase.rb +45 -0
  217. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/uriescape.rb +34 -0
  218. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb +69 -0
  219. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_array.rb +33 -0
  220. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb +83 -0
  221. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb +34 -0
  222. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb +63 -0
  223. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb +33 -0
  224. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_integer.rb +131 -0
  225. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_ipv4_address.rb +48 -0
  226. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_ipv6_address.rb +49 -0
  227. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_numeric.rb +93 -0
  228. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_re.rb +40 -0
  229. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_slength.rb +71 -0
  230. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb +38 -0
  231. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/values.rb +39 -0
  232. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/values_at.rb +99 -0
  233. data/spec/fixtures/modules/stdlib/lib/puppet/parser/functions/zip.rb +39 -0
  234. data/spec/fixtures/modules/stdlib/lib/puppet/provider/file_line/ruby.rb +97 -0
  235. data/spec/fixtures/modules/stdlib/lib/puppet/type/anchor.rb +46 -0
  236. data/spec/fixtures/modules/stdlib/lib/puppet/type/file_line.rb +91 -0
  237. data/spec/fixtures/modules/stdlib/manifests/init.pp +20 -0
  238. data/spec/fixtures/modules/stdlib/manifests/stages.pp +43 -0
  239. data/spec/fixtures/modules/stdlib/metadata.json +113 -0
  240. data/spec/fixtures/modules/stdlib/spec/acceptance/abs_spec.rb +30 -0
  241. data/spec/fixtures/modules/stdlib/spec/acceptance/any2array_spec.rb +49 -0
  242. data/spec/fixtures/modules/stdlib/spec/acceptance/base64_spec.rb +18 -0
  243. data/spec/fixtures/modules/stdlib/spec/acceptance/bool2num_spec.rb +34 -0
  244. data/spec/fixtures/modules/stdlib/spec/acceptance/build_csv.rb +83 -0
  245. data/spec/fixtures/modules/stdlib/spec/acceptance/capitalize_spec.rb +33 -0
  246. data/spec/fixtures/modules/stdlib/spec/acceptance/ceiling_spec.rb +39 -0
  247. data/spec/fixtures/modules/stdlib/spec/acceptance/chomp_spec.rb +21 -0
  248. data/spec/fixtures/modules/stdlib/spec/acceptance/chop_spec.rb +45 -0
  249. data/spec/fixtures/modules/stdlib/spec/acceptance/concat_spec.rb +40 -0
  250. data/spec/fixtures/modules/stdlib/spec/acceptance/count_spec.rb +30 -0
  251. data/spec/fixtures/modules/stdlib/spec/acceptance/deep_merge_spec.rb +20 -0
  252. data/spec/fixtures/modules/stdlib/spec/acceptance/defined_with_params_spec.rb +22 -0
  253. data/spec/fixtures/modules/stdlib/spec/acceptance/delete_at_spec.rb +19 -0
  254. data/spec/fixtures/modules/stdlib/spec/acceptance/delete_spec.rb +19 -0
  255. data/spec/fixtures/modules/stdlib/spec/acceptance/delete_undef_values_spec.rb +19 -0
  256. data/spec/fixtures/modules/stdlib/spec/acceptance/delete_values_spec.rb +25 -0
  257. data/spec/fixtures/modules/stdlib/spec/acceptance/difference_spec.rb +26 -0
  258. data/spec/fixtures/modules/stdlib/spec/acceptance/dirname_spec.rb +42 -0
  259. data/spec/fixtures/modules/stdlib/spec/acceptance/downcase_spec.rb +39 -0
  260. data/spec/fixtures/modules/stdlib/spec/acceptance/empty_spec.rb +39 -0
  261. data/spec/fixtures/modules/stdlib/spec/acceptance/ensure_packages_spec.rb +22 -0
  262. data/spec/fixtures/modules/stdlib/spec/acceptance/ensure_resource_spec.rb +22 -0
  263. data/spec/fixtures/modules/stdlib/spec/acceptance/flatten_spec.rb +39 -0
  264. data/spec/fixtures/modules/stdlib/spec/acceptance/floor_spec.rb +39 -0
  265. data/spec/fixtures/modules/stdlib/spec/acceptance/fqdn_rand_string_spec.rb +60 -0
  266. data/spec/fixtures/modules/stdlib/spec/acceptance/fqdn_rotate_spec.rb +47 -0
  267. data/spec/fixtures/modules/stdlib/spec/acceptance/get_module_path_spec.rb +27 -0
  268. data/spec/fixtures/modules/stdlib/spec/acceptance/getparam_spec.rb +24 -0
  269. data/spec/fixtures/modules/stdlib/spec/acceptance/getvar_spec.rb +26 -0
  270. data/spec/fixtures/modules/stdlib/spec/acceptance/grep_spec.rb +26 -0
  271. data/spec/fixtures/modules/stdlib/spec/acceptance/has_interface_with_spec.rb +54 -0
  272. data/spec/fixtures/modules/stdlib/spec/acceptance/has_ip_address_spec.rb +33 -0
  273. data/spec/fixtures/modules/stdlib/spec/acceptance/has_ip_network_spec.rb +33 -0
  274. data/spec/fixtures/modules/stdlib/spec/acceptance/has_key_spec.rb +41 -0
  275. data/spec/fixtures/modules/stdlib/spec/acceptance/hash_spec.rb +26 -0
  276. data/spec/fixtures/modules/stdlib/spec/acceptance/intersection_spec.rb +27 -0
  277. data/spec/fixtures/modules/stdlib/spec/acceptance/is_array_spec.rb +67 -0
  278. data/spec/fixtures/modules/stdlib/spec/acceptance/is_bool_spec.rb +81 -0
  279. data/spec/fixtures/modules/stdlib/spec/acceptance/is_domain_name_spec.rb +83 -0
  280. data/spec/fixtures/modules/stdlib/spec/acceptance/is_float_spec.rb +86 -0
  281. data/spec/fixtures/modules/stdlib/spec/acceptance/is_function_available_spec.rb +58 -0
  282. data/spec/fixtures/modules/stdlib/spec/acceptance/is_hash_spec.rb +63 -0
  283. data/spec/fixtures/modules/stdlib/spec/acceptance/is_integer_spec.rb +95 -0
  284. data/spec/fixtures/modules/stdlib/spec/acceptance/is_ip_address_spec.rb +80 -0
  285. data/spec/fixtures/modules/stdlib/spec/acceptance/is_mac_address_spec.rb +38 -0
  286. data/spec/fixtures/modules/stdlib/spec/acceptance/is_numeric_spec.rb +95 -0
  287. data/spec/fixtures/modules/stdlib/spec/acceptance/is_string_spec.rb +102 -0
  288. data/spec/fixtures/modules/stdlib/spec/acceptance/join_keys_to_values_spec.rb +24 -0
  289. data/spec/fixtures/modules/stdlib/spec/acceptance/join_spec.rb +26 -0
  290. data/spec/fixtures/modules/stdlib/spec/acceptance/keys_spec.rb +23 -0
  291. data/spec/fixtures/modules/stdlib/spec/acceptance/loadyaml_spec.rb +33 -0
  292. data/spec/fixtures/modules/stdlib/spec/acceptance/lstrip_spec.rb +34 -0
  293. data/spec/fixtures/modules/stdlib/spec/acceptance/max_spec.rb +20 -0
  294. data/spec/fixtures/modules/stdlib/spec/acceptance/member_spec.rb +54 -0
  295. data/spec/fixtures/modules/stdlib/spec/acceptance/merge_spec.rb +23 -0
  296. data/spec/fixtures/modules/stdlib/spec/acceptance/min_spec.rb +20 -0
  297. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/centos-59-x64.yml +10 -0
  298. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/centos-6-vcloud.yml +15 -0
  299. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/centos-64-x64-pe.yml +12 -0
  300. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/centos-64-x64.yml +10 -0
  301. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/centos-65-x64.yml +10 -0
  302. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/default.yml +10 -0
  303. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/fedora-18-x64.yml +10 -0
  304. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/sles-11-x64.yml +10 -0
  305. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml +10 -0
  306. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml +10 -0
  307. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml +11 -0
  308. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/windows-2003-i386.yml +26 -0
  309. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/windows-2003-x86_64.yml +26 -0
  310. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/windows-2008-x86_64.yml +26 -0
  311. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/windows-2008r2-x86_64.yml +26 -0
  312. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/windows-2012-x86_64.yml +26 -0
  313. data/spec/fixtures/modules/stdlib/spec/acceptance/nodesets/windows-2012r2-x86_64.yml +26 -0
  314. data/spec/fixtures/modules/stdlib/spec/acceptance/num2bool_spec.rb +76 -0
  315. data/spec/fixtures/modules/stdlib/spec/acceptance/parsejson_spec.rb +34 -0
  316. data/spec/fixtures/modules/stdlib/spec/acceptance/parseyaml_spec.rb +35 -0
  317. data/spec/fixtures/modules/stdlib/spec/acceptance/pick_default_spec.rb +54 -0
  318. data/spec/fixtures/modules/stdlib/spec/acceptance/pick_spec.rb +44 -0
  319. data/spec/fixtures/modules/stdlib/spec/acceptance/prefix_spec.rb +42 -0
  320. data/spec/fixtures/modules/stdlib/spec/acceptance/pw_hash_spec.rb +34 -0
  321. data/spec/fixtures/modules/stdlib/spec/acceptance/range_spec.rb +36 -0
  322. data/spec/fixtures/modules/stdlib/spec/acceptance/reject_spec.rb +42 -0
  323. data/spec/fixtures/modules/stdlib/spec/acceptance/reverse_spec.rb +23 -0
  324. data/spec/fixtures/modules/stdlib/spec/acceptance/rstrip_spec.rb +34 -0
  325. data/spec/fixtures/modules/stdlib/spec/acceptance/shuffle_spec.rb +34 -0
  326. data/spec/fixtures/modules/stdlib/spec/acceptance/size_spec.rb +55 -0
  327. data/spec/fixtures/modules/stdlib/spec/acceptance/sort_spec.rb +34 -0
  328. data/spec/fixtures/modules/stdlib/spec/acceptance/squeeze_spec.rb +47 -0
  329. data/spec/fixtures/modules/stdlib/spec/acceptance/str2bool_spec.rb +31 -0
  330. data/spec/fixtures/modules/stdlib/spec/acceptance/str2saltedsha512_spec.rb +22 -0
  331. data/spec/fixtures/modules/stdlib/spec/acceptance/strftime_spec.rb +22 -0
  332. data/spec/fixtures/modules/stdlib/spec/acceptance/strip_spec.rb +34 -0
  333. data/spec/fixtures/modules/stdlib/spec/acceptance/suffix_spec.rb +42 -0
  334. data/spec/fixtures/modules/stdlib/spec/acceptance/swapcase_spec.rb +22 -0
  335. data/spec/fixtures/modules/stdlib/spec/acceptance/time_spec.rb +36 -0
  336. data/spec/fixtures/modules/stdlib/spec/acceptance/to_bytes_spec.rb +27 -0
  337. data/spec/fixtures/modules/stdlib/spec/acceptance/type_spec.rb +37 -0
  338. data/spec/fixtures/modules/stdlib/spec/acceptance/union_spec.rb +24 -0
  339. data/spec/fixtures/modules/stdlib/spec/acceptance/unique_spec.rb +33 -0
  340. data/spec/fixtures/modules/stdlib/spec/acceptance/unsupported_spec.rb +11 -0
  341. data/spec/fixtures/modules/stdlib/spec/acceptance/upcase_spec.rb +33 -0
  342. data/spec/fixtures/modules/stdlib/spec/acceptance/uriescape_spec.rb +23 -0
  343. data/spec/fixtures/modules/stdlib/spec/acceptance/validate_absolute_path_spec.rb +31 -0
  344. data/spec/fixtures/modules/stdlib/spec/acceptance/validate_array_spec.rb +37 -0
  345. data/spec/fixtures/modules/stdlib/spec/acceptance/validate_augeas_spec.rb +63 -0
  346. data/spec/fixtures/modules/stdlib/spec/acceptance/validate_bool_spec.rb +37 -0
  347. data/spec/fixtures/modules/stdlib/spec/acceptance/validate_cmd_spec.rb +52 -0
  348. data/spec/fixtures/modules/stdlib/spec/acceptance/validate_hash_spec.rb +37 -0
  349. data/spec/fixtures/modules/stdlib/spec/acceptance/validate_ipv4_address_spec.rb +31 -0
  350. data/spec/fixtures/modules/stdlib/spec/acceptance/validate_ipv6_address_spec.rb +31 -0
  351. data/spec/fixtures/modules/stdlib/spec/acceptance/validate_re_spec.rb +47 -0
  352. data/spec/fixtures/modules/stdlib/spec/acceptance/validate_slength_spec.rb +72 -0
  353. data/spec/fixtures/modules/stdlib/spec/acceptance/validate_string_spec.rb +36 -0
  354. data/spec/fixtures/modules/stdlib/spec/acceptance/values_at_spec.rb +73 -0
  355. data/spec/fixtures/modules/stdlib/spec/acceptance/values_spec.rb +35 -0
  356. data/spec/fixtures/modules/stdlib/spec/acceptance/zip_spec.rb +86 -0
  357. data/spec/fixtures/modules/stdlib/spec/classes/anchor_spec.rb +30 -0
  358. data/spec/fixtures/modules/stdlib/spec/functions/abs_spec.rb +25 -0
  359. data/spec/fixtures/modules/stdlib/spec/functions/any2array_spec.rb +55 -0
  360. data/spec/fixtures/modules/stdlib/spec/functions/assert_private_spec.rb +55 -0
  361. data/spec/fixtures/modules/stdlib/spec/functions/base64_spec.rb +34 -0
  362. data/spec/fixtures/modules/stdlib/spec/functions/bool2num_spec.rb +38 -0
  363. data/spec/fixtures/modules/stdlib/spec/functions/capitalize_spec.rb +28 -0
  364. data/spec/fixtures/modules/stdlib/spec/functions/ceiling_spec.rb +39 -0
  365. data/spec/fixtures/modules/stdlib/spec/functions/chomp_spec.rb +28 -0
  366. data/spec/fixtures/modules/stdlib/spec/functions/chop_spec.rb +28 -0
  367. data/spec/fixtures/modules/stdlib/spec/functions/concat_spec.rb +50 -0
  368. data/spec/fixtures/modules/stdlib/spec/functions/count_spec.rb +31 -0
  369. data/spec/fixtures/modules/stdlib/spec/functions/deep_merge_spec.rb +105 -0
  370. data/spec/fixtures/modules/stdlib/spec/functions/defined_with_params_spec.rb +37 -0
  371. data/spec/fixtures/modules/stdlib/spec/functions/delete_at_spec.rb +25 -0
  372. data/spec/fixtures/modules/stdlib/spec/functions/delete_spec.rb +61 -0
  373. data/spec/fixtures/modules/stdlib/spec/functions/delete_undef_values_spec.rb +41 -0
  374. data/spec/fixtures/modules/stdlib/spec/functions/delete_values_spec.rb +36 -0
  375. data/spec/fixtures/modules/stdlib/spec/functions/difference_spec.rb +19 -0
  376. data/spec/fixtures/modules/stdlib/spec/functions/dirname_spec.rb +38 -0
  377. data/spec/fixtures/modules/stdlib/spec/functions/downcase_spec.rb +33 -0
  378. data/spec/fixtures/modules/stdlib/spec/functions/empty_spec.rb +32 -0
  379. data/spec/fixtures/modules/stdlib/spec/functions/ensure_packages_spec.rb +81 -0
  380. data/spec/fixtures/modules/stdlib/spec/functions/ensure_resource_spec.rb +113 -0
  381. data/spec/fixtures/modules/stdlib/spec/functions/flatten_spec.rb +27 -0
  382. data/spec/fixtures/modules/stdlib/spec/functions/floor_spec.rb +39 -0
  383. data/spec/fixtures/modules/stdlib/spec/functions/fqdn_rand_string_spec.rb +91 -0
  384. data/spec/fixtures/modules/stdlib/spec/functions/fqdn_rotate_spec.rb +60 -0
  385. data/spec/fixtures/modules/stdlib/spec/functions/get_module_path_spec.rb +46 -0
  386. data/spec/fixtures/modules/stdlib/spec/functions/getparam_spec.rb +76 -0
  387. data/spec/fixtures/modules/stdlib/spec/functions/getvar_spec.rb +37 -0
  388. data/spec/fixtures/modules/stdlib/spec/functions/grep_spec.rb +19 -0
  389. data/spec/fixtures/modules/stdlib/spec/functions/has_interface_with_spec.rb +64 -0
  390. data/spec/fixtures/modules/stdlib/spec/functions/has_ip_address_spec.rb +39 -0
  391. data/spec/fixtures/modules/stdlib/spec/functions/has_ip_network_spec.rb +36 -0
  392. data/spec/fixtures/modules/stdlib/spec/functions/has_key_spec.rb +42 -0
  393. data/spec/fixtures/modules/stdlib/spec/functions/hash_spec.rb +19 -0
  394. data/spec/fixtures/modules/stdlib/spec/functions/intersection_spec.rb +19 -0
  395. data/spec/fixtures/modules/stdlib/spec/functions/is_array_spec.rb +29 -0
  396. data/spec/fixtures/modules/stdlib/spec/functions/is_bool_spec.rb +44 -0
  397. data/spec/fixtures/modules/stdlib/spec/functions/is_domain_name_spec.rb +81 -0
  398. data/spec/fixtures/modules/stdlib/spec/functions/is_float_spec.rb +33 -0
  399. data/spec/fixtures/modules/stdlib/spec/functions/is_function_available.rb +31 -0
  400. data/spec/fixtures/modules/stdlib/spec/functions/is_hash_spec.rb +29 -0
  401. data/spec/fixtures/modules/stdlib/spec/functions/is_integer_spec.rb +69 -0
  402. data/spec/fixtures/modules/stdlib/spec/functions/is_ip_address_spec.rb +39 -0
  403. data/spec/fixtures/modules/stdlib/spec/functions/is_mac_address_spec.rb +29 -0
  404. data/spec/fixtures/modules/stdlib/spec/functions/is_numeric_spec.rb +119 -0
  405. data/spec/fixtures/modules/stdlib/spec/functions/is_string_spec.rb +34 -0
  406. data/spec/fixtures/modules/stdlib/spec/functions/join_keys_to_values_spec.rb +40 -0
  407. data/spec/fixtures/modules/stdlib/spec/functions/join_spec.rb +19 -0
  408. data/spec/fixtures/modules/stdlib/spec/functions/keys_spec.rb +21 -0
  409. data/spec/fixtures/modules/stdlib/spec/functions/loadyaml_spec.rb +25 -0
  410. data/spec/fixtures/modules/stdlib/spec/functions/lstrip_spec.rb +28 -0
  411. data/spec/fixtures/modules/stdlib/spec/functions/max_spec.rb +27 -0
  412. data/spec/fixtures/modules/stdlib/spec/functions/member_spec.rb +34 -0
  413. data/spec/fixtures/modules/stdlib/spec/functions/merge_spec.rb +52 -0
  414. data/spec/fixtures/modules/stdlib/spec/functions/min_spec.rb +27 -0
  415. data/spec/fixtures/modules/stdlib/spec/functions/num2bool_spec.rb +67 -0
  416. data/spec/fixtures/modules/stdlib/spec/functions/parsejson_spec.rb +22 -0
  417. data/spec/fixtures/modules/stdlib/spec/functions/parseyaml_spec.rb +24 -0
  418. data/spec/fixtures/modules/stdlib/spec/functions/pick_default_spec.rb +58 -0
  419. data/spec/fixtures/modules/stdlib/spec/functions/pick_spec.rb +34 -0
  420. data/spec/fixtures/modules/stdlib/spec/functions/prefix_spec.rb +33 -0
  421. data/spec/fixtures/modules/stdlib/spec/functions/private_spec.rb +60 -0
  422. data/spec/fixtures/modules/stdlib/spec/functions/pw_hash_spec.rb +96 -0
  423. data/spec/fixtures/modules/stdlib/spec/functions/range_spec.rb +86 -0
  424. data/spec/fixtures/modules/stdlib/spec/functions/reject_spec.rb +20 -0
  425. data/spec/fixtures/modules/stdlib/spec/functions/reverse_spec.rb +28 -0
  426. data/spec/fixtures/modules/stdlib/spec/functions/rstrip_spec.rb +33 -0
  427. data/spec/fixtures/modules/stdlib/spec/functions/shuffle_spec.rb +33 -0
  428. data/spec/fixtures/modules/stdlib/spec/functions/size_spec.rb +24 -0
  429. data/spec/fixtures/modules/stdlib/spec/functions/sort_spec.rb +24 -0
  430. data/spec/fixtures/modules/stdlib/spec/functions/squeeze_spec.rb +24 -0
  431. data/spec/fixtures/modules/stdlib/spec/functions/str2bool_spec.rb +31 -0
  432. data/spec/fixtures/modules/stdlib/spec/functions/str2saltedsha512_spec.rb +45 -0
  433. data/spec/fixtures/modules/stdlib/spec/functions/strftime_spec.rb +29 -0
  434. data/spec/fixtures/modules/stdlib/spec/functions/strip_spec.rb +27 -0
  435. data/spec/fixtures/modules/stdlib/spec/functions/suffix_spec.rb +27 -0
  436. data/spec/fixtures/modules/stdlib/spec/functions/swapcase_spec.rb +28 -0
  437. data/spec/fixtures/modules/stdlib/spec/functions/time_spec.rb +29 -0
  438. data/spec/fixtures/modules/stdlib/spec/functions/to_bytes_spec.rb +83 -0
  439. data/spec/fixtures/modules/stdlib/spec/functions/type3x_spec.rb +43 -0
  440. data/spec/fixtures/modules/stdlib/spec/functions/type_spec.rb +44 -0
  441. data/spec/fixtures/modules/stdlib/spec/functions/union_spec.rb +19 -0
  442. data/spec/fixtures/modules/stdlib/spec/functions/unique_spec.rb +33 -0
  443. data/spec/fixtures/modules/stdlib/spec/functions/upcase_spec.rb +58 -0
  444. data/spec/fixtures/modules/stdlib/spec/functions/uriescape_spec.rb +40 -0
  445. data/spec/fixtures/modules/stdlib/spec/functions/validate_absolute_path_spec.rb +104 -0
  446. data/spec/fixtures/modules/stdlib/spec/functions/validate_array_spec.rb +38 -0
  447. data/spec/fixtures/modules/stdlib/spec/functions/validate_augeas_spec.rb +103 -0
  448. data/spec/fixtures/modules/stdlib/spec/functions/validate_bool_spec.rb +51 -0
  449. data/spec/fixtures/modules/stdlib/spec/functions/validate_cmd_spec.rb +85 -0
  450. data/spec/fixtures/modules/stdlib/spec/functions/validate_hash_spec.rb +43 -0
  451. data/spec/fixtures/modules/stdlib/spec/functions/validate_integer_spec.rb +219 -0
  452. data/spec/fixtures/modules/stdlib/spec/functions/validate_ipv4_address_spec.rb +64 -0
  453. data/spec/fixtures/modules/stdlib/spec/functions/validate_ipv6_address_spec.rb +67 -0
  454. data/spec/fixtures/modules/stdlib/spec/functions/validate_numeric_spec.rb +217 -0
  455. data/spec/fixtures/modules/stdlib/spec/functions/validate_re_spec.rb +77 -0
  456. data/spec/fixtures/modules/stdlib/spec/functions/validate_slength_spec.rb +67 -0
  457. data/spec/fixtures/modules/stdlib/spec/functions/validate_string_spec.rb +60 -0
  458. data/spec/fixtures/modules/stdlib/spec/functions/values_at_spec.rb +38 -0
  459. data/spec/fixtures/modules/stdlib/spec/functions/values_spec.rb +31 -0
  460. data/spec/fixtures/modules/stdlib/spec/functions/zip_spec.rb +31 -0
  461. data/spec/fixtures/modules/stdlib/spec/lib/puppet_spec/compiler.rb +47 -0
  462. data/spec/fixtures/modules/stdlib/spec/lib/puppet_spec/database.rb +30 -0
  463. data/spec/fixtures/modules/stdlib/spec/lib/puppet_spec/files.rb +61 -0
  464. data/spec/fixtures/modules/stdlib/spec/lib/puppet_spec/fixtures.rb +29 -0
  465. data/spec/fixtures/modules/stdlib/spec/lib/puppet_spec/matchers.rb +121 -0
  466. data/spec/fixtures/modules/stdlib/spec/lib/puppet_spec/modules.rb +27 -0
  467. data/spec/fixtures/modules/stdlib/spec/lib/puppet_spec/pops.rb +17 -0
  468. data/spec/fixtures/modules/stdlib/spec/lib/puppet_spec/scope.rb +15 -0
  469. data/spec/fixtures/modules/stdlib/spec/lib/puppet_spec/settings.rb +16 -0
  470. data/spec/fixtures/modules/stdlib/spec/lib/puppet_spec/verbose.rb +10 -0
  471. data/spec/fixtures/modules/stdlib/spec/monkey_patches/alias_should_to_must.rb +9 -0
  472. data/spec/fixtures/modules/stdlib/spec/monkey_patches/publicize_methods.rb +11 -0
  473. data/spec/fixtures/modules/stdlib/spec/spec.opts +6 -0
  474. data/spec/fixtures/modules/stdlib/spec/spec_helper.rb +34 -0
  475. data/spec/fixtures/modules/stdlib/spec/spec_helper_acceptance.rb +50 -0
  476. data/spec/fixtures/modules/stdlib/spec/unit/facter/facter_dot_d_spec.rb +32 -0
  477. data/spec/fixtures/modules/stdlib/spec/unit/facter/pe_version_spec.rb +76 -0
  478. data/spec/fixtures/modules/stdlib/spec/unit/facter/root_home_spec.rb +52 -0
  479. data/spec/fixtures/modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb +36 -0
  480. data/spec/fixtures/modules/stdlib/spec/unit/puppet/functions/type_of_spec.rb +33 -0
  481. data/spec/fixtures/modules/stdlib/spec/unit/puppet/parser/functions/basename_spec.rb +46 -0
  482. data/spec/fixtures/modules/stdlib/spec/unit/puppet/parser/functions/bool2str_spec.rb +46 -0
  483. data/spec/fixtures/modules/stdlib/spec/unit/puppet/parser/functions/camelcase_spec.rb +24 -0
  484. data/spec/fixtures/modules/stdlib/spec/unit/puppet/provider/file_line/ruby_spec.rb +277 -0
  485. data/spec/fixtures/modules/stdlib/spec/unit/puppet/type/anchor_spec.rb +11 -0
  486. data/spec/fixtures/modules/stdlib/spec/unit/puppet/type/file_line_spec.rb +70 -0
  487. data/spec/fixtures/modules/stdlib/tests/file_line.pp +9 -0
  488. data/spec/fixtures/modules/stdlib/tests/has_interface_with.pp +10 -0
  489. data/spec/fixtures/modules/stdlib/tests/has_ip_address.pp +3 -0
  490. data/spec/fixtures/modules/stdlib/tests/has_ip_network.pp +4 -0
  491. data/spec/fixtures/modules/stdlib/tests/init.pp +1 -0
  492. data/spec/fixtures/modules/tomcat/.gitignore +8 -0
  493. data/spec/fixtures/modules/tomcat/.puppet-lint.rc +8 -0
  494. data/spec/fixtures/modules/tomcat/.travis.yml +14 -0
  495. data/spec/fixtures/modules/tomcat/CHANGELOG.md +94 -0
  496. data/spec/fixtures/modules/tomcat/CONTRIBUTING.md +220 -0
  497. data/spec/fixtures/modules/tomcat/LICENSE +15 -0
  498. data/spec/fixtures/modules/tomcat/README.markdown +75 -0
  499. data/spec/fixtures/modules/tomcat/README.md +812 -0
  500. data/spec/fixtures/modules/tomcat/Vagrantfile +95 -0
  501. data/spec/fixtures/modules/tomcat/checksums.json +67 -0
  502. data/spec/fixtures/modules/tomcat/examples/default_install_from_package.pp +13 -0
  503. data/spec/fixtures/modules/tomcat/examples/default_install_from_source.pp +9 -0
  504. data/spec/fixtures/modules/tomcat/examples/instance_with_context.pp +20 -0
  505. data/spec/fixtures/modules/tomcat/examples/instance_with_listener.pp +18 -0
  506. data/spec/fixtures/modules/tomcat/examples/instance_with_realm.pp +20 -0
  507. data/spec/fixtures/modules/tomcat/examples/instance_with_role_and_user.pp +23 -0
  508. data/spec/fixtures/modules/tomcat/examples/jsvc_install_from_source.pp +37 -0
  509. data/spec/fixtures/modules/tomcat/examples/multiple_instances.pp +38 -0
  510. data/spec/fixtures/modules/tomcat/manifests/config/server.pp +78 -0
  511. data/spec/fixtures/modules/tomcat/manifests/config/server/connector.pp +95 -0
  512. data/spec/fixtures/modules/tomcat/manifests/config/server/context.pp +102 -0
  513. data/spec/fixtures/modules/tomcat/manifests/config/server/engine.pp +109 -0
  514. data/spec/fixtures/modules/tomcat/manifests/config/server/host.pp +79 -0
  515. data/spec/fixtures/modules/tomcat/manifests/config/server/listener.pp +98 -0
  516. data/spec/fixtures/modules/tomcat/manifests/config/server/realm.pp +104 -0
  517. data/spec/fixtures/modules/tomcat/manifests/config/server/service.pp +54 -0
  518. data/spec/fixtures/modules/tomcat/manifests/config/server/tomcat_users.pp +97 -0
  519. data/spec/fixtures/modules/tomcat/manifests/config/server/valve.pp +77 -0
  520. data/spec/fixtures/modules/tomcat/manifests/init.pp +71 -0
  521. data/spec/fixtures/modules/tomcat/manifests/instance.pp +88 -0
  522. data/spec/fixtures/modules/tomcat/manifests/instance/package.pp +26 -0
  523. data/spec/fixtures/modules/tomcat/manifests/instance/source.pp +46 -0
  524. data/spec/fixtures/modules/tomcat/manifests/params.pp +13 -0
  525. data/spec/fixtures/modules/tomcat/manifests/service.pp +160 -0
  526. data/spec/fixtures/modules/tomcat/manifests/setenv/entry.pp +52 -0
  527. data/spec/fixtures/modules/tomcat/manifests/war.pp +80 -0
  528. data/spec/fixtures/modules/tomcat/metadata.json +74 -0
  529. data/spec/spec_helper.rb +1 -1
  530. data/spec/unit/plugin_spec.rb +21 -0
  531. data/spec/unit/puppet-retrospec_spec.rb +36 -29
  532. data/spec/unit/resource_spec.rb +0 -1
  533. data/spec/unit/type_code_spec.rb +0 -1
  534. metadata +540 -18
  535. data/bin/retrospec +0 -29
  536. data/lib/retrospec.rb +0 -205
  537. data/lib/retrospec/exceptions.rb +0 -4
  538. data/lib/retrospec/helpers.rb +0 -157
  539. data/lib/retrospec/version.rb +0 -3
@@ -0,0 +1,67 @@
1
+ #! /usr/bin/env ruby -S rspec
2
+
3
+ require "spec_helper"
4
+
5
+ describe Puppet::Parser::Functions.function(:validate_ipv6_address) do
6
+ let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
7
+
8
+ describe "when calling validate_ipv6_address from puppet" do
9
+ describe "when given IPv6 address strings" do
10
+ it "should compile with one argument" do
11
+ Puppet[:code] = "validate_ipv6_address('3ffe:0505:0002::')"
12
+ scope.compiler.compile
13
+ end
14
+
15
+ it "should compile with multiple arguments" do
16
+ Puppet[:code] = "validate_ipv6_address('3ffe:0505:0002::', '3ffe:0505:0001::')"
17
+ scope.compiler.compile
18
+ end
19
+ end
20
+
21
+ describe "when given an ipv4 address" do
22
+ it "should not compile" do
23
+ Puppet[:code] = "validate_ipv6_address('1.2.3.4')"
24
+ expect {
25
+ scope.compiler.compile
26
+ }.to raise_error(Puppet::ParseError, /not a valid IPv6 address/)
27
+ end
28
+ end
29
+
30
+ describe "when given other strings" do
31
+ it "should not compile" do
32
+ Puppet[:code] = "validate_ipv6_address('hello', 'world')"
33
+ expect {
34
+ scope.compiler.compile
35
+ }.to raise_error(Puppet::ParseError, /not a valid IPv6 address/)
36
+ end
37
+ end
38
+
39
+ # 1.8.7 is EOL'd and also absolutely insane about ipv6
40
+ unless RUBY_VERSION == '1.8.7'
41
+ describe "when given numbers" do
42
+ it "should not compile" do
43
+ Puppet[:code] = "validate_ipv6_address(1, 2)"
44
+ expect {
45
+ scope.compiler.compile
46
+ }.to raise_error(Puppet::ParseError, /not a valid IPv6 address/)
47
+ end
48
+ end
49
+ end
50
+
51
+ describe "when given booleans" do
52
+ it "should not compile" do
53
+ Puppet[:code] = "validate_ipv6_address(true, false)"
54
+ expect {
55
+ scope.compiler.compile
56
+ }.to raise_error(Puppet::ParseError, /is not a string/)
57
+ end
58
+ end
59
+
60
+ it "should not compile when no arguments are passed" do
61
+ Puppet[:code] = "validate_ipv6_address()"
62
+ expect {
63
+ scope.compiler.compile
64
+ }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,217 @@
1
+ #! /usr/bin/env ruby -S rspec
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Parser::Functions.function(:validate_numeric) do
6
+ let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
7
+
8
+ describe 'when calling validate_numeric from puppet without any argument or to many' do
9
+ it "should not compile when no argument is passed" do
10
+ Puppet[:code] = "validate_numeric()"
11
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /Wrong number of arguments/)
12
+ end
13
+ it "should not compile when more than three arguments are passed" do
14
+ Puppet[:code] = "validate_numeric(1, 1, 1, 1)"
15
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /Wrong number of arguments/)
16
+ end
17
+ end
18
+
19
+ describe 'when calling validate_numeric from puppet only with input' do
20
+ %w{ 1 -1 1.0 -1.0 }.each do |the_number|
21
+ it "should compile when #{the_number} is an encapsulated numeric" do
22
+ Puppet[:code] = "validate_numeric('#{the_number}')"
23
+ scope.compiler.compile
24
+ end
25
+ it "should compile when #{the_number} is a bare numeric" do
26
+ Puppet[:code] = "validate_numeric(#{the_number})"
27
+ scope.compiler.compile
28
+ end
29
+ end
30
+
31
+ %w{ [1,2,3,4,5] ['1','2','3','4','5'] [1.1,2.2,3.3,4.4,5.5] ['1.1','2.2','3.3','4.4','5.5'] }.each do |the_number|
32
+ it "should compile when multiple Numeric arguments are passed in an Array" do
33
+ Puppet[:code] = "validate_numeric(#{the_number})"
34
+ scope.compiler.compile
35
+ end
36
+ end
37
+
38
+ %w{ true false iAmAString 1test }.each do |the_number|
39
+ it "should not compile when #{the_number} is in a string" do
40
+ Puppet[:code] = "validate_numeric('#{the_number}')"
41
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be a Numeric/)
42
+ end
43
+
44
+ it "should not compile when #{the_number} is a bare word" do
45
+ Puppet[:code] = "validate_numeric(#{the_number})"
46
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be a Numeric/)
47
+ end
48
+ end
49
+
50
+ it "should not compile when a Numeric is part of a larger String" do
51
+ Puppet[:code] = "validate_numeric('1.0 test')"
52
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be a Numeric/)
53
+ end
54
+
55
+ it "should not compile when an Array with a non-Numeric value is passed" do
56
+ Puppet[:code] = "validate_numeric([1, 'test'])"
57
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /at array position 1 to be a Numeric/)
58
+ end
59
+
60
+ it "should not compile when a Hash is passed" do
61
+ Puppet[:code] = "validate_numeric({ 1 => 2 })"
62
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be a Numeric or Array/)
63
+ end
64
+
65
+ it "should not compile when an explicitly undef variable is passed" do
66
+ Puppet[:code] = <<-'ENDofPUPPETcode'
67
+ $foo = undef
68
+ validate_numeric($foo)
69
+ ENDofPUPPETcode
70
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be a Numeric/)
71
+ end
72
+
73
+ it "should not compile when an undefined variable is passed" do
74
+ Puppet[:code] = 'validate_numeric($foobarbazishouldnotexist)'
75
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be a Numeric/)
76
+ end
77
+ end
78
+
79
+ describe 'when calling validate_numeric from puppet with input and a maximum' do
80
+ max = 10
81
+ %w{ 1 -1 1.0 -1.0 }.each do |the_number|
82
+ it "should compile when #{the_number} is lower than a maximum of #{max}" do
83
+ Puppet[:code] = "validate_numeric(#{the_number},#{max})"
84
+ scope.compiler.compile
85
+ end
86
+ end
87
+
88
+ it "should compile when a Numeric is equal the maximum" do
89
+ Puppet[:code] = "validate_numeric(#{max},#{max})"
90
+ scope.compiler.compile
91
+ end
92
+
93
+ it "should not compile when #{max+1} is greater than a maximum of #{max}" do
94
+ Puppet[:code] = "validate_numeric(#{max+1},#{max})"
95
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be smaller or equal to/)
96
+ end
97
+
98
+ %w{ [-10,1,2,3,4,5,10] ['-10','1','2','3','4','5','10'] }.each do |the_number|
99
+ it "should compile when each element of #{the_number} is lower than a maximum of #{max}" do
100
+ Puppet[:code] = "validate_numeric(#{the_number},#{max})"
101
+ scope.compiler.compile
102
+ end
103
+ end
104
+
105
+ it "should not compile when an element of an Array [-10,1,2,3,4,5,#{max+1}] is greater than a maximum of #{max}" do
106
+ Puppet[:code] = "validate_numeric([-10,1,2,3,4,5,#{max+1}],#{max})"
107
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be smaller or equal to/)
108
+ end
109
+
110
+ %w{ true false iAmAString 1test }.each do |the_max|
111
+ it "should not compile when a non-Numeric maximum #{the_max}, encapsulated in a String, is passed" do
112
+ Puppet[:code] = "validate_numeric(1,'#{the_max}')"
113
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be unset or a Numeric/)
114
+ end
115
+
116
+ it "should not compile when a non-Numeric maximum #{the_max} bare word is passed" do
117
+ Puppet[:code] = "validate_numeric(1,#{the_max})"
118
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be unset or a Numeric/)
119
+ end
120
+ end
121
+
122
+ it "should not compile when an explicitly undefined variable is passed as maximum and no minimum is passed" do
123
+ Puppet[:code] = <<-'ENDofPUPPETcode'
124
+ $foo = undef
125
+ validate_numeric(10, $foo)
126
+ ENDofPUPPETcode
127
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be unset or a Numeric/)
128
+ end
129
+ it "should not compile when an explicitly undef is passed as maximum and no minimum is passed" do
130
+ Puppet[:code] = "validate_numeric(10, undef)"
131
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be unset or a Numeric/)
132
+ end
133
+ it "should not compile when an empty string is passed as maximum and no minimum is passed" do
134
+ Puppet[:code] = "validate_numeric(10, '')"
135
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be unset or a Numeric/)
136
+ end
137
+ it "should not compile when an undefined variable for a maximum is passed" do
138
+ Puppet[:code] = "validate_numeric(10, $foobarbazishouldnotexist)"
139
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be unset or a Numeric/)
140
+ end
141
+ end
142
+
143
+ describe 'when calling validate_numeric from puppet with input, a maximum and a minimum' do
144
+ it "should not compile when a minimum larger than maximum is passed" do
145
+ Puppet[:code] = "validate_numeric(1,1,2)"
146
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /second argument to be larger than third argument/)
147
+ end
148
+
149
+ max = 10
150
+ min = -10
151
+ %w{ 1 -1 }.each do |the_number|
152
+ it "should compile when each element of #{the_number} is within a range from #{min} to #{max}" do
153
+ Puppet[:code] = "validate_numeric(#{the_number},#{max},#{min})"
154
+ scope.compiler.compile
155
+ end
156
+ end
157
+
158
+ it "should compile when a Numeric is equal the minimum" do
159
+ Puppet[:code] = "validate_numeric(#{min},#{max},#{min})"
160
+ scope.compiler.compile
161
+ end
162
+
163
+ it "should compile when a Numeric is equal the minimum and maximum" do
164
+ Puppet[:code] = "validate_numeric(#{max},#{max},#{max})"
165
+ scope.compiler.compile
166
+ end
167
+
168
+ it "should compile when an empty maximum is passed and the Numeric is greater than the minimum" do
169
+ Puppet[:code] = "validate_numeric(#{max}.1,'',#{min})"
170
+ scope.compiler.compile
171
+ end
172
+ it "should compile when an explicitly undefined maximum is passed and the Numeric is greater than the minimum" do
173
+ Puppet[:code] = "validate_numeric(#{max}.1,undef,#{min})"
174
+ scope.compiler.compile
175
+ end
176
+ it "should compile when an explicitly undefined variable is passed for maximum and the Numeric is greater than the minimum" do
177
+ Puppet[:code] = <<-"ENDofPUPPETcode"
178
+ $foo = undef
179
+ validate_numeric(#{max}.1, $foo, #{min})
180
+ ENDofPUPPETcode
181
+ scope.compiler.compile
182
+ end
183
+ it "should not compile when no maximum value is given and the Numeric is greater than the minimum" do
184
+ Puppet[:code] = "validate_numeric(#{max}.1,,#{min})"
185
+ expect { scope.compiler.compile }.to raise_error(Puppet::Error, /Syntax error at ','/)
186
+ end
187
+
188
+ it "should not compile when #{min-1} is lower than a minimum of #{min}" do
189
+ Puppet[:code] = "validate_numeric(#{min-1.0},#{max},#{min})"
190
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be greater or equal to/)
191
+ end
192
+
193
+ %w{ [-10,1,2,3,4,5,10] ['-10.0','1','2','3','4','5','10.0'] }.each do |the_number|
194
+ it "should compile when each element of #{the_number} is within a range from #{min} to #{max}" do
195
+ Puppet[:code] = "validate_numeric(#{the_number},#{max},#{min})"
196
+ scope.compiler.compile
197
+ end
198
+ end
199
+
200
+ it "should not compile when an element of an Array [#{min-1.1},1,2,3,4,5,10.0] is lower than a minimum of #{min}" do
201
+ Puppet[:code] = "validate_numeric([#{min-1},1,2,3,4,5,10],#{max},#{min})"
202
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be greater or equal to/)
203
+ end
204
+
205
+ %w{ true false iAmAString 1test }.each do |the_min|
206
+ it "should not compile when a non-Numeric minimum #{the_min}, encapsulated in a String, is passed" do
207
+ Puppet[:code] = "validate_numeric(1,#{max},'#{the_min}')"
208
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be unset or a Numeric/)
209
+ end
210
+
211
+ it "should not compile when a non-Numeric minimum #{the_min} bare word is passed" do
212
+ Puppet[:code] = "validate_numeric(1,#{max},#{the_min})"
213
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be unset or a Numeric/)
214
+ end
215
+ end
216
+ end
217
+ end
@@ -0,0 +1,77 @@
1
+ #! /usr/bin/env ruby -S rspec
2
+ require 'spec_helper'
3
+
4
+ describe Puppet::Parser::Functions.function(:validate_re) do
5
+ let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6
+
7
+ # The subject of these examplres is the method itself.
8
+ subject do
9
+ # This makes sure the function is loaded within each test
10
+ function_name = Puppet::Parser::Functions.function(:validate_re)
11
+ scope.method(function_name)
12
+ end
13
+
14
+ context 'Using Puppet::Parser::Scope.new' do
15
+
16
+ describe 'Garbage inputs' do
17
+ inputs = [
18
+ [ nil ],
19
+ [ [ nil ] ],
20
+ [ { 'foo' => 'bar' } ],
21
+ [ { } ],
22
+ [ '' ],
23
+ [ "one", "one", "MSG to User", "4th arg" ],
24
+ ]
25
+
26
+ inputs.each do |input|
27
+ it "validate_re(#{input.inspect}) should fail" do
28
+ expect { subject.call [input] }.to raise_error Puppet::ParseError
29
+ end
30
+ end
31
+ end
32
+
33
+ describe 'Valid inputs' do
34
+ inputs = [
35
+ [ '/full/path/to/something', '^/full' ],
36
+ [ '/full/path/to/something', 'full' ],
37
+ [ '/full/path/to/something', ['full', 'absent'] ],
38
+ [ '/full/path/to/something', ['full', 'absent'], 'Message to the user' ],
39
+ ]
40
+
41
+ inputs.each do |input|
42
+ it "validate_re(#{input.inspect}) should not fail" do
43
+ expect { subject.call input }.not_to raise_error
44
+ end
45
+ end
46
+ end
47
+ describe "Valid inputs which should raise an exception without a message" do
48
+ # The intent here is to make sure valid inputs raise exceptions when they
49
+ # don't specify an error message to display. This is the behvior in
50
+ # 2.2.x and prior.
51
+ inputs = [
52
+ [ "hello", [ "bye", "later", "adios" ] ],
53
+ [ "greetings", "salutations" ],
54
+ ]
55
+
56
+ inputs.each do |input|
57
+ it "validate_re(#{input.inspect}) should fail" do
58
+ expect { subject.call input }.to raise_error /validate_re.*?does not match/
59
+ end
60
+ end
61
+ end
62
+ describe "Nicer Error Messages" do
63
+ # The intent here is to make sure the function returns the 3rd argument
64
+ # in the exception thrown
65
+ inputs = [
66
+ [ "hello", [ "bye", "later", "adios" ], "MSG to User" ],
67
+ [ "greetings", "salutations", "Error, greetings does not match salutations" ],
68
+ ]
69
+
70
+ inputs.each do |input|
71
+ it "validate_re(#{input.inspect}) should fail" do
72
+ expect { subject.call input }.to raise_error /#{input[2]}/
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,67 @@
1
+ #! /usr/bin/env ruby -S rspec
2
+
3
+ require 'spec_helper'
4
+
5
+ describe "the validate_slength function" do
6
+ let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
7
+
8
+ it "should exist" do
9
+ expect(Puppet::Parser::Functions.function("validate_slength")).to eq("function_validate_slength")
10
+ end
11
+
12
+ describe "validating the input argument types" do
13
+ it "raises an error if there are less than two arguments" do
14
+ expect { scope.function_validate_slength([]) }.to raise_error Puppet::ParseError, /Wrong number of arguments/
15
+ end
16
+
17
+ it "raises an error if there are more than three arguments" do
18
+ expect { scope.function_validate_slength(['input', 1, 2, 3]) }.to raise_error Puppet::ParseError, /Wrong number of arguments/
19
+ end
20
+
21
+ it "raises an error if the first argument is not a string" do
22
+ expect { scope.function_validate_slength([Object.new, 2, 1]) }.to raise_error Puppet::ParseError, /Expected first argument.*got .*Object/
23
+ end
24
+
25
+ it "raises an error if the second argument cannot be cast to an Integer" do
26
+ expect { scope.function_validate_slength(['input', Object.new]) }.to raise_error Puppet::ParseError, /Expected second argument.*got .*Object/
27
+ end
28
+
29
+ it "raises an error if the third argument cannot be cast to an Integer" do
30
+ expect { scope.function_validate_slength(['input', 1, Object.new]) }.to raise_error Puppet::ParseError, /Expected third argument.*got .*Object/
31
+ end
32
+
33
+ it "raises an error if the second argument is smaller than the third argument" do
34
+ expect { scope.function_validate_slength(['input', 1, 2]) }.to raise_error Puppet::ParseError, /Expected second argument to be larger than third argument/
35
+ end
36
+ end
37
+
38
+ describe "validating the input string length" do
39
+ describe "when the input is a string" do
40
+ it "fails validation if the string is larger than the max length" do
41
+ expect { scope.function_validate_slength(['input', 1]) }.to raise_error Puppet::ParseError, /Expected length .* between 0 and 1, was 5/
42
+ end
43
+
44
+ it "fails validation if the string is less than the min length" do
45
+ expect { scope.function_validate_slength(['input', 10, 6]) }.to raise_error Puppet::ParseError, /Expected length .* between 6 and 10, was 5/
46
+ end
47
+
48
+ it "doesn't raise an error if the string is under the max length" do
49
+ scope.function_validate_slength(['input', 10])
50
+ end
51
+
52
+ it "doesn't raise an error if the string is equal to the max length" do
53
+ scope.function_validate_slength(['input', 5])
54
+ end
55
+
56
+ it "doesn't raise an error if the string is equal to the min length" do
57
+ scope.function_validate_slength(['input', 10, 5])
58
+ end
59
+ end
60
+
61
+ describe "when the input is an array" do
62
+ it "fails validation if one of the array elements is not a string" do
63
+ expect { scope.function_validate_slength([["a", "b", Object.new], 2]) }.to raise_error Puppet::ParseError, /Expected element at array position 2 .*String, got .*Object/
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,60 @@
1
+ #! /usr/bin/env ruby -S rspec
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Parser::Functions.function(:validate_string) do
6
+ let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
7
+
8
+ describe 'when calling validate_string from puppet' do
9
+
10
+ %w{ foo bar baz }.each do |the_string|
11
+
12
+ it "should compile when #{the_string} is a string" do
13
+ Puppet[:code] = "validate_string('#{the_string}')"
14
+ scope.compiler.compile
15
+ end
16
+
17
+ it "should compile when #{the_string} is a bare word" do
18
+ Puppet[:code] = "validate_string(#{the_string})"
19
+ scope.compiler.compile
20
+ end
21
+
22
+ end
23
+
24
+ %w{ true false }.each do |the_string|
25
+ it "should compile when #{the_string} is a string" do
26
+ Puppet[:code] = "validate_string('#{the_string}')"
27
+ scope.compiler.compile
28
+ end
29
+
30
+ it "should not compile when #{the_string} is a bare word" do
31
+ Puppet[:code] = "validate_string(#{the_string})"
32
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a string/)
33
+ end
34
+ end
35
+
36
+ it "should compile when multiple string arguments are passed" do
37
+ Puppet[:code] = <<-'ENDofPUPPETcode'
38
+ $foo = ''
39
+ $bar = 'two'
40
+ validate_string($foo, $bar)
41
+ ENDofPUPPETcode
42
+ scope.compiler.compile
43
+ end
44
+
45
+ it "should compile when an explicitly undef variable is passed (NOTE THIS MAY NOT BE DESIRABLE)" do
46
+ Puppet[:code] = <<-'ENDofPUPPETcode'
47
+ $foo = undef
48
+ validate_string($foo)
49
+ ENDofPUPPETcode
50
+ scope.compiler.compile
51
+ end
52
+
53
+ it "should compile when an undefined variable is passed (NOTE THIS MAY NOT BE DESIRABLE)" do
54
+ Puppet[:code] = <<-'ENDofPUPPETcode'
55
+ validate_string($foobarbazishouldnotexist)
56
+ ENDofPUPPETcode
57
+ scope.compiler.compile
58
+ end
59
+ end
60
+ end