summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rwxr-xr-xspec/acceptance/abs_spec.rb2
-rwxr-xr-xspec/acceptance/anchor_spec.rb2
-rwxr-xr-xspec/acceptance/any2array_spec.rb2
-rwxr-xr-xspec/acceptance/base64_spec.rb2
-rwxr-xr-xspec/acceptance/bool2num_spec.rb2
-rwxr-xr-xspec/acceptance/capitalize_spec.rb2
-rwxr-xr-xspec/acceptance/ceiling_spec.rb2
-rwxr-xr-xspec/acceptance/chomp_spec.rb2
-rwxr-xr-xspec/acceptance/chop_spec.rb2
-rwxr-xr-xspec/acceptance/clamp_spec.rb2
-rwxr-xr-xspec/acceptance/concat_spec.rb2
-rwxr-xr-xspec/acceptance/count_spec.rb2
-rwxr-xr-xspec/acceptance/deep_merge_spec.rb2
-rwxr-xr-xspec/acceptance/defined_with_params_spec.rb2
-rwxr-xr-xspec/acceptance/delete_at_spec.rb2
-rwxr-xr-xspec/acceptance/delete_spec.rb2
-rwxr-xr-xspec/acceptance/delete_undef_values_spec.rb2
-rwxr-xr-xspec/acceptance/delete_values_spec.rb2
-rwxr-xr-xspec/acceptance/difference_spec.rb2
-rwxr-xr-xspec/acceptance/dirname_spec.rb2
-rwxr-xr-xspec/acceptance/downcase_spec.rb2
-rwxr-xr-xspec/acceptance/empty_spec.rb2
-rwxr-xr-xspec/acceptance/flatten_spec.rb2
-rwxr-xr-xspec/acceptance/floor_spec.rb2
-rw-r--r--spec/acceptance/fqdn_rand_string_spec.rb2
-rwxr-xr-xspec/acceptance/fqdn_rotate_spec.rb2
-rwxr-xr-xspec/acceptance/get_module_path_spec.rb2
-rwxr-xr-xspec/acceptance/getparam_spec.rb2
-rwxr-xr-xspec/acceptance/getvar_spec.rb2
-rwxr-xr-xspec/acceptance/grep_spec.rb2
-rwxr-xr-xspec/acceptance/has_interface_with_spec.rb2
-rwxr-xr-xspec/acceptance/has_ip_address_spec.rb2
-rwxr-xr-xspec/acceptance/has_ip_network_spec.rb2
-rwxr-xr-xspec/acceptance/has_key_spec.rb2
-rwxr-xr-xspec/acceptance/hash_spec.rb2
-rwxr-xr-xspec/acceptance/intersection_spec.rb2
-rw-r--r--spec/acceptance/is_a_spec.rb2
-rwxr-xr-xspec/acceptance/is_array_spec.rb2
-rwxr-xr-xspec/acceptance/is_bool_spec.rb2
-rwxr-xr-xspec/acceptance/is_domain_name_spec.rb2
-rwxr-xr-xspec/acceptance/is_float_spec.rb2
-rwxr-xr-xspec/acceptance/is_function_available_spec.rb2
-rwxr-xr-xspec/acceptance/is_hash_spec.rb2
-rwxr-xr-xspec/acceptance/is_integer_spec.rb2
-rwxr-xr-xspec/acceptance/is_ip_address_spec.rb2
-rwxr-xr-xspec/acceptance/is_ipv4_address_spec.rb2
-rwxr-xr-xspec/acceptance/is_ipv6_address_spec.rb2
-rwxr-xr-xspec/acceptance/is_mac_address_spec.rb2
-rwxr-xr-xspec/acceptance/is_numeric_spec.rb2
-rwxr-xr-xspec/acceptance/is_string_spec.rb2
-rwxr-xr-xspec/acceptance/join_keys_to_values_spec.rb2
-rwxr-xr-xspec/acceptance/join_spec.rb2
-rwxr-xr-xspec/acceptance/keys_spec.rb2
-rw-r--r--spec/acceptance/loadjson_spec.rb2
-rw-r--r--spec/acceptance/loadyaml_spec.rb2
-rwxr-xr-xspec/acceptance/lstrip_spec.rb2
-rwxr-xr-xspec/acceptance/max_spec.rb2
-rwxr-xr-xspec/acceptance/member_spec.rb2
-rwxr-xr-xspec/acceptance/merge_spec.rb2
-rwxr-xr-xspec/acceptance/min_spec.rb2
-rwxr-xr-xspec/acceptance/num2bool_spec.rb2
-rwxr-xr-xspec/acceptance/parsejson_spec.rb2
-rwxr-xr-xspec/acceptance/parseyaml_spec.rb2
-rwxr-xr-xspec/acceptance/pick_default_spec.rb2
-rwxr-xr-xspec/acceptance/pick_spec.rb2
-rwxr-xr-xspec/acceptance/prefix_spec.rb2
-rw-r--r--spec/acceptance/pw_hash_spec.rb2
-rwxr-xr-xspec/acceptance/range_spec.rb2
-rwxr-xr-xspec/acceptance/reject_spec.rb2
-rwxr-xr-xspec/acceptance/reverse_spec.rb2
-rwxr-xr-xspec/acceptance/rstrip_spec.rb2
-rwxr-xr-xspec/acceptance/shuffle_spec.rb2
-rwxr-xr-xspec/acceptance/size_spec.rb2
-rwxr-xr-xspec/acceptance/sort_spec.rb2
-rwxr-xr-xspec/acceptance/squeeze_spec.rb2
-rwxr-xr-xspec/acceptance/str2bool_spec.rb2
-rwxr-xr-xspec/acceptance/str2saltedsha512_spec.rb2
-rwxr-xr-xspec/acceptance/strftime_spec.rb2
-rwxr-xr-xspec/acceptance/strip_spec.rb2
-rwxr-xr-xspec/acceptance/suffix_spec.rb2
-rwxr-xr-xspec/acceptance/swapcase_spec.rb2
-rwxr-xr-xspec/acceptance/time_spec.rb2
-rwxr-xr-xspec/acceptance/to_bytes_spec.rb2
-rwxr-xr-xspec/acceptance/try_get_value_spec.rb2
-rwxr-xr-xspec/acceptance/type_spec.rb10
-rwxr-xr-xspec/acceptance/union_spec.rb2
-rwxr-xr-xspec/acceptance/unique_spec.rb2
-rwxr-xr-xspec/acceptance/unsupported_spec.rb11
-rwxr-xr-xspec/acceptance/upcase_spec.rb2
-rwxr-xr-xspec/acceptance/uriescape_spec.rb2
-rwxr-xr-xspec/acceptance/validate_absolute_path_spec.rb2
-rwxr-xr-xspec/acceptance/validate_array_spec.rb2
-rwxr-xr-xspec/acceptance/validate_augeas_spec.rb2
-rwxr-xr-xspec/acceptance/validate_bool_spec.rb2
-rwxr-xr-xspec/acceptance/validate_cmd_spec.rb2
-rwxr-xr-xspec/acceptance/validate_hash_spec.rb2
-rwxr-xr-xspec/acceptance/validate_ipv4_address_spec.rb2
-rwxr-xr-xspec/acceptance/validate_ipv6_address_spec.rb2
-rwxr-xr-xspec/acceptance/validate_re_spec.rb2
-rwxr-xr-xspec/acceptance/validate_slength_spec.rb2
-rwxr-xr-xspec/acceptance/validate_string_spec.rb2
-rwxr-xr-xspec/acceptance/values_at_spec.rb2
-rwxr-xr-xspec/acceptance/values_spec.rb9
-rwxr-xr-xspec/acceptance/zip_spec.rb29
-rw-r--r--spec/aliases/absolute_path_spec.rb7
-rw-r--r--spec/aliases/absolutepath_spec.rb49
-rw-r--r--spec/aliases/array_spec.rb2
-rw-r--r--spec/aliases/bool_spec.rb2
-rw-r--r--spec/aliases/float_spec.rb4
-rw-r--r--spec/aliases/hash_spec.rb32
-rw-r--r--spec/aliases/httpsurl_spec.rb8
-rw-r--r--spec/aliases/httpurl_spec.rb8
-rw-r--r--spec/aliases/integer_spec.rb12
-rw-r--r--spec/aliases/ip_address.rb2
-rw-r--r--spec/aliases/ipv4_spec.rb2
-rw-r--r--spec/aliases/ipv6_spec.rb16
-rw-r--r--spec/aliases/numeric_spec.rb4
-rw-r--r--spec/aliases/string_spec.rb4
-rw-r--r--spec/aliases/unixpath_spec.rb10
-rw-r--r--spec/aliases/windowspath_spec.rb9
-rw-r--r--spec/fixtures/test/manifests/deftype.pp3
-rw-r--r--spec/fixtures/test/manifests/hash.pp8
-rwxr-xr-xspec/functions/any2array_spec.rb6
-rwxr-xr-xspec/functions/basename_spec.rb5
-rwxr-xr-xspec/functions/chomp_spec.rb5
-rwxr-xr-xspec/functions/chop_spec.rb5
-rwxr-xr-xspec/functions/concat_spec.rb4
-rwxr-xr-xspec/functions/count_spec.rb5
-rwxr-xr-xspec/functions/deep_merge_spec.rb6
-rwxr-xr-xspec/functions/defined_with_params_spec.rb33
-rwxr-xr-xspec/functions/delete_at_spec.rb2
-rwxr-xr-xspec/functions/delete_spec.rb8
-rwxr-xr-xspec/functions/delete_undef_values_spec.rb1
-rwxr-xr-xspec/functions/delete_values_spec.rb6
-rw-r--r--spec/functions/deprecation_spec.rb4
-rwxr-xr-xspec/functions/difference_spec.rb2
-rw-r--r--spec/functions/dig44_spec.rb26
-rwxr-xr-xspec/functions/dirname_spec.rb5
-rw-r--r--spec/functions/dos2unix_spec.rb17
-rwxr-xr-xspec/functions/ensure_packages_spec.rb27
-rwxr-xr-xspec/functions/ensure_resource_spec.rb44
-rw-r--r--spec/functions/ensure_resources_spec.rb25
-rwxr-xr-xspec/functions/flatten_spec.rb1
-rw-r--r--spec/functions/fqdn_rand_string_spec.rb1
-rwxr-xr-xspec/functions/fqdn_rotate_spec.rb1
-rw-r--r--spec/functions/fqdn_uuid_spec.rb1
-rwxr-xr-xspec/functions/getparam_spec.rb8
-rwxr-xr-xspec/functions/getvar_spec.rb15
-rwxr-xr-xspec/functions/glob_spec.rb11
-rwxr-xr-xspec/functions/grep_spec.rb1
-rwxr-xr-xspec/functions/has_ip_network_spec.rb1
-rwxr-xr-xspec/functions/has_key_spec.rb5
-rwxr-xr-xspec/functions/hash_spec.rb1
-rwxr-xr-xspec/functions/intersection_spec.rb1
-rw-r--r--spec/functions/is_a_spec.rb5
-rwxr-xr-xspec/functions/is_function_available_spec.rb (renamed from spec/functions/is_function_available.rb)0
-rwxr-xr-xspec/functions/is_integer_spec.rb3
-rwxr-xr-xspec/functions/is_mac_address_spec.rb6
-rwxr-xr-xspec/functions/join_keys_to_values_spec.rb7
-rwxr-xr-xspec/functions/join_spec.rb1
-rwxr-xr-xspec/functions/keys_spec.rb5
-rwxr-xr-xspec/functions/length_spec.rb31
-rwxr-xr-xspec/functions/load_module_metadata_spec.rb47
-rw-r--r--spec/functions/loadjson_spec.rb37
-rwxr-xr-xspec/functions/loadyaml_spec.rb4
-rwxr-xr-xspec/functions/lstrip_spec.rb1
-rwxr-xr-xspec/functions/member_spec.rb2
-rwxr-xr-xspec/functions/merge_spec.rb2
-rwxr-xr-xspec/functions/parsejson_spec.rb11
-rwxr-xr-xspec/functions/parseyaml_spec.rb11
-rwxr-xr-xspec/functions/pick_default_spec.rb2
-rwxr-xr-xspec/functions/pick_spec.rb5
-rwxr-xr-xspec/functions/prefix_spec.rb1
-rw-r--r--spec/functions/pw_hash_spec.rb8
-rwxr-xr-xspec/functions/range_spec.rb8
-rw-r--r--spec/functions/regexpescape_spec.rb5
-rwxr-xr-xspec/functions/reject_spec.rb1
-rwxr-xr-xspec/functions/reverse_spec.rb2
-rwxr-xr-xspec/functions/round_spec.rb14
-rwxr-xr-xspec/functions/rstrip_spec.rb1
-rw-r--r--spec/functions/seeded_rand_spec.rb5
-rw-r--r--spec/functions/shell_escape_spec.rb5
-rw-r--r--spec/functions/shell_join_spec.rb5
-rw-r--r--spec/functions/shell_split_spec.rb5
-rwxr-xr-xspec/functions/shuffle_spec.rb5
-rwxr-xr-xspec/functions/size_spec.rb3
-rwxr-xr-xspec/functions/squeeze_spec.rb6
-rwxr-xr-xspec/functions/strftime_spec.rb4
-rwxr-xr-xspec/functions/strip_spec.rb1
-rwxr-xr-xspec/functions/suffix_spec.rb2
-rwxr-xr-xspec/functions/to_json_pretty_spec.rb11
-rwxr-xr-xspec/functions/to_json_spec.rb19
-rwxr-xr-xspec/functions/to_yaml_spec.rb17
-rwxr-xr-xspec/functions/union_spec.rb1
-rwxr-xr-xspec/functions/unique_spec.rb44
-rwxr-xr-xspec/functions/validate_cmd_spec.rb2
-rw-r--r--spec/functions/validate_domain_name_spec.rb35
-rwxr-xr-xspec/functions/validate_ipv6_address_spec.rb10
-rw-r--r--spec/functions/validate_legacy_spec.rb2
-rwxr-xr-xspec/functions/values_at_spec.rb5
-rwxr-xr-xspec/functions/values_spec.rb5
-rwxr-xr-xspec/functions/zip_spec.rb6
-rwxr-xr-xspec/spec_helper_acceptance.rb25
-rw-r--r--spec/unit/ensure_resources_spec.rb22
-rwxr-xr-xspec/unit/puppet/provider/file_line/ruby_spec.rb149
-rwxr-xr-xspec/unit/puppet/type/file_line_spec.rb64
206 files changed, 1047 insertions, 355 deletions
diff --git a/spec/acceptance/abs_spec.rb b/spec/acceptance/abs_spec.rb
index 6e41e2f..5af436f 100755
--- a/spec/acceptance/abs_spec.rb
+++ b/spec/acceptance/abs_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'abs function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'abs function' do
describe 'success' do
it 'should accept a string' do
pp = <<-EOS
diff --git a/spec/acceptance/anchor_spec.rb b/spec/acceptance/anchor_spec.rb
index 5bc2bbb..24a9064 100755
--- a/spec/acceptance/anchor_spec.rb
+++ b/spec/acceptance/anchor_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper_acceptance'
-describe 'anchor type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'anchor type' do
describe 'success' do
it 'should effect proper chaining of resources' do
pp = <<-EOS
diff --git a/spec/acceptance/any2array_spec.rb b/spec/acceptance/any2array_spec.rb
index 18ea4cd..8a13911 100755
--- a/spec/acceptance/any2array_spec.rb
+++ b/spec/acceptance/any2array_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'any2array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'any2array function' do
describe 'success' do
it 'should create an empty array' do
pp = <<-EOS
diff --git a/spec/acceptance/base64_spec.rb b/spec/acceptance/base64_spec.rb
index 97e1738..e9096a7 100755
--- a/spec/acceptance/base64_spec.rb
+++ b/spec/acceptance/base64_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'base64 function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'base64 function' do
describe 'success' do
it 'should encode then decode a string' do
pp = <<-EOS
diff --git a/spec/acceptance/bool2num_spec.rb b/spec/acceptance/bool2num_spec.rb
index 52ff75b..c69acc6 100755
--- a/spec/acceptance/bool2num_spec.rb
+++ b/spec/acceptance/bool2num_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'bool2num function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'bool2num function' do
describe 'success' do
['false', 'f', '0', 'n', 'no'].each do |bool|
it "should convert a given boolean, #{bool}, to 0" do
diff --git a/spec/acceptance/capitalize_spec.rb b/spec/acceptance/capitalize_spec.rb
index e5e7b7b..03d01a8 100755
--- a/spec/acceptance/capitalize_spec.rb
+++ b/spec/acceptance/capitalize_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'capitalize function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'capitalize function' do
describe 'success' do
it 'should capitalize the first letter of a string' do
pp = <<-EOS
diff --git a/spec/acceptance/ceiling_spec.rb b/spec/acceptance/ceiling_spec.rb
index 557986e..895e4a0 100755
--- a/spec/acceptance/ceiling_spec.rb
+++ b/spec/acceptance/ceiling_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'ceiling function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'ceiling function' do
describe 'success' do
it 'ceilings floats' do
pp = <<-EOS
diff --git a/spec/acceptance/chomp_spec.rb b/spec/acceptance/chomp_spec.rb
index f6c1595..56e0876 100755
--- a/spec/acceptance/chomp_spec.rb
+++ b/spec/acceptance/chomp_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'chomp function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'chomp function' do
describe 'success' do
it 'should eat the newline' do
pp = <<-EOS
diff --git a/spec/acceptance/chop_spec.rb b/spec/acceptance/chop_spec.rb
index a16a710..0993806 100755
--- a/spec/acceptance/chop_spec.rb
+++ b/spec/acceptance/chop_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'chop function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'chop function' do
describe 'success' do
it 'should eat the last character' do
pp = <<-EOS
diff --git a/spec/acceptance/clamp_spec.rb b/spec/acceptance/clamp_spec.rb
index 0189258..e8ccb96 100755
--- a/spec/acceptance/clamp_spec.rb
+++ b/spec/acceptance/clamp_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'clamp function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'clamp function' do
describe 'success' do
it 'clamps list of values' do
pp = <<-EOS
diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb
index c472db6..8d184d1 100755
--- a/spec/acceptance/concat_spec.rb
+++ b/spec/acceptance/concat_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'concat function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'concat function' do
describe 'success' do
it 'should concat one array to another' do
pp = <<-EOS
diff --git a/spec/acceptance/count_spec.rb b/spec/acceptance/count_spec.rb
index fe7ca9d..18c039d 100755
--- a/spec/acceptance/count_spec.rb
+++ b/spec/acceptance/count_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'count function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'count function' do
describe 'success' do
it 'should count elements in an array' do
pp = <<-EOS
diff --git a/spec/acceptance/deep_merge_spec.rb b/spec/acceptance/deep_merge_spec.rb
index c0f9b12..8222f24 100755
--- a/spec/acceptance/deep_merge_spec.rb
+++ b/spec/acceptance/deep_merge_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'deep_merge function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'deep_merge function' do
describe 'success' do
it 'should deep merge two hashes' do
pp = <<-EOS
diff --git a/spec/acceptance/defined_with_params_spec.rb b/spec/acceptance/defined_with_params_spec.rb
index fc54450..a332bd6 100755
--- a/spec/acceptance/defined_with_params_spec.rb
+++ b/spec/acceptance/defined_with_params_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'defined_with_params function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'defined_with_params function' do
describe 'success' do
it 'should successfully notify' do
pp = <<-EOS
diff --git a/spec/acceptance/delete_at_spec.rb b/spec/acceptance/delete_at_spec.rb
index db0c01f..d4f852a 100755
--- a/spec/acceptance/delete_at_spec.rb
+++ b/spec/acceptance/delete_at_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'delete_at function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'delete_at function' do
describe 'success' do
it 'should delete elements of the array' do
pp = <<-EOS
diff --git a/spec/acceptance/delete_spec.rb b/spec/acceptance/delete_spec.rb
index a28604c..f85b093 100755
--- a/spec/acceptance/delete_spec.rb
+++ b/spec/acceptance/delete_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'delete function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'delete function' do
describe 'success' do
it 'should delete elements of the array' do
pp = <<-EOS
diff --git a/spec/acceptance/delete_undef_values_spec.rb b/spec/acceptance/delete_undef_values_spec.rb
index b7eda19..af45a92 100755
--- a/spec/acceptance/delete_undef_values_spec.rb
+++ b/spec/acceptance/delete_undef_values_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'delete_undef_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'delete_undef_values function' do
describe 'success' do
it 'should delete elements of the array' do
pp = <<-EOS
diff --git a/spec/acceptance/delete_values_spec.rb b/spec/acceptance/delete_values_spec.rb
index 6d2369c..04b6920 100755
--- a/spec/acceptance/delete_values_spec.rb
+++ b/spec/acceptance/delete_values_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'delete_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'delete_values function' do
describe 'success' do
it 'should delete elements of the hash' do
pp = <<-EOS
diff --git a/spec/acceptance/difference_spec.rb b/spec/acceptance/difference_spec.rb
index 2fae5c4..68f6bbe 100755
--- a/spec/acceptance/difference_spec.rb
+++ b/spec/acceptance/difference_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'difference function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'difference function' do
describe 'success' do
it 'returns non-duplicates in the first array' do
pp = <<-EOS
diff --git a/spec/acceptance/dirname_spec.rb b/spec/acceptance/dirname_spec.rb
index 97913dd..db83f0f 100755
--- a/spec/acceptance/dirname_spec.rb
+++ b/spec/acceptance/dirname_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'dirname function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'dirname function' do
describe 'success' do
context 'absolute path' do
it 'returns the dirname' do
diff --git a/spec/acceptance/downcase_spec.rb b/spec/acceptance/downcase_spec.rb
index bc4e706..300bcfa 100755
--- a/spec/acceptance/downcase_spec.rb
+++ b/spec/acceptance/downcase_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'downcase function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'downcase function' do
describe 'success' do
it 'returns the downcase' do
pp = <<-EOS
diff --git a/spec/acceptance/empty_spec.rb b/spec/acceptance/empty_spec.rb
index 2d4df90..97b7333 100755
--- a/spec/acceptance/empty_spec.rb
+++ b/spec/acceptance/empty_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'empty function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'empty function' do
describe 'success' do
it 'recognizes empty strings' do
pp = <<-EOS
diff --git a/spec/acceptance/flatten_spec.rb b/spec/acceptance/flatten_spec.rb
index c4d66e0..289eec9 100755
--- a/spec/acceptance/flatten_spec.rb
+++ b/spec/acceptance/flatten_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'flatten function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'flatten function' do
describe 'success' do
it 'flattens arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/floor_spec.rb b/spec/acceptance/floor_spec.rb
index 0dcdad9..8259d2a 100755
--- a/spec/acceptance/floor_spec.rb
+++ b/spec/acceptance/floor_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'floor function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'floor function' do
describe 'success' do
it 'floors floats' do
pp = <<-EOS
diff --git a/spec/acceptance/fqdn_rand_string_spec.rb b/spec/acceptance/fqdn_rand_string_spec.rb
index 065a517..af1b2a9 100644
--- a/spec/acceptance/fqdn_rand_string_spec.rb
+++ b/spec/acceptance/fqdn_rand_string_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'fqdn_rand_string function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'fqdn_rand_string function' do
describe 'success' do
include_context "with faked facts"
context "when the FQDN is 'fakehost.localdomain'" do
diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb
index 404351f..66e94a9 100755
--- a/spec/acceptance/fqdn_rotate_spec.rb
+++ b/spec/acceptance/fqdn_rotate_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'fqdn_rotate function' do
describe 'success' do
include_context "with faked facts"
context "when the FQDN is 'fakehost.localdomain'" do
diff --git a/spec/acceptance/get_module_path_spec.rb b/spec/acceptance/get_module_path_spec.rb
index 6ac690c..3d10251 100755
--- a/spec/acceptance/get_module_path_spec.rb
+++ b/spec/acceptance/get_module_path_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'get_module_path function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'get_module_path function' do
describe 'success' do
it 'get_module_paths dne' do
pp = <<-EOS
diff --git a/spec/acceptance/getparam_spec.rb b/spec/acceptance/getparam_spec.rb
index b1a677e..bd12154 100755
--- a/spec/acceptance/getparam_spec.rb
+++ b/spec/acceptance/getparam_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'getparam function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'getparam function' do
describe 'success' do
it 'getparam a notify' do
pp = <<-EOS
diff --git a/spec/acceptance/getvar_spec.rb b/spec/acceptance/getvar_spec.rb
index 333c467..605cdce 100755
--- a/spec/acceptance/getvar_spec.rb
+++ b/spec/acceptance/getvar_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'getvar function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'getvar function' do
describe 'success' do
it 'getvars from classes' do
pp = <<-EOS
diff --git a/spec/acceptance/grep_spec.rb b/spec/acceptance/grep_spec.rb
index b39d48e..7c35ee4 100755
--- a/spec/acceptance/grep_spec.rb
+++ b/spec/acceptance/grep_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'grep function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'grep function' do
describe 'success' do
it 'greps arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/has_interface_with_spec.rb b/spec/acceptance/has_interface_with_spec.rb
index 9590193..fd33af5 100755
--- a/spec/acceptance/has_interface_with_spec.rb
+++ b/spec/acceptance/has_interface_with_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'has_interface_with function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do
+describe 'has_interface_with function', :unless => ((fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do
describe 'success' do
it 'has_interface_with existing ipaddress' do
pp = <<-EOS
diff --git a/spec/acceptance/has_ip_address_spec.rb b/spec/acceptance/has_ip_address_spec.rb
index 149a10d..878d921 100755
--- a/spec/acceptance/has_ip_address_spec.rb
+++ b/spec/acceptance/has_ip_address_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'has_ip_address function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do
+describe 'has_ip_address function', :unless => ((fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do
describe 'success' do
it 'has_ip_address existing ipaddress' do
pp = <<-EOS
diff --git a/spec/acceptance/has_ip_network_spec.rb b/spec/acceptance/has_ip_network_spec.rb
index 7d2f34e..f7a7d35 100755
--- a/spec/acceptance/has_ip_network_spec.rb
+++ b/spec/acceptance/has_ip_network_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'has_ip_network function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do
+describe 'has_ip_network function', :unless => ((fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do
describe 'success' do
it 'has_ip_network existing ipaddress' do
pp = <<-EOS
diff --git a/spec/acceptance/has_key_spec.rb b/spec/acceptance/has_key_spec.rb
index c8557cb..661c122 100755
--- a/spec/acceptance/has_key_spec.rb
+++ b/spec/acceptance/has_key_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'has_key function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'has_key function' do
describe 'success' do
it 'has_keys in hashes' do
pp = <<-EOS
diff --git a/spec/acceptance/hash_spec.rb b/spec/acceptance/hash_spec.rb
index ed53834..85da50b 100755
--- a/spec/acceptance/hash_spec.rb
+++ b/spec/acceptance/hash_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'hash function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'hash function' do
describe 'success' do
it 'hashs arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/intersection_spec.rb b/spec/acceptance/intersection_spec.rb
index 66b8652..02d4e7d 100755
--- a/spec/acceptance/intersection_spec.rb
+++ b/spec/acceptance/intersection_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'intersection function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'intersection function' do
describe 'success' do
it 'intersections arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/is_a_spec.rb b/spec/acceptance/is_a_spec.rb
index 355fd83..fb0019a 100644
--- a/spec/acceptance/is_a_spec.rb
+++ b/spec/acceptance/is_a_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper_acceptance'
if get_puppet_version =~ /^4/
- describe 'is_a function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+ describe 'is_a function' do
it 'should match a string' do
pp = <<-EOS
if 'hello world'.is_a(String) {
diff --git a/spec/acceptance/is_array_spec.rb b/spec/acceptance/is_array_spec.rb
index 9c6bad7..1a83417 100755
--- a/spec/acceptance/is_array_spec.rb
+++ b/spec/acceptance/is_array_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'is_array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'is_array function' do
describe 'success' do
it 'is_arrays arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/is_bool_spec.rb b/spec/acceptance/is_bool_spec.rb
index 60079f9..823cb46 100755
--- a/spec/acceptance/is_bool_spec.rb
+++ b/spec/acceptance/is_bool_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'is_bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'is_bool function' do
describe 'success' do
it 'is_bools arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/is_domain_name_spec.rb b/spec/acceptance/is_domain_name_spec.rb
index e0f03fa..884b0bc 100755
--- a/spec/acceptance/is_domain_name_spec.rb
+++ b/spec/acceptance/is_domain_name_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'is_domain_name function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'is_domain_name function' do
describe 'success' do
it 'is_domain_names arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/is_float_spec.rb b/spec/acceptance/is_float_spec.rb
index 338ba58..0b38d94 100755
--- a/spec/acceptance/is_float_spec.rb
+++ b/spec/acceptance/is_float_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'is_float function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'is_float function' do
describe 'success' do
it 'is_floats arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/is_function_available_spec.rb b/spec/acceptance/is_function_available_spec.rb
index 2b5dd6d..f8191ee 100755
--- a/spec/acceptance/is_function_available_spec.rb
+++ b/spec/acceptance/is_function_available_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'is_function_available function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'is_function_available function' do
describe 'success' do
it 'is_function_availables arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/is_hash_spec.rb b/spec/acceptance/is_hash_spec.rb
index 2ef310a..64f016c 100755
--- a/spec/acceptance/is_hash_spec.rb
+++ b/spec/acceptance/is_hash_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'is_hash function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'is_hash function' do
describe 'success' do
it 'is_hashs arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/is_integer_spec.rb b/spec/acceptance/is_integer_spec.rb
index bf6902b..7333687 100755
--- a/spec/acceptance/is_integer_spec.rb
+++ b/spec/acceptance/is_integer_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'is_integer function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'is_integer function' do
describe 'success' do
it 'is_integers arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/is_ip_address_spec.rb b/spec/acceptance/is_ip_address_spec.rb
index ed7a854..2c62c77 100755
--- a/spec/acceptance/is_ip_address_spec.rb
+++ b/spec/acceptance/is_ip_address_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'is_ip_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'is_ip_address function' do
describe 'success' do
it 'is_ip_addresss ipv4' do
pp = <<-EOS
diff --git a/spec/acceptance/is_ipv4_address_spec.rb b/spec/acceptance/is_ipv4_address_spec.rb
index 5dc6bf5..abe26d8 100755
--- a/spec/acceptance/is_ipv4_address_spec.rb
+++ b/spec/acceptance/is_ipv4_address_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'is_ipv4_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'is_ipv4_address function' do
describe 'success' do
it 'is_ipv4_addresss' do
pp = <<-EOS
diff --git a/spec/acceptance/is_ipv6_address_spec.rb b/spec/acceptance/is_ipv6_address_spec.rb
index 1e88be8..73a3fa4 100755
--- a/spec/acceptance/is_ipv6_address_spec.rb
+++ b/spec/acceptance/is_ipv6_address_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'is_ipv6_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'is_ipv6_address function' do
describe 'success' do
it 'is_ipv6_addresss' do
pp = <<-EOS
diff --git a/spec/acceptance/is_mac_address_spec.rb b/spec/acceptance/is_mac_address_spec.rb
index a2c892f..617bef6 100755
--- a/spec/acceptance/is_mac_address_spec.rb
+++ b/spec/acceptance/is_mac_address_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'is_mac_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'is_mac_address function' do
describe 'success' do
it 'is_mac_addresss a mac' do
pp = <<-EOS
diff --git a/spec/acceptance/is_numeric_spec.rb b/spec/acceptance/is_numeric_spec.rb
index 21c8988..7e65384 100755
--- a/spec/acceptance/is_numeric_spec.rb
+++ b/spec/acceptance/is_numeric_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'is_numeric function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'is_numeric function' do
describe 'success' do
it 'is_numerics arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/is_string_spec.rb b/spec/acceptance/is_string_spec.rb
index f526888..bee5e01 100755
--- a/spec/acceptance/is_string_spec.rb
+++ b/spec/acceptance/is_string_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'is_string function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'is_string function' do
describe 'success' do
it 'is_strings arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/join_keys_to_values_spec.rb b/spec/acceptance/join_keys_to_values_spec.rb
index 70493fd..ae6947e 100755
--- a/spec/acceptance/join_keys_to_values_spec.rb
+++ b/spec/acceptance/join_keys_to_values_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'join_keys_to_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'join_keys_to_values function' do
describe 'success' do
it 'join_keys_to_valuess hashes' do
pp = <<-EOS
diff --git a/spec/acceptance/join_spec.rb b/spec/acceptance/join_spec.rb
index 5397ce2..75b88d8 100755
--- a/spec/acceptance/join_spec.rb
+++ b/spec/acceptance/join_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'join function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'join function' do
describe 'success' do
it 'joins arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/keys_spec.rb b/spec/acceptance/keys_spec.rb
index 176918e..65bfe28 100755
--- a/spec/acceptance/keys_spec.rb
+++ b/spec/acceptance/keys_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'keys function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'keys function' do
describe 'success' do
it 'keyss hashes' do
pp = <<-EOS
diff --git a/spec/acceptance/loadjson_spec.rb b/spec/acceptance/loadjson_spec.rb
index 2992c37..ebd5307 100644
--- a/spec/acceptance/loadjson_spec.rb
+++ b/spec/acceptance/loadjson_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper_acceptance'
tmpdir = default.tmpdir('stdlib')
-describe 'loadjson function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'loadjson function' do
describe 'success' do
it 'loadjsons array of values' do
shell("echo '{\"aaa\":1,\"bbb\":2,\"ccc\":3,\"ddd\":4}' > #{tmpdir}/testjson.json")
diff --git a/spec/acceptance/loadyaml_spec.rb b/spec/acceptance/loadyaml_spec.rb
index ba3f0b7..57fb8cb 100644
--- a/spec/acceptance/loadyaml_spec.rb
+++ b/spec/acceptance/loadyaml_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper_acceptance'
tmpdir = default.tmpdir('stdlib')
-describe 'loadyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'loadyaml function' do
describe 'success' do
it 'loadyamls array of values' do
shell("echo '---
diff --git a/spec/acceptance/lstrip_spec.rb b/spec/acceptance/lstrip_spec.rb
index 3dc952f..eba5d0d 100755
--- a/spec/acceptance/lstrip_spec.rb
+++ b/spec/acceptance/lstrip_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'lstrip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'lstrip function' do
describe 'success' do
it 'lstrips arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/max_spec.rb b/spec/acceptance/max_spec.rb
index f04e3d2..3caa813 100755
--- a/spec/acceptance/max_spec.rb
+++ b/spec/acceptance/max_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'max function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'max function' do
describe 'success' do
it 'maxs arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/member_spec.rb b/spec/acceptance/member_spec.rb
index fe75a07..2bcadd3 100755
--- a/spec/acceptance/member_spec.rb
+++ b/spec/acceptance/member_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'member function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'member function' do
shared_examples 'item found' do
it 'should output correctly' do
apply_manifest(pp, :catch_failures => true) do |r|
diff --git a/spec/acceptance/merge_spec.rb b/spec/acceptance/merge_spec.rb
index 227b994..814db4e 100755
--- a/spec/acceptance/merge_spec.rb
+++ b/spec/acceptance/merge_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'merge function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'merge function' do
describe 'success' do
it 'should merge two hashes' do
pp = <<-EOS
diff --git a/spec/acceptance/min_spec.rb b/spec/acceptance/min_spec.rb
index 509092d..7b18fac 100755
--- a/spec/acceptance/min_spec.rb
+++ b/spec/acceptance/min_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'min function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'min function' do
describe 'success' do
it 'mins arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/num2bool_spec.rb b/spec/acceptance/num2bool_spec.rb
index 1d99ba0..00d0ddc 100755
--- a/spec/acceptance/num2bool_spec.rb
+++ b/spec/acceptance/num2bool_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'num2bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'num2bool function' do
describe 'success' do
it 'bools positive numbers and numeric strings as true' do
pp = <<-EOS
diff --git a/spec/acceptance/parsejson_spec.rb b/spec/acceptance/parsejson_spec.rb
index d0e3de8..52133e4 100755
--- a/spec/acceptance/parsejson_spec.rb
+++ b/spec/acceptance/parsejson_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'parsejson function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'parsejson function' do
describe 'success' do
it 'parses valid json' do
pp = <<-EOS
diff --git a/spec/acceptance/parseyaml_spec.rb b/spec/acceptance/parseyaml_spec.rb
index 64511f1..acbda46 100755
--- a/spec/acceptance/parseyaml_spec.rb
+++ b/spec/acceptance/parseyaml_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'parseyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'parseyaml function' do
describe 'success' do
it 'parses valid yaml' do
pp = <<-EOS
diff --git a/spec/acceptance/pick_default_spec.rb b/spec/acceptance/pick_default_spec.rb
index a663f54..e7e25ab 100755
--- a/spec/acceptance/pick_default_spec.rb
+++ b/spec/acceptance/pick_default_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'pick_default function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'pick_default function' do
describe 'success' do
it 'pick_defaults a default value' do
pp = <<-EOS
diff --git a/spec/acceptance/pick_spec.rb b/spec/acceptance/pick_spec.rb
index 46cf63f..c70b2d9 100755
--- a/spec/acceptance/pick_spec.rb
+++ b/spec/acceptance/pick_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'pick function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'pick function' do
describe 'success' do
it 'picks a default value' do
pp = <<-EOS
diff --git a/spec/acceptance/prefix_spec.rb b/spec/acceptance/prefix_spec.rb
index de55530..58c691d 100755
--- a/spec/acceptance/prefix_spec.rb
+++ b/spec/acceptance/prefix_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'prefix function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'prefix function' do
describe 'success' do
it 'prefixes array of values' do
pp = <<-EOS
diff --git a/spec/acceptance/pw_hash_spec.rb b/spec/acceptance/pw_hash_spec.rb
index cd4cb87..829d087 100644
--- a/spec/acceptance/pw_hash_spec.rb
+++ b/spec/acceptance/pw_hash_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper_acceptance'
# Windows and OS X do not have useful implementations of crypt(3)
-describe 'pw_hash function', :unless => (UNSUPPORTED_PLATFORMS + ['windows', 'Darwin', 'SLES']).include?(fact('operatingsystem')) do
+describe 'pw_hash function', :unless => (['windows', 'Darwin', 'SLES']).include?(fact('operatingsystem')) do
describe 'success' do
it 'hashes passwords' do
pp = <<-EOS
diff --git a/spec/acceptance/range_spec.rb b/spec/acceptance/range_spec.rb
index a3ccd33..f57f884 100755
--- a/spec/acceptance/range_spec.rb
+++ b/spec/acceptance/range_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'range function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'range function' do
describe 'success' do
it 'ranges letters' do
pp = <<-EOS
diff --git a/spec/acceptance/reject_spec.rb b/spec/acceptance/reject_spec.rb
index 7f16a00..ce4342d 100755
--- a/spec/acceptance/reject_spec.rb
+++ b/spec/acceptance/reject_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'reject function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'reject function' do
describe 'success' do
it 'rejects array of values' do
pp = <<-EOS
diff --git a/spec/acceptance/reverse_spec.rb b/spec/acceptance/reverse_spec.rb
index c3f0156..3b5dfad 100755
--- a/spec/acceptance/reverse_spec.rb
+++ b/spec/acceptance/reverse_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'reverse function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'reverse function' do
describe 'success' do
it 'reverses strings' do
pp = <<-EOS
diff --git a/spec/acceptance/rstrip_spec.rb b/spec/acceptance/rstrip_spec.rb
index b57a8b0..150dac1 100755
--- a/spec/acceptance/rstrip_spec.rb
+++ b/spec/acceptance/rstrip_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'rstrip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'rstrip function' do
describe 'success' do
it 'rstrips arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/shuffle_spec.rb b/spec/acceptance/shuffle_spec.rb
index b840d1f..0738383 100755
--- a/spec/acceptance/shuffle_spec.rb
+++ b/spec/acceptance/shuffle_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'shuffle function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'shuffle function' do
describe 'success' do
it 'shuffles arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/size_spec.rb b/spec/acceptance/size_spec.rb
index a52b778..6390c20 100755
--- a/spec/acceptance/size_spec.rb
+++ b/spec/acceptance/size_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'size function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'size function' do
describe 'success' do
it 'single string size' do
pp = <<-EOS
diff --git a/spec/acceptance/sort_spec.rb b/spec/acceptance/sort_spec.rb
index c85bfab..e7ff7f7 100755
--- a/spec/acceptance/sort_spec.rb
+++ b/spec/acceptance/sort_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'sort function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'sort function' do
describe 'success' do
it 'sorts arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/squeeze_spec.rb b/spec/acceptance/squeeze_spec.rb
index 400a458..3324691 100755
--- a/spec/acceptance/squeeze_spec.rb
+++ b/spec/acceptance/squeeze_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'squeeze function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'squeeze function' do
describe 'success' do
it 'squeezes arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/str2bool_spec.rb b/spec/acceptance/str2bool_spec.rb
index cf549da..9a8c06c 100755
--- a/spec/acceptance/str2bool_spec.rb
+++ b/spec/acceptance/str2bool_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'str2bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'str2bool function' do
describe 'success' do
it 'works with "y"' do
pp = <<-EOS
diff --git a/spec/acceptance/str2saltedsha512_spec.rb b/spec/acceptance/str2saltedsha512_spec.rb
index 993e63b..5f03924 100755
--- a/spec/acceptance/str2saltedsha512_spec.rb
+++ b/spec/acceptance/str2saltedsha512_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'str2saltedsha512 function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'str2saltedsha512 function' do
describe 'success' do
it 'works with "y"' do
pp = <<-EOS
diff --git a/spec/acceptance/strftime_spec.rb b/spec/acceptance/strftime_spec.rb
index 53b7f90..38521b0 100755
--- a/spec/acceptance/strftime_spec.rb
+++ b/spec/acceptance/strftime_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'strftime function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'strftime function' do
describe 'success' do
it 'gives the Century' do
pp = <<-EOS
diff --git a/spec/acceptance/strip_spec.rb b/spec/acceptance/strip_spec.rb
index 906fd7a..05cd395 100755
--- a/spec/acceptance/strip_spec.rb
+++ b/spec/acceptance/strip_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'strip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'strip function' do
describe 'success' do
it 'strips arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/suffix_spec.rb b/spec/acceptance/suffix_spec.rb
index 630f866..60a6264 100755
--- a/spec/acceptance/suffix_spec.rb
+++ b/spec/acceptance/suffix_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'suffix function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'suffix function' do
describe 'success' do
it 'suffixes array of values' do
pp = <<-EOS
diff --git a/spec/acceptance/swapcase_spec.rb b/spec/acceptance/swapcase_spec.rb
index b7894fb..9f94c0d 100755
--- a/spec/acceptance/swapcase_spec.rb
+++ b/spec/acceptance/swapcase_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'swapcase function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'swapcase function' do
describe 'success' do
it 'works with strings' do
pp = <<-EOS
diff --git a/spec/acceptance/time_spec.rb b/spec/acceptance/time_spec.rb
index cdb2960..dae1166 100755
--- a/spec/acceptance/time_spec.rb
+++ b/spec/acceptance/time_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'time function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'time function' do
describe 'success' do
it 'gives the time' do
pp = <<-EOS
diff --git a/spec/acceptance/to_bytes_spec.rb b/spec/acceptance/to_bytes_spec.rb
index 2b4c61f..b1015a3 100755
--- a/spec/acceptance/to_bytes_spec.rb
+++ b/spec/acceptance/to_bytes_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'to_bytes function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'to_bytes function' do
describe 'success' do
it 'converts kB to B' do
pp = <<-EOS
diff --git a/spec/acceptance/try_get_value_spec.rb b/spec/acceptance/try_get_value_spec.rb
index c0bf38a..716241c 100755
--- a/spec/acceptance/try_get_value_spec.rb
+++ b/spec/acceptance/try_get_value_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'try_get_value function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'try_get_value function' do
describe 'success' do
it 'gets a value' do
pp = <<-EOS
diff --git a/spec/acceptance/type_spec.rb b/spec/acceptance/type_spec.rb
index 67e3248..5cc9470 100755
--- a/spec/acceptance/type_spec.rb
+++ b/spec/acceptance/type_spec.rb
@@ -1,29 +1,29 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'type function', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) || is_future_parser_enabled?) do
+describe 'type function' do
describe 'success' do
it 'types arrays' do
pp = <<-EOS
$a = ["the","public","art","galleries"]
# Anagram: Large picture halls, I bet
$o = type($a)
- notice(inline_template('type is <%= @o.inspect %>'))
+ notice(inline_template('type is <%= @o.to_s %>'))
EOS
apply_manifest(pp, :catch_failures => true) do |r|
- expect(r.stdout).to match(/type is "array"/)
+ expect(r.stdout).to match(/type is Tuple\[String.*, String.*, String.*, String.*\]/)
end
end
it 'types strings' do
pp = <<-EOS
$a = "blowzy night-frumps vex'd jack q"
$o = type($a)
- notice(inline_template('type is <%= @o.inspect %>'))
+ notice(inline_template('type is <%= @o.to_s %>'))
EOS
apply_manifest(pp, :catch_failures => true) do |r|
- expect(r.stdout).to match(/type is "string"/)
+ expect(r.stdout).to match(/type is String/)
end
end
it 'types hashes'
diff --git a/spec/acceptance/union_spec.rb b/spec/acceptance/union_spec.rb
index 160fd7b..7229bf5 100755
--- a/spec/acceptance/union_spec.rb
+++ b/spec/acceptance/union_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'union function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'union function' do
describe 'success' do
it 'unions arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/unique_spec.rb b/spec/acceptance/unique_spec.rb
index bfadad1..7fb5eca 100755
--- a/spec/acceptance/unique_spec.rb
+++ b/spec/acceptance/unique_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'unique function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'unique function' do
describe 'success' do
it 'uniques arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/unsupported_spec.rb b/spec/acceptance/unsupported_spec.rb
deleted file mode 100755
index 1c559f6..0000000
--- a/spec/acceptance/unsupported_spec.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper_acceptance'
-
-describe 'unsupported distributions and OSes', :if => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
- it 'should fail' do
- pp = <<-EOS
- class { 'mysql::server': }
- EOS
- expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/unsupported osfamily/i)
- end
-end
diff --git a/spec/acceptance/upcase_spec.rb b/spec/acceptance/upcase_spec.rb
index 3d2906d..1782309 100755
--- a/spec/acceptance/upcase_spec.rb
+++ b/spec/acceptance/upcase_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'upcase function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'upcase function' do
describe 'success' do
it 'upcases arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/uriescape_spec.rb b/spec/acceptance/uriescape_spec.rb
index 7e30205..e123425 100755
--- a/spec/acceptance/uriescape_spec.rb
+++ b/spec/acceptance/uriescape_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'uriescape function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'uriescape function' do
describe 'success' do
it 'uriescape strings' do
pp = <<-EOS
diff --git a/spec/acceptance/validate_absolute_path_spec.rb b/spec/acceptance/validate_absolute_path_spec.rb
index 7082e84..880850d 100755
--- a/spec/acceptance/validate_absolute_path_spec.rb
+++ b/spec/acceptance/validate_absolute_path_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'validate_absolute_path function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'validate_absolute_path function' do
describe 'success' do
%w{
C:/
diff --git a/spec/acceptance/validate_array_spec.rb b/spec/acceptance/validate_array_spec.rb
index 2f549d5..a76321d 100755
--- a/spec/acceptance/validate_array_spec.rb
+++ b/spec/acceptance/validate_array_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'validate_array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'validate_array function' do
describe 'success' do
it 'validates a single argument' do
pp = <<-EOS
diff --git a/spec/acceptance/validate_augeas_spec.rb b/spec/acceptance/validate_augeas_spec.rb
index 71a4c84..be213d3 100755
--- a/spec/acceptance/validate_augeas_spec.rb
+++ b/spec/acceptance/validate_augeas_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'validate_augeas function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows')) do
+describe 'validate_augeas function', :unless => (fact('osfamily') == 'windows') do
describe 'prep' do
it 'installs augeas for tests'
end
diff --git a/spec/acceptance/validate_bool_spec.rb b/spec/acceptance/validate_bool_spec.rb
index 5c52d0f..993f9ef 100755
--- a/spec/acceptance/validate_bool_spec.rb
+++ b/spec/acceptance/validate_bool_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'validate_bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'validate_bool function' do
describe 'success' do
it 'validates a single argument' do
pp = <<-EOS
diff --git a/spec/acceptance/validate_cmd_spec.rb b/spec/acceptance/validate_cmd_spec.rb
index 5ac66fd..5fc7b94 100755
--- a/spec/acceptance/validate_cmd_spec.rb
+++ b/spec/acceptance/validate_cmd_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'validate_cmd function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'validate_cmd function' do
describe 'success' do
it 'validates a true command' do
pp = <<-EOS
diff --git a/spec/acceptance/validate_hash_spec.rb b/spec/acceptance/validate_hash_spec.rb
index 637df0a..fc0f079 100755
--- a/spec/acceptance/validate_hash_spec.rb
+++ b/spec/acceptance/validate_hash_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'validate_hash function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'validate_hash function' do
describe 'success' do
it 'validates a single argument' do
pp = <<-EOS
diff --git a/spec/acceptance/validate_ipv4_address_spec.rb b/spec/acceptance/validate_ipv4_address_spec.rb
index 64841c3..67d3139 100755
--- a/spec/acceptance/validate_ipv4_address_spec.rb
+++ b/spec/acceptance/validate_ipv4_address_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'validate_ipv4_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'validate_ipv4_address function' do
describe 'success' do
it 'validates a single argument' do
pp = <<-EOS
diff --git a/spec/acceptance/validate_ipv6_address_spec.rb b/spec/acceptance/validate_ipv6_address_spec.rb
index 6426d1a..eaa845d 100755
--- a/spec/acceptance/validate_ipv6_address_spec.rb
+++ b/spec/acceptance/validate_ipv6_address_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'validate_ipv6_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'validate_ipv6_address function' do
describe 'success' do
it 'validates a single argument' do
pp = <<-EOS
diff --git a/spec/acceptance/validate_re_spec.rb b/spec/acceptance/validate_re_spec.rb
index 22f6d47..eefb286 100755
--- a/spec/acceptance/validate_re_spec.rb
+++ b/spec/acceptance/validate_re_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'validate_re function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'validate_re function' do
describe 'success' do
it 'validates a string' do
pp = <<-EOS
diff --git a/spec/acceptance/validate_slength_spec.rb b/spec/acceptance/validate_slength_spec.rb
index 1ab2bb9..c29fd23 100755
--- a/spec/acceptance/validate_slength_spec.rb
+++ b/spec/acceptance/validate_slength_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'validate_slength function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'validate_slength function' do
describe 'success' do
it 'validates a single string max' do
pp = <<-EOS
diff --git a/spec/acceptance/validate_string_spec.rb b/spec/acceptance/validate_string_spec.rb
index ae3468f..f04608d 100755
--- a/spec/acceptance/validate_string_spec.rb
+++ b/spec/acceptance/validate_string_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'validate_string function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'validate_string function' do
describe 'success' do
it 'validates a single argument' do
pp = <<-EOS
diff --git a/spec/acceptance/values_at_spec.rb b/spec/acceptance/values_at_spec.rb
index da63cf3..eb0bf4f 100755
--- a/spec/acceptance/values_at_spec.rb
+++ b/spec/acceptance/values_at_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'values_at function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'values_at function' do
describe 'success' do
it 'returns a specific value' do
pp = <<-EOS
diff --git a/spec/acceptance/values_spec.rb b/spec/acceptance/values_spec.rb
index a2eff32..cef1c9d 100755
--- a/spec/acceptance/values_spec.rb
+++ b/spec/acceptance/values_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'values function' do
describe 'success' do
it 'returns an array of values' do
pp = <<-EOS
@@ -13,12 +13,7 @@ describe 'values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('oper
$output = values($arg)
notice(inline_template('<%= @output.sort.inspect %>'))
EOS
- if is_future_parser_enabled?
- expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[1, 2, 3\]/)
- else
- expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["1", "2", "3"\]/)
- end
-
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[1, 2, 3\]/)
end
end
describe 'failure' do
diff --git a/spec/acceptance/zip_spec.rb b/spec/acceptance/zip_spec.rb
index 139079e..ae22896 100755
--- a/spec/acceptance/zip_spec.rb
+++ b/spec/acceptance/zip_spec.rb
@@ -1,8 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-require 'puppet'
-describe 'zip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'zip function' do
describe 'success' do
it 'zips two arrays of numbers together' do
pp = <<-EOS
@@ -11,11 +10,7 @@ describe 'zip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operati
$output = zip($one,$two)
notice(inline_template('<%= @output.inspect %>'))
EOS
- if is_future_parser_enabled?
- expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\[1, 5\], \[2, 6\], \[3, 7\], \[4, 8\]\]/)
- else
- expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", "5"\], \["2", "6"\], \["3", "7"\], \["4", "8"\]\]/)
- end
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\[1, 5\], \[2, 6\], \[3, 7\], \[4, 8\]\]/)
end
it 'zips two arrays of numbers & bools together' do
pp = <<-EOS
@@ -24,11 +19,7 @@ describe 'zip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operati
$output = zip($one,$two)
notice(inline_template('<%= @output.inspect %>'))
EOS
- if is_future_parser_enabled?
- expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\[1, true\], \[2, true\], \["three", false\], \[4, false\]\]/)
- else
- expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", true\], \["2", true\], \["three", false\], \["4", false\]\]/)
- end
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\[1, true\], \[2, true\], \["three", false\], \[4, false\]\]/)
end
it 'zips two arrays of numbers together and flattens them' do
# XXX This only tests the argument `true`, even though the following are valid:
@@ -41,11 +32,7 @@ describe 'zip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operati
$output = zip($one,$two,true)
notice(inline_template('<%= @output.inspect %>'))
EOS
- if is_future_parser_enabled?
- expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[1, 5, 2, 6, 3, 7, 4, 8\]/)
- else
- expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["1", "5", "2", "6", "3", "7", "4", "8"\]/)
- end
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[1, 5, 2, 6, 3, 7, 4, 8\]/)
end
it 'handles unmatched length' do
# XXX Is this expected behavior?
@@ -55,11 +42,7 @@ describe 'zip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operati
$output = zip($one,$two)
notice(inline_template('<%= @output.inspect %>'))
EOS
- if is_future_parser_enabled?
- expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\[1, 5\], \[2, 6\]\]/)
- else
- expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", "5"\], \["2", "6"\]\]/)
- end
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\[1, 5\], \[2, 6\]\]/)
end
end
describe 'failure' do
@@ -69,7 +52,6 @@ describe 'zip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operati
$output = zip($one)
notice(inline_template('<%= @output.inspect %>'))
EOS
-
expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/Wrong number of arguments/)
end
it 'handles improper argument types' do
@@ -79,7 +61,6 @@ describe 'zip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operati
$output = zip($one,$two)
notice(inline_template('<%= @output.inspect %>'))
EOS
-
expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/Requires array/)
end
end
diff --git a/spec/aliases/absolute_path_spec.rb b/spec/aliases/absolute_path_spec.rb
index 3fb9d12..308a3aa 100644
--- a/spec/aliases/absolute_path_spec.rb
+++ b/spec/aliases/absolute_path_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-if Puppet.version.to_f >= 4.5
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'test::absolute_path', type: :class do
describe 'valid paths handling' do
%w{
@@ -15,6 +15,9 @@ if Puppet.version.to_f >= 4.5
/
/var/tmp
/var/opt/../lib/puppet
+ /var/opt//lib/puppet
+ /var/ůťƒ8
+ /var/ネット
}.each do |value|
describe value.inspect do
let(:params) {{ value: value }}
@@ -50,6 +53,8 @@ if Puppet.version.to_f >= 4.5
etc/puppetlabs/puppet
opt/puppet/bin
relative\\windows
+ \var\ůťƒ8
+ \var\ネット
}.each do |value|
describe value.inspect do
let(:params) {{ value: value }}
diff --git a/spec/aliases/absolutepath_spec.rb b/spec/aliases/absolutepath_spec.rb
deleted file mode 100644
index aa435d7..0000000
--- a/spec/aliases/absolutepath_spec.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-require 'spec_helper'
-
-if Puppet.version.to_f >= 4.5
- describe 'test::absolutepath', type: :class do
- describe 'valid handling' do
- %w{
- /usr2/username/bin:/usr/local/bin:/usr/bin:.
- C:/
- C:\\
- C:\\WINDOWS\\System32
- C:/windows/system32
- X:/foo/bar
- X:\\foo\\bar
- \\\\host\\windows
- //host/windows
- /var/tmp
- /var/opt/../lib/puppet
- }.each do |value|
- describe value.inspect do
- let(:params) {{ value: value }}
- it { is_expected.to compile }
- end
- end
- end
-
- describe 'invalid path handling' do
- context 'garbage inputs' do
- [
- nil,
- [ nil ],
- [ nil, nil ],
- { 'foo' => 'bar' },
- { },
- '',
- "*/Users//nope",
- "\\Users/hc/wksp/stdlib",
- "C:noslashes",
- "\\var\\tmp"
- ].each do |value|
- describe value.inspect do
- let(:params) {{ value: value }}
- it { is_expected.to compile.and_raise_error(/parameter 'value' expects a match for Variant/) }
- end
- end
- end
-
- end
- end
-end
diff --git a/spec/aliases/array_spec.rb b/spec/aliases/array_spec.rb
index d0f9877..89cc2af 100644
--- a/spec/aliases/array_spec.rb
+++ b/spec/aliases/array_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-if Puppet.version.to_f >= 4.5
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'test::array', type: :class do
describe 'accepts arrays' do
[
diff --git a/spec/aliases/bool_spec.rb b/spec/aliases/bool_spec.rb
index 78c57fc..b84ab51 100644
--- a/spec/aliases/bool_spec.rb
+++ b/spec/aliases/bool_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-if Puppet.version.to_f >= 4.5
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'test::bool', type: :class do
describe 'accepts booleans' do
[
diff --git a/spec/aliases/float_spec.rb b/spec/aliases/float_spec.rb
index cc20758..84e1934 100644
--- a/spec/aliases/float_spec.rb
+++ b/spec/aliases/float_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-if Puppet.version.to_f >= 4.5
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'test::float', type: :class do
describe 'accepts floats' do
[
@@ -20,7 +20,7 @@ if Puppet.version.to_f >= 4.5
[ true, 'true', false, 'false', 'iAmAString', '1test', '1 test', 'test 1', 'test 1 test', {}, { 'key' => 'value' }, { 1=> 2 }, '', :undef , 'x', 3, '3', -3, '-3'].each do |value|
describe value.inspect do
let(:params) {{ value: value }}
- it { is_expected.to compile.and_raise_error(/parameter 'value' expects a value of type Float or Pattern(\[.*\]+)?/) }
+ it { is_expected.to compile.and_raise_error(/parameter 'value' expects.*Float.*Pattern/) }
end
end
end
diff --git a/spec/aliases/hash_spec.rb b/spec/aliases/hash_spec.rb
new file mode 100644
index 0000000..6e5060d
--- /dev/null
+++ b/spec/aliases/hash_spec.rb
@@ -0,0 +1,32 @@
+require 'spec_helper'
+
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
+ describe 'test::hash', type: :class do
+ describe 'accepts hashes' do
+ [
+ {},
+ {'one' => "two"},
+ {'wan' => 3},
+ {'001' => "helly"},
+ ].each do |value|
+ describe value.inspect do
+ let(:params) {{ value: value }}
+ it { is_expected.to compile }
+ end
+ end
+ end
+ describe 'rejects other values' do
+ [
+ '',
+ 'one',
+ '1',
+ [],
+ ].each do |value|
+ describe value.inspect do
+ let(:params) {{ value: value }}
+ it { is_expected.to compile.and_raise_error(/parameter 'value' expects a Stdlib::Compat::Hash/) }
+ end
+ end
+ end
+ end
+end
diff --git a/spec/aliases/httpsurl_spec.rb b/spec/aliases/httpsurl_spec.rb
index 97ae006..3e51118 100644
--- a/spec/aliases/httpsurl_spec.rb
+++ b/spec/aliases/httpsurl_spec.rb
@@ -1,12 +1,14 @@
require 'spec_helper'
-if Puppet.version.to_f >= 4.5
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'test::httpsurl', type: :class do
describe 'valid handling' do
%w{
https://hello.com
https://notcreative.org
https://notexciting.co.uk
+ https://graphemica.com/❤
+ https://graphemica.com/緩
}.each do |value|
describe value.inspect do
let(:params) {{ value: value }}
@@ -26,7 +28,9 @@ if Puppet.version.to_f >= 4.5
'',
"httds://notquiteright.org",
"hptts:/nah",
- "https;//notrightbutclose.org"
+ "https;//notrightbutclose.org",
+ "http://graphemica.com/❤",
+ "http://graphemica.com/緩"
].each do |value|
describe value.inspect do
let(:params) {{ value: value }}
diff --git a/spec/aliases/httpurl_spec.rb b/spec/aliases/httpurl_spec.rb
index 8bd57ca..fd49a47 100644
--- a/spec/aliases/httpurl_spec.rb
+++ b/spec/aliases/httpurl_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-if Puppet.version.to_f >= 4.5
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'test::httpurl', type: :class do
describe 'valid handling' do
%w{
@@ -10,6 +10,8 @@ if Puppet.version.to_f >= 4.5
http://anhttp.com
http://runningoutofideas.gov
http://
+ http://graphemica.com/❤
+ http://graphemica.com/緩
}.each do |value|
describe value.inspect do
let(:params) {{ value: value }}
@@ -29,7 +31,9 @@ if Puppet.version.to_f >= 4.5
'',
"httds://notquiteright.org",
"hptts:/nah",
- "https;//notrightbutclose.org"
+ "https;//notrightbutclose.org",
+ "hts://graphemica.com/❤",
+ "https:graphemica.com/緩"
].each do |value|
describe value.inspect do
let(:params) {{ value: value }}
diff --git a/spec/aliases/integer_spec.rb b/spec/aliases/integer_spec.rb
index 260090a..9cf0357 100644
--- a/spec/aliases/integer_spec.rb
+++ b/spec/aliases/integer_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-if Puppet.version.to_f >= 4.5
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'test::integer', type: :class do
describe 'accepts integers' do
[
@@ -8,6 +8,8 @@ if Puppet.version.to_f >= 4.5
'3',
-3,
'-3',
+ "123\nfoo",
+ "foo\n123",
].each do |value|
describe value.inspect do
let(:params) {{ value: value }}
@@ -17,10 +19,14 @@ if Puppet.version.to_f >= 4.5
end
describe 'rejects other values' do
- [ true, 'true', false, 'false', 'iAmAString', '1test', '1 test', 'test 1', 'test 1 test', {}, { 'key' => 'value' }, { 1=> 2 }, '', :undef , 'x', 3.7, '3.7',-3.7, '-342.2315e-12' ].each do |value|
+ [ "foo\nbar", true, 'true', false, 'false', 'iAmAString', '1test', '1 test', 'test 1', 'test 1 test', {}, { 'key' => 'value' }, { 1=> 2 }, '', :undef , 'x', 3.7, '3.7',-3.7, '-342.2315e-12' ].each do |value|
describe value.inspect do
let(:params) {{ value: value }}
- it { is_expected.to compile.and_raise_error(/parameter 'value' expects a value of type Integer, Pattern(\[.*\]+)?, or Array/) }
+ if Puppet::Util::Package.versioncmp(Puppet.version, '5.0.0') >= 0
+ it { is_expected.to compile.and_raise_error(/parameter 'value' expects a Stdlib::Compat::Integer = Variant\[Integer, Pattern\[.*\], Array\[.*\]\] value/) }
+ else
+ it { is_expected.to compile.and_raise_error(/parameter 'value' expects a value of type Integer, Pattern(\[.*\]+)?, or Array/) }
+ end
end
end
end
diff --git a/spec/aliases/ip_address.rb b/spec/aliases/ip_address.rb
index 664bf24..67a555c 100644
--- a/spec/aliases/ip_address.rb
+++ b/spec/aliases/ip_address.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-if Puppet.version.to_f >= 4.5
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'test::ip_address', type: :class do
describe 'accepts ipv4 and ipv6 addresses' do
[
diff --git a/spec/aliases/ipv4_spec.rb b/spec/aliases/ipv4_spec.rb
index 210b4b1..6a503ad 100644
--- a/spec/aliases/ipv4_spec.rb
+++ b/spec/aliases/ipv4_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-if Puppet.version.to_f >= 4.5
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'test::ipv4', type: :class do
describe 'accepts ipv4 addresses' do
SharedData::IPV4_PATTERNS.each do |value|
diff --git a/spec/aliases/ipv6_spec.rb b/spec/aliases/ipv6_spec.rb
index 13d7c3e..ae90f42 100644
--- a/spec/aliases/ipv6_spec.rb
+++ b/spec/aliases/ipv6_spec.rb
@@ -1,11 +1,18 @@
require 'spec_helper'
-if Puppet.version.to_f >= 4.5
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'test::ipv6', type: :class do
describe 'accepts ipv6 addresses' do
[
'2001:0db8:85a3:0000:0000:8a2e:0370:7334',
- 'fa76:8765:34ac:0823:ab76:eee9:0987:1111'
+ 'fa76:8765:34ac:0823:ab76:eee9:0987:1111',
+ 'fe80:0000:0000:0000:0204:61ff:fe9d:f156',
+ 'fe80:0:0:0:204:61ff:fe9d:f156',
+ 'fe80::204:61ff:fe9d:f156',
+ 'fe80:0:0:0:0204:61ff:254.157.241.86',
+ '::1',
+ 'fe80::',
+ '2001::',
].each do |value|
describe value.inspect do
let(:params) {{ value: value }}
@@ -18,7 +25,10 @@ if Puppet.version.to_f >= 4.5
'nope',
'77',
'4.4.4',
- '2000:7334'
+ '2000:7334',
+ '::ffff:2.3.4',
+ '::ffff:257.1.2.3',
+ '::ffff:12345678901234567890.1.26',
].each do |value|
describe value.inspect do
let(:params) {{ value: value }}
diff --git a/spec/aliases/numeric_spec.rb b/spec/aliases/numeric_spec.rb
index 0e98bee..09c28ec 100644
--- a/spec/aliases/numeric_spec.rb
+++ b/spec/aliases/numeric_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-if Puppet.version.to_f >= 4.5
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'test::numeric', type: :class do
describe 'accepts numerics' do
[
@@ -24,7 +24,7 @@ if Puppet.version.to_f >= 4.5
[ true, 'true', false, 'false', 'iAmAString', '1test', '1 test', 'test 1', 'test 1 test', {}, { 'key' => 'value' }, { 1=> 2 }, '', :undef , 'x' ].each do |value|
describe value.inspect do
let(:params) {{ value: value }}
- it { is_expected.to compile.and_raise_error(/parameter 'value' expects a value of type Numeric, Pattern(\[.*\]+)?, or Array/) }
+ it { is_expected.to compile.and_raise_error(/parameter 'value' expects.*Numeric.*Pattern.*Array/) }
end
end
end
diff --git a/spec/aliases/string_spec.rb b/spec/aliases/string_spec.rb
index 8a93585..4fc8ce6 100644
--- a/spec/aliases/string_spec.rb
+++ b/spec/aliases/string_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-if Puppet.version.to_f >= 4.5
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'test::string', type: :class do
describe 'accepts strings' do
[
@@ -24,7 +24,7 @@ if Puppet.version.to_f >= 4.5
].each do |value|
describe value.inspect do
let(:params) {{ value: value }}
- it { is_expected.to compile.and_raise_error(/parameter 'value' expects a String/) }
+ it { is_expected.to compile.and_raise_error(/parameter 'value' expects a (?:value of type Undef or )?.*String/) }
end
end
end
diff --git a/spec/aliases/unixpath_spec.rb b/spec/aliases/unixpath_spec.rb
index aee161d..6aecfe7 100644
--- a/spec/aliases/unixpath_spec.rb
+++ b/spec/aliases/unixpath_spec.rb
@@ -1,12 +1,16 @@
require 'spec_helper'
-if Puppet.version.to_f >= 4.5
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'test::unixpath', type: :class do
describe 'valid handling' do
%w{
/usr2/username/bin:/usr/local/bin:/usr/bin:.
/var/tmp
/Users/helencampbell/workspace/puppetlabs-stdlib
+ /var/ůťƒ8
+ /var/ネット
+ /var//tmp
+ /var/../tmp
}.each do |value|
describe value.inspect do
let(:params) {{ value: value }}
@@ -27,7 +31,9 @@ if Puppet.version.to_f >= 4.5
"C:/whatever",
"\\var\\tmp",
"\\Users/hc/wksp/stdlib",
- "*/Users//nope"
+ "*/Users//nope",
+ "var\ůťƒ8",
+ "var\ネット"
].each do |value|
describe value.inspect do
let(:params) {{ value: value }}
diff --git a/spec/aliases/windowspath_spec.rb b/spec/aliases/windowspath_spec.rb
index c13794e..c20e373 100644
--- a/spec/aliases/windowspath_spec.rb
+++ b/spec/aliases/windowspath_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-if Puppet.version.to_f >= 4.5
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'test::windowspath', type: :class do
describe 'valid handling' do
%w{
@@ -10,6 +10,8 @@ if Puppet.version.to_f >= 4.5
X:/foo/bar
X:\\foo\\bar
\\\\host\\windows
+ X:/var/ůťƒ8
+ X:/var/ネット
}.each do |value|
describe value.inspect do
let(:params) {{ value: value }}
@@ -30,7 +32,9 @@ if Puppet.version.to_f >= 4.5
"httds://notquiteright.org",
"/usr2/username/bin:/usr/local/bin:/usr/bin:.",
"C;//notright/here",
- "C:noslashes"
+ "C:noslashes",
+ "C:ネット",
+ "C:ůťƒ8"
].each do |value|
describe value.inspect do
let(:params) {{ value: value }}
@@ -38,7 +42,6 @@ if Puppet.version.to_f >= 4.5
end
end
end
-
end
end
end
diff --git a/spec/fixtures/test/manifests/deftype.pp b/spec/fixtures/test/manifests/deftype.pp
new file mode 100644
index 0000000..825f8fe
--- /dev/null
+++ b/spec/fixtures/test/manifests/deftype.pp
@@ -0,0 +1,3 @@
+define test::deftype($param = 'foo') {
+ notify { "deftype: $title": }
+}
diff --git a/spec/fixtures/test/manifests/hash.pp b/spec/fixtures/test/manifests/hash.pp
new file mode 100644
index 0000000..c243570
--- /dev/null
+++ b/spec/fixtures/test/manifests/hash.pp
@@ -0,0 +1,8 @@
+# Class to test the Stdlib::Compat::Hash type alias
+class test::hash(
+ Stdlib::Compat::Hash $value,
+ ) {
+
+ notice("Success")
+
+}
diff --git a/spec/functions/any2array_spec.rb b/spec/functions/any2array_spec.rb
index 70121f1..631657f 100755
--- a/spec/functions/any2array_spec.rb
+++ b/spec/functions/any2array_spec.rb
@@ -12,4 +12,10 @@ describe "any2array" do
it { is_expected.to run.with_params({}).and_return([]) }
it { is_expected.to run.with_params({ 'key' => 'value' }).and_return(['key', 'value']) }
it { is_expected.to run.with_params({ 'key' => 'value' }).and_return(['key', 'value']) }
+
+ it { is_expected.to run.with_params('‰').and_return(['‰']) }
+ it { is_expected.to run.with_params('竹').and_return(['竹']) }
+ it { is_expected.to run.with_params('Ü').and_return(['Ü']) }
+ it { is_expected.to run.with_params('∇').and_return(['∇']) }
+ it { is_expected.to run.with_params('€', '万', 'Ö', '♥', '割').and_return(['€', '万', 'Ö', '♥', '割']) }
end
diff --git a/spec/functions/basename_spec.rb b/spec/functions/basename_spec.rb
index c84e192..3e02b01 100755
--- a/spec/functions/basename_spec.rb
+++ b/spec/functions/basename_spec.rb
@@ -11,4 +11,9 @@ describe 'basename' do
it { is_expected.to run.with_params('/path/to/a/file.ext', '.ext').and_return('file') }
it { is_expected.to run.with_params('relative_path/to/a/file.ext', '.ext').and_return('file') }
it { is_expected.to run.with_params('scheme:///path/to/a/file.ext').and_return('file.ext') }
+
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params('scheme:///√ạĺűē/竹.ext').and_return('竹.ext') }
+ it { is_expected.to run.with_params('ҝẽγ:/√ạĺűē/竹.ㄘ', '.ㄘ').and_return('竹') }
+ end
end
diff --git a/spec/functions/chomp_spec.rb b/spec/functions/chomp_spec.rb
index 6878742..56bd9b1 100755
--- a/spec/functions/chomp_spec.rb
+++ b/spec/functions/chomp_spec.rb
@@ -17,4 +17,9 @@ describe 'chomp' do
it { is_expected.to run.with_params(AlsoString.new("one\n")).and_return("one") }
it { is_expected.to run.with_params(AlsoString.new("one\n\n")).and_return("one\n") }
it { is_expected.to run.with_params([AlsoString.new("one\n"), AlsoString.new("two"), "three\n"]).and_return(["one", "two", "three"]) }
+
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params("ůťƒ8\n\n").and_return("ůťƒ8\n") }
+ it { is_expected.to run.with_params("ネット\n\n").and_return("ネット\n") }
+ end
end
diff --git a/spec/functions/chop_spec.rb b/spec/functions/chop_spec.rb
index db7d18b..b70fc37 100755
--- a/spec/functions/chop_spec.rb
+++ b/spec/functions/chop_spec.rb
@@ -17,4 +17,9 @@ describe 'chop' do
it { is_expected.to run.with_params(AlsoString.new("one\n")).and_return("one") }
it { is_expected.to run.with_params(AlsoString.new("one\n\n")).and_return("one\n") }
it { is_expected.to run.with_params([AlsoString.new("one\n"), AlsoString.new("two"), "three\n"]).and_return(["one", "tw", "three"]) }
+
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params("ůťƒ8\n\n").and_return("ůťƒ8\n") }
+ it { is_expected.to run.with_params("ネット\n\n").and_return("ネット\n") }
+ end
end
diff --git a/spec/functions/concat_spec.rb b/spec/functions/concat_spec.rb
index eb76233..6ab1b6e 100755
--- a/spec/functions/concat_spec.rb
+++ b/spec/functions/concat_spec.rb
@@ -11,7 +11,11 @@ describe 'concat' do
it { is_expected.to run.with_params(['1','2','3'],[['4','5'],'6']).and_return(['1','2','3',['4','5'],'6']) }
it { is_expected.to run.with_params(['1','2'],['3','4'],['5','6']).and_return(['1','2','3','4','5','6']) }
it { is_expected.to run.with_params(['1','2'],'3','4',['5','6']).and_return(['1','2','3','4','5','6']) }
+
+context 'should run with UTF8 and double byte characters' do
it { is_expected.to run.with_params([{"a" => "b"}], {"c" => "d", "e" => "f"}).and_return([{"a" => "b"}, {"c" => "d", "e" => "f"}]) }
+ it { is_expected.to run.with_params(['ấ','β','©'],['đ','ể','文字列']).and_return(['ấ','β','©','đ','ể','文字列']) }
+end
it "should leave the original array intact" do
argument1 = ['1','2','3']
diff --git a/spec/functions/count_spec.rb b/spec/functions/count_spec.rb
index c8d1960..3854cb8 100755
--- a/spec/functions/count_spec.rb
+++ b/spec/functions/count_spec.rb
@@ -15,4 +15,9 @@ describe 'count' do
it { is_expected.to run.with_params(["one", nil, "two"]).and_return(2) }
it { is_expected.to run.with_params(["one", "", "two"]).and_return(2) }
it { is_expected.to run.with_params(["one", :undef, "two"]).and_return(2) }
+
+ it { is_expected.to run.with_params(["ổņ℮", "ŧщộ", "three"]).and_return(3) }
+ it { is_expected.to run.with_params(["ổņ℮", "ŧщộ", "ŧщộ"], "ŧщộ").and_return(2) }
+ it { is_expected.to run.with_params(["ổņ℮", nil, "ŧщộ"]).and_return(2) }
+ it { is_expected.to run.with_params(["ổņ℮", :undef, "ŧщộ"]).and_return(2) }
end
diff --git a/spec/functions/deep_merge_spec.rb b/spec/functions/deep_merge_spec.rb
index 397e048..819e025 100755
--- a/spec/functions/deep_merge_spec.rb
+++ b/spec/functions/deep_merge_spec.rb
@@ -4,7 +4,7 @@ describe 'deep_merge' do
it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
it { is_expected.to run.with_params({ 'key' => 'value' }).and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
it { is_expected.to run.with_params({}, '2').and_raise_error(Puppet::ParseError, /unexpected argument type String/) }
- it { is_expected.to run.with_params({}, 2).and_raise_error(Puppet::ParseError, /unexpected argument type Fixnum/) }
+ it { is_expected.to run.with_params({}, 2).and_raise_error(Puppet::ParseError, /unexpected argument/) }
it { is_expected.to run.with_params({}, '').and_return({}) }
it { is_expected.to run.with_params({}, {}).and_return({}) }
it { is_expected.to run.with_params({}, {}, {}).and_return({}) }
@@ -52,4 +52,8 @@ describe 'deep_merge' do
expect(argument1).to eq(original1)
expect(argument2).to eq(original2)
end
+
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params({'ĸέỹ1' => 'ϋǻļủë1'}, {'この文字列' => '万' }).and_return({'ĸέỹ1' => 'ϋǻļủë1', 'この文字列' => '万'}) }
+ end
end
diff --git a/spec/functions/defined_with_params_spec.rb b/spec/functions/defined_with_params_spec.rb
index e2f3abe..491a03b 100755
--- a/spec/functions/defined_with_params_spec.rb
+++ b/spec/functions/defined_with_params_spec.rb
@@ -11,6 +11,11 @@ describe 'defined_with_params' do
it { is_expected.to run.with_params('User[dan]', {}).and_return(true) }
it { is_expected.to run.with_params('User[bob]', {}).and_return(false) }
it { is_expected.to run.with_params('User[dan]', {'foo' => 'bar'}).and_return(false) }
+
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params('User[ĵĭмოү]', {}).and_return(false) }
+ it { is_expected.to run.with_params('User[ポーラ]', {}).and_return(false) }
+ end
end
describe 'when compared against a resource with attributes' do
@@ -32,4 +37,32 @@ describe 'defined_with_params' do
it { is_expected.to run.with_params('File[/tmp/a]', {}).and_return(true) }
it { is_expected.to run.with_params('File[/tmp/a]', { 'ensure' => 'present', 'owner' => :undef }).and_return(true) }
end
+
+ describe 'when the reference is a' do
+ let :pre_condition do
+ 'user { "dan": }'
+ end
+ context 'reference' do
+ it { is_expected.to run.with_params(Puppet::Resource.new('User[dan]'), {}).and_return(true) }
+ end
+ if Puppet::Util::Package.versioncmp(Puppet.version, '4.6.0') >= 0
+ context 'array' do
+ it 'fails' do
+ expect {
+ subject.call([['User[dan]'], {}])
+ }.to raise_error ArgumentError, /not understood: 'Array'/
+ end
+ end
+ end
+ end
+
+ describe 'when passed a defined type' do
+ let :pre_condition do
+ 'test::deftype { "foo": }'
+ end
+ it { is_expected.to run.with_params('Test::Deftype[foo]', {}).and_return(true) }
+ it { is_expected.to run.with_params('Test::Deftype[bar]', {}).and_return(false) }
+ it { is_expected.to run.with_params(Puppet::Resource.new('Test::Deftype[foo]'), {}).and_return(true) }
+ it { is_expected.to run.with_params(Puppet::Resource.new('Test::Deftype[bar]'), {}).and_return(false) }
+ end
end
diff --git a/spec/functions/delete_at_spec.rb b/spec/functions/delete_at_spec.rb
index 0e19472..0471039 100755
--- a/spec/functions/delete_at_spec.rb
+++ b/spec/functions/delete_at_spec.rb
@@ -18,6 +18,8 @@ describe 'delete_at' do
it { is_expected.to run.with_params([0, 1, 2], 1).and_return([0, 2]) }
it { is_expected.to run.with_params([0, 1, 2], -1).and_return([0, 1]) }
it { is_expected.to run.with_params([0, 1, 2], -4).and_return([0, 1, 2]) }
+ it { is_expected.to run.with_params(["ƒờở", "βāř", "ьầż"], 1).and_return(["ƒờở", "ьầż"]) }
+
it "should leave the original array intact" do
argument = [1, 2, 3]
diff --git a/spec/functions/delete_spec.rb b/spec/functions/delete_spec.rb
index b44accf..4e37865 100755
--- a/spec/functions/delete_spec.rb
+++ b/spec/functions/delete_spec.rb
@@ -19,6 +19,7 @@ describe 'delete' do
it { is_expected.to run.with_params(['one', 'two', 'three'], 'two').and_return(['one', 'three']) }
it { is_expected.to run.with_params(['two', 'one', 'two', 'three', 'two'], 'two').and_return(['one', 'three']) }
it { is_expected.to run.with_params(['one', 'two', 'three', 'two'], ['one', 'two']).and_return(['three']) }
+ it { is_expected.to run.with_params(['ồאּẻ', 'ŧẅơ', 'ŧңŗё℮', 'ŧẅơ'], ['ồאּẻ', 'ŧẅơ']).and_return(['ŧңŗё℮']) }
end
describe 'deleting from a string' do
@@ -30,7 +31,8 @@ describe 'delete' do
it { is_expected.to run.with_params('barfoobar', 'bar').and_return('foo') }
it { is_expected.to run.with_params('foobarbabarz', 'bar').and_return('foobaz') }
it { is_expected.to run.with_params('foobarbabarz', ['foo', 'bar']).and_return('baz') }
- # this is so sick
+ it { is_expected.to run.with_params('ƒōōβậяβậβậяź', ['ƒōō', 'βậя']).and_return('βậź') }
+
it { is_expected.to run.with_params('barfoobar', ['barbar', 'foo']).and_return('barbar') }
it { is_expected.to run.with_params('barfoobar', ['foo', 'barbar']).and_return('') }
end
@@ -47,6 +49,10 @@ describe 'delete' do
.with_params({'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'}, ['key1', 'key2']) \
.and_return( {'key3' => 'value3'})
}
+ it { is_expected.to run \
+ .with_params({'ĸəұ1' => 'νãŀủĕ1', 'ĸəұ2' => 'νãŀủĕ2', 'ĸəұ3' => 'νãŀủĕ3'}, ['ĸəұ1', 'ĸəұ2']) \
+ .and_return( {'ĸəұ3' => 'νãŀủĕ3'})
+ }
end
it "should leave the original array intact" do
diff --git a/spec/functions/delete_undef_values_spec.rb b/spec/functions/delete_undef_values_spec.rb
index ec9fb9c..c20cee2 100755
--- a/spec/functions/delete_undef_values_spec.rb
+++ b/spec/functions/delete_undef_values_spec.rb
@@ -16,6 +16,7 @@ describe 'delete_undef_values' do
end
it { is_expected.to run.with_params([undef_value]).and_return([]) }
it { is_expected.to run.with_params(['one',undef_value,'two','three']).and_return(['one','two','three']) }
+ it { is_expected.to run.with_params(['ớņέ',undef_value,'ŧשּׁō','ŧħґëə']).and_return(['ớņέ','ŧשּׁō','ŧħґëə']) }
end
it "should leave the original argument intact" do
diff --git a/spec/functions/delete_values_spec.rb b/spec/functions/delete_values_spec.rb
index 12907d4..329fa0b 100755
--- a/spec/functions/delete_values_spec.rb
+++ b/spec/functions/delete_values_spec.rb
@@ -19,7 +19,11 @@ describe 'delete_values' do
.and_return({'key1' => 'value1'})
}
it { is_expected.to run \
- .with_params({'key1' => 'value1', 'key2' => 'value to delete'}, 'value to delete') \
+ .with_params({'ҝếỵ1 ' => 'νâĺūẹ1', 'ҝếỵ2' => 'value to delete'}, 'value to delete') \
+ .and_return({'ҝếỵ1 ' => 'νâĺūẹ1'})
+ }
+ it { is_expected.to run \
+ .with_params({'key1' => 'value1', 'key2' => 'νǎŀữ℮ ťớ đêłểťė'}, 'νǎŀữ℮ ťớ đêłểťė') \
.and_return({'key1' => 'value1'})
}
it { is_expected.to run \
diff --git a/spec/functions/deprecation_spec.rb b/spec/functions/deprecation_spec.rb
index cee4f1c..bde4e89 100644
--- a/spec/functions/deprecation_spec.rb
+++ b/spec/functions/deprecation_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-if Puppet.version.to_f >= 4.0
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'deprecation' do
before(:each) {
# this is to reset the strict variable to default
@@ -40,7 +40,7 @@ if Puppet.version.to_f >= 4.0
Puppet.settings[:strict] = :warning
}
end
-else
+elsif Puppet.version.to_f < 4.0
# Puppet version < 4 will use these tests.
describe 'deprecation' do
after(:all) do
diff --git a/spec/functions/difference_spec.rb b/spec/functions/difference_spec.rb
index d5e983d..0ae3689 100755
--- a/spec/functions/difference_spec.rb
+++ b/spec/functions/difference_spec.rb
@@ -12,8 +12,10 @@ describe 'difference' do
it { is_expected.to run.with_params([], []).and_return([]) }
it { is_expected.to run.with_params([], ['one']).and_return([]) }
it { is_expected.to run.with_params(['one'], ['one']).and_return([]) }
+ it { is_expected.to run.with_params(['ớņέ'], ['']).and_return(['ớņέ']) }
it { is_expected.to run.with_params(['one'], []).and_return(['one']) }
it { is_expected.to run.with_params(['one', 'two', 'three'], ['two', 'three']).and_return(['one']) }
+ it { is_expected.to run.with_params(['ớņέ', 'ŧשּׁō', 'ŧħґëə', 2], ['ŧשּׁō', 'ŧħґëə']).and_return(['ớņέ', 2]) }
it { is_expected.to run.with_params(['one', 'two', 'two', 'three'], ['two', 'three']).and_return(['one']) }
it { is_expected.to run.with_params(['one', 'two', 'three'], ['two', 'two', 'three']).and_return(['one']) }
it { is_expected.to run.with_params(['one', 'two', 'three'], ['two', 'three', 'four']).and_return(['one']) }
diff --git a/spec/functions/dig44_spec.rb b/spec/functions/dig44_spec.rb
index 4f7408d..a7b8a3d 100644
--- a/spec/functions/dig44_spec.rb
+++ b/spec/functions/dig44_spec.rb
@@ -25,6 +25,18 @@ describe 'dig44' do
}
end
+ let(:utf8_data) do
+ {
+ 'ẵ' => {
+ 'в' => [
+ '©',
+ 'ĝ',
+ 'に',
+ ]
+ }
+ }
+ end
+
context 'single values' do
it 'should exist' do
is_expected.not_to be_nil
@@ -100,6 +112,20 @@ describe 'dig44' do
it 'should return "nil" if value is not found and no default value is provided' do
is_expected.to run.with_params(data, %w(a 1)).and_return(nil)
end
+ end
+
+ context 'Internationalization (i18N) values' do
+
+ it 'should be able to return a unicode character' do
+ is_expected.to run.with_params(utf8_data, ['ẵ', 'в', 0]).and_return('©')
+ end
+ it 'should be able to return a utf8 character' do
+ is_expected.to run.with_params(utf8_data, ['ẵ', 'в', 1]).and_return('ĝ')
+ end
+
+ it 'should be able to return a double byte character' do
+ is_expected.to run.with_params(utf8_data, ['ẵ', 'в', 2]).and_return('に')
+ end
end
end
diff --git a/spec/functions/dirname_spec.rb b/spec/functions/dirname_spec.rb
index 46c4c35..c494915 100755
--- a/spec/functions/dirname_spec.rb
+++ b/spec/functions/dirname_spec.rb
@@ -10,4 +10,9 @@ describe 'dirname' do
it { is_expected.to run.with_params('/path/to/a/file.ext', []).and_raise_error(Puppet::ParseError) }
it { is_expected.to run.with_params('/path/to/a/file.ext').and_return('/path/to/a') }
it { is_expected.to run.with_params('relative_path/to/a/file.ext').and_return('relative_path/to/a') }
+
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params('scheme:///√ạĺűē/竹.ext').and_return('scheme:///√ạĺűē') }
+ it { is_expected.to run.with_params('ҝẽγ:/√ạĺűē/竹.ㄘ').and_return('ҝẽγ:/√ạĺűē') }
+ end
end
diff --git a/spec/functions/dos2unix_spec.rb b/spec/functions/dos2unix_spec.rb
index 9c84703..97abae7 100644
--- a/spec/functions/dos2unix_spec.rb
+++ b/spec/functions/dos2unix_spec.rb
@@ -29,12 +29,19 @@ describe 'dos2unix' do
end
end
- context 'Converting from unix to unix format' do
- sample_text = "Hello\nWorld\n"
- desired_output = "Hello\nWorld\n"
+ context 'Internationalization (i18N) values' do
+ sample_text_utf8 = "Ħ℮ļłǿ\r\nשׁөŕłđ\r\n"
+ desired_output_utf8 = "Ħ℮ļłǿ\nשׁөŕłđ\n"
- it 'should output unix format' do
- should run.with_params(sample_text).and_return(desired_output)
+ sample_text_doublebyte = "こんにちは\r\n世界\r\n"
+ desired_output_doublebyte = "こんにちは\n世界\n"
+
+ it 'should output uft8 string' do
+ should run.with_params(sample_text_utf8).and_return(desired_output_utf8)
+ end
+
+ it 'should output double byte string' do
+ should run.with_params(sample_text_doublebyte).and_return(desired_output_doublebyte)
end
end
end
diff --git a/spec/functions/ensure_packages_spec.rb b/spec/functions/ensure_packages_spec.rb
index 5d97684..190e580 100755
--- a/spec/functions/ensure_packages_spec.rb
+++ b/spec/functions/ensure_packages_spec.rb
@@ -34,11 +34,38 @@ describe 'ensure_packages' do
end
end
+ context 'given an empty packages array' do
+ let(:pre_condition) { 'notify { "hi": } -> Package <| |>; $somearray = ["vim",""]; ensure_packages($somearray)' }
+
+ describe 'after running ensure_package(["vim", ""])' do
+ it { expect { catalogue }.to raise_error(Puppet::ParseError, /Empty String provided/) }
+ end
+ end
+
context 'given hash of packages' do
before { subject.call([{"foo" => { "provider" => "rpm" }, "bar" => { "provider" => "gem" }}, { "ensure" => "present"}]) }
+ before { subject.call([{"パッケージ" => { "ensure" => "absent"}}]) }
+ before { subject.call([{"ρǻ¢κầģẻ" => { "ensure" => "absent"}}]) }
# this lambda is required due to strangeness within rspec-puppet's expectation handling
it { expect(lambda { catalogue }).to contain_package('foo').with({'provider' => 'rpm', 'ensure' => 'present'}) }
it { expect(lambda { catalogue }).to contain_package('bar').with({'provider' => 'gem', 'ensure' => 'present'}) }
+
+ context 'should run with UTF8 and double byte characters' do
+ it { expect(lambda { catalogue }).to contain_package('パッケージ').with({'ensure' => 'absent'}) }
+ it { expect(lambda { catalogue }).to contain_package('ρǻ¢κầģẻ').with({'ensure' => 'absent'}) }
+ end
end
+
+ context 'given a catalog with "package { puppet: ensure => present }"' do
+ let(:pre_condition) { 'package { puppet: ensure => present }' }
+
+ describe 'after running ensure_package("puppet", { "ensure" => "installed" })' do
+ before { subject.call(['puppet', { "ensure" => "installed" }]) }
+
+ # this lambda is required due to strangeness within rspec-puppet's expectation handling
+ it { expect(lambda { catalogue }).to contain_package('puppet').with_ensure('present') }
+ end
+ end
+
end
diff --git a/spec/functions/ensure_resource_spec.rb b/spec/functions/ensure_resource_spec.rb
index d552f4e..c847bf7 100755
--- a/spec/functions/ensure_resource_spec.rb
+++ b/spec/functions/ensure_resource_spec.rb
@@ -4,7 +4,7 @@ describe 'ensure_resource' do
it { is_expected.not_to eq(nil) }
it { is_expected.to run.with_params().and_raise_error(ArgumentError, /Must specify a type/) }
it { is_expected.to run.with_params('type').and_raise_error(ArgumentError, /Must specify a title/) }
- if Puppet.version.to_f >= 4.6
+ if Puppet::Util::Package.versioncmp(Puppet.version, '4.6.0') >= 0
it { is_expected.to run.with_params('type', 'title', {}, 'extras').and_raise_error(ArgumentError) }
else
it { is_expected.to run.with_params('type', 'title', {}, 'extras').and_raise_error(Puppet::ParseError) }
@@ -39,6 +39,37 @@ describe 'ensure_resource' do
it { expect(lambda { catalogue }).to contain_user('username1').without_gid }
end
+ describe 'after running ensure_resource("test::deftype", "foo", {})' do
+ before { subject.call(['test::deftype', 'foo', {}]) }
+
+ # this lambda is required due to strangeness within rspec-puppet's expectation handling
+ it { expect(lambda { catalogue }).to contain_test__deftype('foo').without_ensure }
+ end
+ end
+
+ context 'given a catalog with UTF8 chars' do
+ describe 'after running ensure_resource("user", "Şắოрŀễ Ţëם", {})' do
+ before { subject.call(['User', 'Şắოрŀễ Ţëם', {}]) }
+
+ # this lambda is required due to strangeness within rspec-puppet's expectation handling
+ it { expect(lambda { catalogue }).to contain_user('Şắოрŀễ Ţëם').without_ensure }
+ end
+
+ describe 'after running ensure_resource("user", "Şắოрŀễ Ţëם", { gid => undef })' do
+ before { subject.call(['User', 'Şắოрŀễ Ţëם', { 'gid' => :undef }]) }
+
+ # this lambda is required due to strangeness within rspec-puppet's expectation handling
+ it { expect(lambda { catalogue }).to contain_user('Şắოрŀễ Ţëם').without_ensure }
+ it { expect(lambda { catalogue }).to contain_user('Şắოрŀễ Ţëם').without_gid }
+ end
+
+ describe 'after running ensure_resource("user", "Şắოрŀễ Ţëם", { ensure => present, gid => undef })' do
+ before { subject.call(['User', 'Şắოрŀễ Ţëם', { 'ensure' => 'present', 'gid' => :undef }]) }
+
+ # this lambda is required due to strangeness within rspec-puppet's expectation handling
+ it { expect(lambda { catalogue }).to contain_user('Şắოрŀễ Ţëם').with_ensure('present') }
+ it { expect(lambda { catalogue }).to contain_user('Şắოрŀễ Ţëם').without_gid }
+ end
end
context 'given a catalog with "user { username1: ensure => present }"' do
@@ -90,4 +121,15 @@ describe 'ensure_resource' do
}
end
end
+
+ context 'given a catalog with "test::deftype { foo: }"' do
+ let(:pre_condition) { 'test::deftype { "foo": }' }
+
+ describe 'after running ensure_resource("test::deftype", "foo", {})' do
+ before { subject.call(['test::deftype', 'foo', {}]) }
+
+ # this lambda is required due to strangeness within rspec-puppet's expectation handling
+ it { expect(lambda { catalogue }).to contain_test__deftype('foo').without_ensure }
+ end
+ end
end
diff --git a/spec/functions/ensure_resources_spec.rb b/spec/functions/ensure_resources_spec.rb
new file mode 100644
index 0000000..7cca671
--- /dev/null
+++ b/spec/functions/ensure_resources_spec.rb
@@ -0,0 +1,25 @@
+require 'spec_helper'
+
+describe 'ensure_resources' do
+ it { is_expected.not_to eq(nil) }
+ it { is_expected.to run.with_params().and_raise_error(ArgumentError, /Must specify a type/) }
+ it { is_expected.to run.with_params('type').and_raise_error(ArgumentError, /Must specify a title/) }
+
+ describe 'given a title hash of multiple resources' do
+ before { subject.call(['user', {'dan' => { 'gid' => 'mygroup', 'uid' => '600' }, 'alex' => { 'gid' => 'mygroup', 'uid' => '700'}}, {'ensure' => 'present'}]) }
+
+ # this lambda is required due to strangeness within rspec-puppet's expectation handling
+ it { expect(lambda { catalogue }).to contain_user('dan').with_ensure('present') }
+ it { expect(lambda { catalogue }).to contain_user('alex').with_ensure('present') }
+ it { expect(lambda { catalogue }).to contain_user('dan').with({ 'gid' => 'mygroup', 'uid' => '600'}) }
+ it { expect(lambda { catalogue }).to contain_user('alex').with({ 'gid' => 'mygroup', 'uid' => '700'}) }
+ end
+
+ describe 'given a title hash of a single resource' do
+ before { subject.call(['user', {'dan' => { 'gid' => 'mygroup', 'uid' => '600' }}, {'ensure' => 'present'}]) }
+
+ # this lambda is required due to strangeness within rspec-puppet's expectation handling
+ it { expect(lambda { catalogue }).to contain_user('dan').with_ensure('present') }
+ it { expect(lambda { catalogue }).to contain_user('dan').with({ 'gid' => 'mygroup', 'uid' => '600'}) }
+ end
+end
diff --git a/spec/functions/flatten_spec.rb b/spec/functions/flatten_spec.rb
index a4338be..b80f3c5 100755
--- a/spec/functions/flatten_spec.rb
+++ b/spec/functions/flatten_spec.rb
@@ -11,4 +11,5 @@ describe 'flatten' do
it { is_expected.to run.with_params([['one']]).and_return(['one']) }
it { is_expected.to run.with_params(["a","b","c","d","e","f","g"]).and_return(["a","b","c","d","e","f","g"]) }
it { is_expected.to run.with_params([["a","b",["c",["d","e"],"f","g"]]]).and_return(["a","b","c","d","e","f","g"]) }
+ it { is_expected.to run.with_params(["ã","β",["ĉ",["đ","ẽ","ƒ","ġ"]]]).and_return(["ã","β","ĉ","đ","ẽ","ƒ","ġ"]) }
end
diff --git a/spec/functions/fqdn_rand_string_spec.rb b/spec/functions/fqdn_rand_string_spec.rb
index e407084..861a59e 100644
--- a/spec/functions/fqdn_rand_string_spec.rb
+++ b/spec/functions/fqdn_rand_string_spec.rb
@@ -20,6 +20,7 @@ describe 'fqdn_rand_string' do
it { is_expected.to run.with_params(100, '').and_return(default_charset) }
it { is_expected.to run.with_params(100, 'a').and_return(/\Aa{100}\z/) }
it { is_expected.to run.with_params(100, 'ab').and_return(/\A[ab]{100}\z/) }
+ it { is_expected.to run.with_params(100, 'ãβ').and_return(/\A[ãβ]{100}\z/) }
it "provides the same 'random' value on subsequent calls for the same host" do
expect(fqdn_rand_string(10)).to eql(fqdn_rand_string(10))
diff --git a/spec/functions/fqdn_rotate_spec.rb b/spec/functions/fqdn_rotate_spec.rb
index db7a717..7c1038a 100755
--- a/spec/functions/fqdn_rotate_spec.rb
+++ b/spec/functions/fqdn_rotate_spec.rb
@@ -7,6 +7,7 @@ describe 'fqdn_rotate' do
it { is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError, /Requires either array or string to work with/) }
it { is_expected.to run.with_params('').and_return('') }
it { is_expected.to run.with_params('a').and_return('a') }
+ it { is_expected.to run.with_params('ã').and_return('ã') }
it { is_expected.to run.with_params([]).and_return([]) }
it { is_expected.to run.with_params(['a']).and_return(['a']) }
diff --git a/spec/functions/fqdn_uuid_spec.rb b/spec/functions/fqdn_uuid_spec.rb
index a2d1618..d0c30d6 100644
--- a/spec/functions/fqdn_uuid_spec.rb
+++ b/spec/functions/fqdn_uuid_spec.rb
@@ -10,5 +10,4 @@ describe 'fqdn_uuid' do
it { should run.with_params('puppetlabs.com').and_return('9c70320f-6815-5fc5-ab0f-debe68bf764c') }
it { should run.with_params('google.com').and_return('64ee70a4-8cc1-5d25-abf2-dea6c79a09c8') }
end
-
end
diff --git a/spec/functions/getparam_spec.rb b/spec/functions/getparam_spec.rb
index e4ef9e6..522ed3b 100755
--- a/spec/functions/getparam_spec.rb
+++ b/spec/functions/getparam_spec.rb
@@ -24,4 +24,12 @@ describe 'getparam' do
it { is_expected.to run.with_params('User[one]', 'shell').and_return('/bin/sh') }
it { is_expected.to run.with_params('User[one]', 'managehome').and_return(false) }
end
+
+ describe 'when compared against a user resource with UTF8 and double byte params' do
+ let(:pre_condition) { 'user { ["三", "ƒốưř"]: ensure => present }' }
+
+ it { is_expected.to run.with_params('User[三]', 'ensure').and_return('present') }
+ it { is_expected.to run.with_params('User[ƒốưř]', 'ensure').and_return('present') }
+
+ end
end
diff --git a/spec/functions/getvar_spec.rb b/spec/functions/getvar_spec.rb
index 54f1842..55789d8 100755
--- a/spec/functions/getvar_spec.rb
+++ b/spec/functions/getvar_spec.rb
@@ -20,4 +20,19 @@ describe 'getvar' do
it { is_expected.to run.with_params('::site::data::foo').and_return('baz') }
it { is_expected.to run.with_params('::site::data::bar').and_return(nil) }
end
+
+ context 'given variables in namespaces' do
+ let(:pre_condition) {
+ <<-'ENDofPUPPETcode'
+ class site::info { $lock = 'ŧҺîš íš ắ śţřĭŋĝ' }
+ class site::new { $item = '万Ü€‰' }
+ include site::info
+ include site::new
+ ENDofPUPPETcode
+ }
+
+ it { is_expected.to run.with_params('site::info::lock').and_return('ŧҺîš íš ắ śţřĭŋĝ') }
+ it { is_expected.to run.with_params('::site::new::item').and_return('万Ü€‰') }
+ end
end
+
diff --git a/spec/functions/glob_spec.rb b/spec/functions/glob_spec.rb
new file mode 100755
index 0000000..06439da
--- /dev/null
+++ b/spec/functions/glob_spec.rb
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe 'glob' do
+ it { is_expected.not_to eq(nil) }
+ it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError) }
+ it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError) }
+ it { is_expected.to run.with_params('').and_return([]) }
+ it { is_expected.to run.with_params(['']).and_return([]) }
+ it { is_expected.to run.with_params(['', '']).and_return([]) }
+ it { is_expected.to run.with_params(['/etc/xyzxyzxyz', '/etcxyzxyzxyz']).and_return([]) }
+end
diff --git a/spec/functions/grep_spec.rb b/spec/functions/grep_spec.rb
index 6e0bd6e..d2152b1 100755
--- a/spec/functions/grep_spec.rb
+++ b/spec/functions/grep_spec.rb
@@ -16,4 +16,5 @@ describe 'grep' do
it { is_expected.to run.with_params([], 'two').and_return([]) }
it { is_expected.to run.with_params(['one', 'two', 'three'], 'two').and_return(['two']) }
it { is_expected.to run.with_params(['one', 'two', 'three'], 't(wo|hree)').and_return(['two', 'three']) }
+ it { is_expected.to run.with_params(['ờאּê', 'ţשּׂỡ', 'ţһŗəè'], 'ţ(שּׂỡ|һŗəè)').and_return(['ţשּׂỡ', 'ţһŗəè']) }
end
diff --git a/spec/functions/has_ip_network_spec.rb b/spec/functions/has_ip_network_spec.rb
index 7b5fe66..57cf613 100755
--- a/spec/functions/has_ip_network_spec.rb
+++ b/spec/functions/has_ip_network_spec.rb
@@ -9,7 +9,6 @@ describe 'has_ip_network' do
let(:facts) do
{
:interfaces => 'eth0,lo',
- :network => :undefined,
:network_lo => '127.0.0.0',
:network_eth0 => '10.0.0.0',
}
diff --git a/spec/functions/has_key_spec.rb b/spec/functions/has_key_spec.rb
index 965d5a6..0e0e1cc 100755
--- a/spec/functions/has_key_spec.rb
+++ b/spec/functions/has_key_spec.rb
@@ -12,4 +12,9 @@ describe 'has_key' do
it { is_expected.to run.with_params({ 'key' => 'value' }, "key").and_return(true) }
it { is_expected.to run.with_params({}, "key").and_return(false) }
it { is_expected.to run.with_params({ 'key' => 'value'}, "not a key").and_return(false) }
+
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params({ 'κéỳ ' => '٧ậļųể' }, "κéỳ ").and_return(true) }
+ it { is_expected.to run.with_params({ 'キー' => '٧ậļųể' }, "キー").and_return(true) }
+ end
end
diff --git a/spec/functions/hash_spec.rb b/spec/functions/hash_spec.rb
index 4fe99ce..092474b 100755
--- a/spec/functions/hash_spec.rb
+++ b/spec/functions/hash_spec.rb
@@ -10,5 +10,6 @@ describe 'hash' do
it { is_expected.to run.with_params(['one']).and_raise_error(Puppet::ParseError, /Unable to compute/) }
it { is_expected.to run.with_params([]).and_return({}) }
it { is_expected.to run.with_params(['key1', 'value1']).and_return({ 'key1' => 'value1' }) }
+ it { is_expected.to run.with_params(['κ℮ұ1', '√āĺűẻ1']).and_return({ 'κ℮ұ1' => '√āĺűẻ1' }) }
it { is_expected.to run.with_params(['key1', 'value1', 'key2', 'value2']).and_return({ 'key1' => 'value1', 'key2' => 'value2' }) }
end
diff --git a/spec/functions/intersection_spec.rb b/spec/functions/intersection_spec.rb
index c0f6086..ec368a5 100755
--- a/spec/functions/intersection_spec.rb
+++ b/spec/functions/intersection_spec.rb
@@ -14,6 +14,7 @@ describe 'intersection' do
it { is_expected.to run.with_params(['one'], []).and_return([]) }
it { is_expected.to run.with_params(['one'], ['one']).and_return(['one']) }
it { is_expected.to run.with_params(['one', 'two', 'three'], ['two', 'three']).and_return(['two', 'three']) }
+ it { is_expected.to run.with_params(['ōŋể', 'ŧשợ', 'ţђŕẽё'], ['ŧשợ', 'ţђŕẽё']).and_return(['ŧשợ', 'ţђŕẽё']) }
it { is_expected.to run.with_params(['one', 'two', 'two', 'three'], ['two', 'three']).and_return(['two', 'three']) }
it { is_expected.to run.with_params(['one', 'two', 'three'], ['two', 'two', 'three']).and_return(['two', 'three']) }
it { is_expected.to run.with_params(['one', 'two', 'three'], ['two', 'three', 'four']).and_return(['two', 'three']) }
diff --git a/spec/functions/is_a_spec.rb b/spec/functions/is_a_spec.rb
index 8dec13f..2d6cb46 100644
--- a/spec/functions/is_a_spec.rb
+++ b/spec/functions/is_a_spec.rb
@@ -21,5 +21,10 @@ if Puppet.version.to_f >= 4.0
it 'fails when comparing an integer and a string' do
is_expected.to run.with_params(5, String).and_return(false)
end
+
+ it 'suceeds when comparing an UTF8 and double byte characters' do
+ is_expected.to run.with_params('このテキスト', String).and_return(true)
+ is_expected.to run.with_params('ŧћịś ŧêχŧ', String).and_return(true)
+ end
end
end
diff --git a/spec/functions/is_function_available.rb b/spec/functions/is_function_available_spec.rb
index 44f08c0..44f08c0 100755
--- a/spec/functions/is_function_available.rb
+++ b/spec/functions/is_function_available_spec.rb
diff --git a/spec/functions/is_integer_spec.rb b/spec/functions/is_integer_spec.rb
index b296830..8118ef4 100755
--- a/spec/functions/is_integer_spec.rb
+++ b/spec/functions/is_integer_spec.rb
@@ -11,6 +11,8 @@ describe 'is_integer' do
it { is_expected.to run.with_params('3').and_return(true) }
it { is_expected.to run.with_params(-3).and_return(true) }
it { is_expected.to run.with_params('-3').and_return(true) }
+ it { is_expected.to run.with_params("123\nfoo").and_return(true) }
+ it { is_expected.to run.with_params("foo\n123").and_return(true) }
it { is_expected.to run.with_params(3.7).and_return(false) }
it { is_expected.to run.with_params('3.7').and_return(false) }
@@ -24,6 +26,7 @@ describe 'is_integer' do
it { is_expected.to run.with_params(true).and_return(false) }
it { is_expected.to run.with_params(false).and_return(false) }
it { is_expected.to run.with_params('0001234').and_return(false) }
+ it { is_expected.to run.with_params("foo\nbar").and_return(false) }
context 'Checking for deprecation warning' do
after(:all) do
diff --git a/spec/functions/is_mac_address_spec.rb b/spec/functions/is_mac_address_spec.rb
index 5f76a91..c1e33b8 100755
--- a/spec/functions/is_mac_address_spec.rb
+++ b/spec/functions/is_mac_address_spec.rb
@@ -9,6 +9,12 @@ describe 'is_mac_address' do
it { is_expected.to run.with_params('00:00:00:00:00:0g').and_return(false) }
it { is_expected.to run.with_params('').and_return(false) }
it { is_expected.to run.with_params('one').and_return(false) }
+
+ context 'function can handle UTF8 and double byte characters' do
+ it { is_expected.to run.with_params('ƒốưř').and_return(false) }
+ it { is_expected.to run.with_params('三+').and_return(false) }
+ end
+
it {
pending "should properly typecheck its arguments"
is_expected.to run.with_params(1).and_return(false)
diff --git a/spec/functions/join_keys_to_values_spec.rb b/spec/functions/join_keys_to_values_spec.rb
index c2bae5b..0a2a50c 100755
--- a/spec/functions/join_keys_to_values_spec.rb
+++ b/spec/functions/join_keys_to_values_spec.rb
@@ -11,6 +11,12 @@ describe 'join_keys_to_values' do
it { is_expected.to run.with_params({}, ':').and_return([]) }
it { is_expected.to run.with_params({ 'key' => 'value' }, '').and_return(['keyvalue']) }
it { is_expected.to run.with_params({ 'key' => 'value' }, ':').and_return(['key:value']) }
+
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params({ 'ҝẽγ' => '√ạĺűē' }, ':').and_return(['ҝẽγ:√ạĺűē']) }
+ it { is_expected.to run.with_params({ 'ҝẽγ' => '√ạĺűē' }, '万').and_return(['ҝẽγ万√ạĺűē']) }
+ end
+
it { is_expected.to run.with_params({ 'key' => nil }, ':').and_return(['key:']) }
it 'should run join_keys_to_values(<hash with multiple keys>, ":") and return the proper array' do
result = subject.call([{ 'key1' => 'value1', 'key2' => 'value2' }, ':'])
@@ -21,3 +27,4 @@ describe 'join_keys_to_values' do
expect(result.sort).to eq(['key1 value1', 'key2 value2', 'key2 value3'].sort)
end
end
+
diff --git a/spec/functions/join_spec.rb b/spec/functions/join_spec.rb
index a300571..98852d5 100755
--- a/spec/functions/join_spec.rb
+++ b/spec/functions/join_spec.rb
@@ -16,4 +16,5 @@ describe 'join' do
it { is_expected.to run.with_params(['one'], ':').and_return('one') }
it { is_expected.to run.with_params(['one', 'two', 'three']).and_return('onetwothree') }
it { is_expected.to run.with_params(['one', 'two', 'three'], ':').and_return('one:two:three') }
+ it { is_expected.to run.with_params(['ōŋể', 'ŧשợ', 'ţђŕẽё'], ':').and_return('ōŋể:ŧשợ:ţђŕẽё') }
end
diff --git a/spec/functions/keys_spec.rb b/spec/functions/keys_spec.rb
index 2e009dc..fc7d6d8 100755
--- a/spec/functions/keys_spec.rb
+++ b/spec/functions/keys_spec.rb
@@ -16,4 +16,9 @@ describe 'keys' do
result = subject.call([{ 'key1' => 'value1', 'key2' => 'value2' }])
expect(result).to match_array(['key1', 'key2'])
end
+
+ it 'should run with UTF8 and double byte characters' do
+ result = subject.call([{ 'ҝểү' => '√ẳŀμệ', 'キー' => '値' }])
+ expect(result).to match_array(['ҝểү', 'キー'])
+ end
end
diff --git a/spec/functions/length_spec.rb b/spec/functions/length_spec.rb
new file mode 100755
index 0000000..487cf21
--- /dev/null
+++ b/spec/functions/length_spec.rb
@@ -0,0 +1,31 @@
+require 'spec_helper'
+
+describe 'length' do
+ it { is_expected.not_to eq(nil) }
+ it { is_expected.to run.with_params().and_raise_error(ArgumentError, /'length' expects 1 argument, got none/) }
+ it { is_expected.to run.with_params([], 'extra').and_raise_error(ArgumentError, /'length' expects 1 argument, got 2/) }
+ it { is_expected.to run.with_params(1).and_raise_error(ArgumentError, /expects a value of type String, Array, or Hash, got Integer/) }
+ it { is_expected.to run.with_params(true).and_raise_error(ArgumentError, /expects a value of type String, Array, or Hash, got Boolean/) }
+ it { is_expected.to run.with_params('1').and_return(1) }
+ it { is_expected.to run.with_params('1.0').and_return(3) }
+ it { is_expected.to run.with_params([]).and_return(0) }
+ it { is_expected.to run.with_params(['a']).and_return(1) }
+ it { is_expected.to run.with_params(['one', 'two', 'three']).and_return(3) }
+ it { is_expected.to run.with_params(['one', 'two', 'three', 'four']).and_return(4) }
+
+ it { is_expected.to run.with_params({}).and_return(0) }
+ it { is_expected.to run.with_params({'1' => '2'}).and_return(1) }
+ it { is_expected.to run.with_params({'1' => '2', '4' => '4'}).and_return(2) }
+ it { is_expected.to run.with_params({'€' => '@', '竹' => 'ǿňè'}).and_return(2) }
+
+ it { is_expected.to run.with_params('').and_return(0) }
+ it { is_expected.to run.with_params('a').and_return(1) }
+ it { is_expected.to run.with_params('abc').and_return(3) }
+ it { is_expected.to run.with_params('abcd').and_return(4) }
+ it { is_expected.to run.with_params('万').and_return(1) }
+ it { is_expected.to run.with_params('āβćđ').and_return(4) }
+
+ context 'when using a class extending String' do
+ it { is_expected.to run.with_params(AlsoString.new('asdfghjkl')).and_return(9) }
+ end
+end
diff --git a/spec/functions/load_module_metadata_spec.rb b/spec/functions/load_module_metadata_spec.rb
index 1a61e2c..9496fcb 100755
--- a/spec/functions/load_module_metadata_spec.rb
+++ b/spec/functions/load_module_metadata_spec.rb
@@ -7,32 +7,55 @@ describe 'load_module_metadata' do
describe "when calling with valid arguments" do
before :each do
- if RSpec.configuration.puppet_future
- allow(File).to receive(:read).with(/\/stdlib\/metadata.json/, {:encoding=>"utf-8"}).and_return('{"name": "puppetlabs-stdlib"}')
- else
- allow(File).to receive(:read).with(/\/stdlib\/metadata.json/).and_return('{"name": "puppetlabs-stdlib"}')
- end
+ allow(File).to receive(:read).with(/\/(stdlib|test)\/metadata.json/, {:encoding=>"utf-8"}).and_return('{"name": "puppetlabs-stdlib"}')
+ allow(File).to receive(:read).with(/\/(stdlib|test)\/metadata.json/).and_return('{"name": "puppetlabs-stdlib"}')
end
+
+ context "when calling with valid utf8 and double byte character arguments" do
+ before :each do
+ allow(File).to receive(:read).with(/\/(stdlib|test)\/metadata.json/, {:encoding=>"utf-8"}).and_return('{"ĭďèʼnţĩƒіểя": "ċơņťęאּť ỡƒ ţħíš -
+この文字"}')
+ allow(File).to receive(:read).with(/\/(stdlib|test)\/metadata.json/).and_return('{"ĭďèʼnţĩƒіểя": "ċơņťęאּť ỡƒ ţħíš -
+この文字"}')
+ end
+
it "should json parse the file" do
- allow(scope).to receive(:function_get_module_path).with(['science']).and_return('/path/to/module/')
- allow(File).to receive(:exists?).with('/path/to/module/metadata.json').and_return(true)
- allow(File).to receive(:read).with('/path/to/module/metadata.json').and_return('{"name": "spencer-science"}')
+ if Puppet::Util::Platform.windows?
+ allow(scope).to receive(:function_get_module_path).with(['science']).and_return('C:/path/to/module/')
+ allow(File).to receive(:exists?).with('C:/path/to/module/metadata.json').and_return(true)
+ allow(File).to receive(:read).with('C:/path/to/module/metadata.json').and_return('{"name": "spencer-science"}')
+ else
+ allow(scope).to receive(:function_get_module_path).with(['science']).and_return('/path/to/module/')
+ allow(File).to receive(:exists?).with('/path/to/module/metadata.json').and_return(true)
+ allow(File).to receive(:read).with('/path/to/module/metadata.json').and_return('{"name": "spencer-science"}')
+ end
result = subject.call(['science'])
expect(result['name']).to eq('spencer-science')
end
it "should fail by default if there is no metadata.json" do
- allow(scope).to receive(:function_get_module_path).with(['science']).and_return('/path/to/module/')
- allow(File).to receive(:exists?).with('/path/to/module/metadata.json').and_return(false)
+ if Puppet::Util::Platform.windows?
+ allow(scope).to receive(:function_get_module_path).with(['science']).and_return('C:/path/to/module/')
+ allow(File).to receive(:exists?).with('C:/path/to/module/metadata.json').and_return(false)
+ else
+ allow(scope).to receive(:function_get_module_path).with(['science']).and_return('/path/to/module/')
+ allow(File).to receive(:exists?).with('/path/to/module/metadata.json').and_return(false)
+ end
expect {subject.call(['science'])}.to raise_error(Puppet::ParseError)
end
it "should return nil if user allows empty metadata.json" do
- allow(scope).to receive(:function_get_module_path).with(['science']).and_return('/path/to/module/')
- allow(File).to receive(:exists?).with('/path/to/module/metadata.json').and_return(false)
+ if Puppet::Util::Platform.windows?
+ allow(scope).to receive(:function_get_module_path).with(['science']).and_return('C:/path/to/module/')
+ allow(File).to receive(:exists?).with('C:/path/to/module/metadata.json').and_return(false)
+ else
+ allow(scope).to receive(:function_get_module_path).with(['science']).and_return('/path/to/module/')
+ allow(File).to receive(:exists?).with('/path/to/module/metadata.json').and_return(false)
+ end
result = subject.call(['science', true])
expect(result).to eq({})
end
+ end
end
end
diff --git a/spec/functions/loadjson_spec.rb b/spec/functions/loadjson_spec.rb
index a00dff9..dbef805 100644
--- a/spec/functions/loadjson_spec.rb
+++ b/spec/functions/loadjson_spec.rb
@@ -6,26 +6,37 @@ describe 'loadjson' do
describe "when calling with valid arguments" do
before :each do
- if RSpec.configuration.puppet_future
- allow(File).to receive(:read).with(/\/stdlib\/metadata.json/, {:encoding=>"utf-8"}).and_return('{"name": "puppetlabs-stdlib"}')
- else
- allow(File).to receive(:read).with(/\/stdlib\/metadata.json/).and_return('{"name": "puppetlabs-stdlib"}')
- end
+ allow(File).to receive(:read).with(/\/(stdlib|test)\/metadata.json/, {:encoding=>"utf-8"}).and_return('{"name": "puppetlabs-stdlib"}')
+ allow(File).to receive(:read).with(/\/(stdlib|test)\/metadata.json/).and_return('{"name": "puppetlabs-stdlib"}')
end
context 'when a non-existing file is specified' do
- let(:filename) { '/tmp/doesnotexist' }
+ let(:filename) {
+ if Puppet::Util::Platform.windows?
+ 'C:/tmp/doesnotexist'
+ else
+ '/tmp/doesnotexist'
+ end
+ }
before {
allow(File).to receive(:exists?).with(filename).and_return(false).once
allow(PSON).to receive(:load).never
}
it { is_expected.to run.with_params(filename, {'default' => 'value'}).and_return({'default' => 'value'}) }
+ it { is_expected.to run.with_params(filename, {'đẽƒằưļŧ' => '٧ẵłựέ'}).and_return({'đẽƒằưļŧ' => '٧ẵłựέ'}) }
+ it { is_expected.to run.with_params(filename, {'デフォルト' => '値'}).and_return({'デフォルト' => '値'}) }
end
context 'when an existing file is specified' do
- let(:filename) { '/tmp/doesexist' }
- let(:data) { { 'key' => 'value' } }
- let(:json) { '{"key":"value"}' }
+ let(:filename) {
+ if Puppet::Util::Platform.windows?
+ 'C:/tmp/doesexist'
+ else
+ '/tmp/doesexist'
+ end
+ }
+ let(:data) { { 'key' => 'value', 'ķęŷ' => 'νậŀųề', 'キー' => '値'} }
+ let(:json) { '{"key":"value", {"ķęŷ":"νậŀųề" }, {"キー":"値" }' }
before {
allow(File).to receive(:exists?).with(filename).and_return(true).once
allow(File).to receive(:read).with(filename).and_return(json).once
@@ -36,7 +47,13 @@ describe 'loadjson' do
end
context 'when the file could not be parsed' do
- let(:filename) { '/tmp/doesexist' }
+ let(:filename) {
+ if Puppet::Util::Platform.windows?
+ 'C:/tmp/doesexist'
+ else
+ '/tmp/doesexist'
+ end
+ }
let(:json) { '{"key":"value"}' }
before {
allow(File).to receive(:exists?).with(filename).and_return(true).once
diff --git a/spec/functions/loadyaml_spec.rb b/spec/functions/loadyaml_spec.rb
index 9f16a1a..e9428e3 100755
--- a/spec/functions/loadyaml_spec.rb
+++ b/spec/functions/loadyaml_spec.rb
@@ -11,11 +11,13 @@ describe 'loadyaml' do
YAML.expects(:load_file).never
}
it { is_expected.to run.with_params(filename, {'default' => 'value'}).and_return({'default' => 'value'}) }
+ it { is_expected.to run.with_params(filename, {'đẽƒằưļŧ' => '٧ẵłựέ'}).and_return({'đẽƒằưļŧ' => '٧ẵłựέ'}) }
+ it { is_expected.to run.with_params(filename, {'デフォルト' => '値'}).and_return({'デフォルト' => '値'}) }
end
context 'when an existing file is specified' do
let(:filename) { '/tmp/doesexist' }
- let(:data) { { 'key' => 'value' } }
+ let(:data) { { 'key' => 'value', 'ķęŷ' => 'νậŀųề', 'キー' => '値'} }
before {
File.expects(:exists?).with(filename).returns(true).once
YAML.expects(:load_file).with(filename).returns(data).once
diff --git a/spec/functions/lstrip_spec.rb b/spec/functions/lstrip_spec.rb
index 981794e..a5a09ed 100755
--- a/spec/functions/lstrip_spec.rb
+++ b/spec/functions/lstrip_spec.rb
@@ -22,6 +22,7 @@ describe 'lstrip' do
it { is_expected.to run.with_params('one ').and_return('one ') }
it { is_expected.to run.with_params(' one ').and_return('one ') }
it { is_expected.to run.with_params(' one ').and_return('one ') }
+ it { is_expected.to run.with_params(' ǿňè ').and_return('ǿňè ') }
it { is_expected.to run.with_params("\tone ").and_return('one ') }
it { is_expected.to run.with_params("\t one ").and_return('one ') }
it { is_expected.to run.with_params("one \t").and_return("one \t") }
diff --git a/spec/functions/member_spec.rb b/spec/functions/member_spec.rb
index 527f887..8988632 100755
--- a/spec/functions/member_spec.rb
+++ b/spec/functions/member_spec.rb
@@ -17,5 +17,7 @@ describe 'member' do
it { is_expected.to run.with_params(['one'], 'one').and_return(true) }
it { is_expected.to run.with_params(['one'], ['one']).and_return(true) }
it { is_expected.to run.with_params(['one', 'two', 'three', 'four'], ['four', 'two']).and_return(true) }
+ it { is_expected.to run.with_params(['ọאּẹ', 'ŧẅồ', 'ţҺŗęē', 'ƒơџŕ'], ['ƒơџŕ', 'ŧẅồ']).and_return(true) }
it { is_expected.to run.with_params(['one', 'two', 'three', 'four'], ['four', 'five']).and_return(false) }
+ it { is_expected.to run.with_params(['ọאּẹ', 'ŧẅồ', 'ţҺŗęē', 'ƒơџŕ'], ['ƒơџŕ', 'ƒί√ə']).and_return(false) }
end
diff --git a/spec/functions/merge_spec.rb b/spec/functions/merge_spec.rb
index 7b53363..3b2e3ef 100755
--- a/spec/functions/merge_spec.rb
+++ b/spec/functions/merge_spec.rb
@@ -4,7 +4,7 @@ describe 'merge' do
it { is_expected.not_to eq(nil) }
it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
it { is_expected.to run.with_params({}, 'two').and_raise_error(Puppet::ParseError, /unexpected argument type String/) }
- it { is_expected.to run.with_params({}, 1).and_raise_error(Puppet::ParseError, /unexpected argument type Fixnum/) }
+ it { is_expected.to run.with_params({}, 1).and_raise_error(Puppet::ParseError, /unexpected argument type (Fixnum|Integer)/) }
it {
pending 'should not special case this'
is_expected.to run.with_params({}).and_return({})
diff --git a/spec/functions/parsejson_spec.rb b/spec/functions/parsejson_spec.rb
index a01f1f6..7b07e49 100755
--- a/spec/functions/parsejson_spec.rb
+++ b/spec/functions/parsejson_spec.rb
@@ -12,12 +12,12 @@ describe 'parsejson' do
context 'with correct JSON data' do
- it 'should be able to parse a JSON data with a Hash' do
+ it 'should be able to parse JSON data with a Hash' do
is_expected.to run.with_params('{"a":"1","b":"2"}').
and_return({'a'=>'1', 'b'=>'2'})
end
- it 'should be able to parse a JSON data with an Array' do
+ it 'should be able to parse JSON data with an Array' do
is_expected.to run.with_params('["a","b","c"]').
and_return(['a', 'b', 'c'])
end
@@ -29,11 +29,16 @@ describe 'parsejson' do
and_return({})
end
- it 'should be able to parse a JSON data with a mixed structure' do
+ it 'should be able to parse JSON data with a mixed structure' do
is_expected.to run.with_params('{"a":"1","b":2,"c":{"d":[true,false]}}').
and_return({'a' =>'1', 'b' => 2, 'c' => { 'd' => [true, false] } })
end
+ it 'should be able to parse JSON data with a UTF8 and double byte characters' do
+ is_expected.to run.with_params('{"×":"これ","ý":"記号","です":{"©":["Á","ß"]}}').
+ and_return({'×' =>'これ', 'ý' => '記号', 'です' => { '©' => ['Á', 'ß'] } })
+ end
+
it 'should not return the default value if the data was parsed correctly' do
is_expected.to run.with_params('{"a":"1"}', 'default_value').
and_return({'a' => '1'})
diff --git a/spec/functions/parseyaml_spec.rb b/spec/functions/parseyaml_spec.rb
index fa947ca..c2a138c 100755
--- a/spec/functions/parseyaml_spec.rb
+++ b/spec/functions/parseyaml_spec.rb
@@ -18,21 +18,26 @@ describe 'parseyaml' do
and_return('just a string')
end
- it 'should be able to parse a YAML data with a Hash' do
+ it 'should be able to parse YAML data with a Hash' do
is_expected.to run.with_params("---\na: '1'\nb: '2'\n").
and_return({'a' => '1', 'b' => '2'})
end
- it 'should be able to parse a YAML data with an Array' do
+ it 'should be able to parse YAML data with an Array' do
is_expected.to run.with_params("---\n- a\n- b\n- c\n").
and_return(['a', 'b', 'c'])
end
- it 'should be able to parse a YAML data with a mixed structure' do
+ it 'should be able to parse YAML data with a mixed structure' do
is_expected.to run.with_params("---\na: '1'\nb: 2\nc:\n d:\n - :a\n - true\n - false\n").
and_return({'a' => '1', 'b' => 2, 'c' => {'d' => [:a, true, false]}})
end
+ it 'should be able to parse YAML data with a UTF8 and double byte characters' do
+ is_expected.to run.with_params("---\na: ×\nこれ: 記号\nです:\n ©:\n - Á\n - ß\n").
+ and_return({"a"=>"×", "これ"=>"記号", "です"=>{"©"=>["Á", "ß"]} })
+ end
+
it 'should not return the default value if the data was parsed correctly' do
is_expected.to run.with_params("---\na: '1'\n", 'default_value').
and_return({'a' => '1'})
diff --git a/spec/functions/pick_default_spec.rb b/spec/functions/pick_default_spec.rb
index e2fc64a..a7ffc86 100755
--- a/spec/functions/pick_default_spec.rb
+++ b/spec/functions/pick_default_spec.rb
@@ -5,6 +5,7 @@ describe 'pick_default' do
it { is_expected.to run.with_params().and_raise_error(Puppet::Error, /Must receive at least one argument/) }
it { is_expected.to run.with_params('one', 'two').and_return('one') }
+ it { is_expected.to run.with_params('ớņệ', 'ťωơ').and_return('ớņệ') }
it { is_expected.to run.with_params('', 'two').and_return('two') }
it { is_expected.to run.with_params(:undef, 'two').and_return('two') }
it { is_expected.to run.with_params(:undefined, 'two').and_return('two') }
@@ -13,6 +14,7 @@ describe 'pick_default' do
[ '', :undef, :undefined, nil, {}, [], 1, 'default' ].each do |value|
describe "when providing #{value.inspect} as default" do
it { is_expected.to run.with_params('one', value).and_return('one') }
+ it { is_expected.to run.with_params('ớņệ', value).and_return('ớņệ') }
it { is_expected.to run.with_params([], value).and_return([]) }
it { is_expected.to run.with_params({}, value).and_return({}) }
it { is_expected.to run.with_params(value, value).and_return(value) }
diff --git a/spec/functions/pick_spec.rb b/spec/functions/pick_spec.rb
index 2c7caa8..438553b 100755
--- a/spec/functions/pick_spec.rb
+++ b/spec/functions/pick_spec.rb
@@ -9,4 +9,9 @@ describe 'pick' do
it { is_expected.to run.with_params(:undef, 'two').and_return('two') }
it { is_expected.to run.with_params(:undefined, 'two').and_return('two') }
it { is_expected.to run.with_params(nil, 'two').and_return('two') }
+
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params(nil, 'このテキスト').and_return('このテキスト') }
+ it { is_expected.to run.with_params('', 'ŝẳмрłề џţƒ8 ţẽם', 'このテキスト').and_return('ŝẳмрłề џţƒ8 ţẽם') }
+ end
end
diff --git a/spec/functions/prefix_spec.rb b/spec/functions/prefix_spec.rb
index 3761022..5510c58 100755
--- a/spec/functions/prefix_spec.rb
+++ b/spec/functions/prefix_spec.rb
@@ -11,6 +11,7 @@ describe 'prefix' do
it { is_expected.to run.with_params([], 2).and_raise_error(Puppet::ParseError, /expected second argument to be a String/) }
it { is_expected.to run.with_params([]).and_return([]) }
it { is_expected.to run.with_params(['one', 2]).and_return(['one', '2']) }
+ it { is_expected.to run.with_params(['ớņệ', 2]).and_return(['ớņệ', '2']) }
it { is_expected.to run.with_params([], '').and_return([]) }
it { is_expected.to run.with_params([''], '').and_return(['']) }
it { is_expected.to run.with_params(['one'], 'pre').and_return(['preone']) }
diff --git a/spec/functions/pw_hash_spec.rb b/spec/functions/pw_hash_spec.rb
index df5348c..9e03464 100644
--- a/spec/functions/pw_hash_spec.rb
+++ b/spec/functions/pw_hash_spec.rb
@@ -65,5 +65,13 @@ describe 'pw_hash' do
it { is_expected.to run.with_params('password', 'sha-256', 'salt').and_return('$5$salt$Gcm6FsVtF/Qa77ZKD.iwsJlCVPY0XSMgLJL0Hnww/c1') }
it { is_expected.to run.with_params('password', 'sha-512', 'salt').and_return('$6$salt$IxDD3jeSOb5eB1CX5LBsqZFVkJdido3OUILO5Ifz5iwMuTS4XMS130MTSuDDl3aCI6WouIL9AjRbLCelDCy.g.') }
end
+
+ if Puppet::Util::Package.versioncmp(Puppet.version, '4.7.0') >= 0
+ describe 'when arguments are sensitive' do
+ it { is_expected.to run.with_params(Puppet::Pops::Types::PSensitiveType::Sensitive.new('password'), 'md5', 'salt').and_return('$1$salt$qJH7.N4xYta3aEG/dfqo/0') }
+ it { is_expected.to run.with_params(Puppet::Pops::Types::PSensitiveType::Sensitive.new('password'), 'md5', Puppet::Pops::Types::PSensitiveType::Sensitive.new('salt')).and_return('$1$salt$qJH7.N4xYta3aEG/dfqo/0') }
+ it { is_expected.to run.with_params('password', 'md5', Puppet::Pops::Types::PSensitiveType::Sensitive.new('salt')).and_return('$1$salt$qJH7.N4xYta3aEG/dfqo/0') }
+ end
+ end
end
end
diff --git a/spec/functions/range_spec.rb b/spec/functions/range_spec.rb
index 492cad4..ca569d5 100755
--- a/spec/functions/range_spec.rb
+++ b/spec/functions/range_spec.rb
@@ -79,6 +79,14 @@ describe 'range' do
it { is_expected.to run.with_params('01', '04').and_return([1, 2, 3, 4]) }
end
+ context 'with prefixed numbers as utf8 strings as bounds' do
+ it { is_expected.to run.with_params('ħөŝŧ01', 'ħөŝŧ04').and_return(['ħөŝŧ01', 'ħөŝŧ02', 'ħөŝŧ03', 'ħөŝŧ04']) }
+ end
+
+ context 'with prefixed numbers as double byte character strings as bounds' do
+ it { is_expected.to run.with_params('ホスト01', 'ホスト04').and_return(['ホスト01', 'ホスト02', 'ホスト03', 'ホスト04']) }
+ end
+
context 'with dash-range syntax' do
it { is_expected.to run.with_params('4-1').and_return([]) }
it { is_expected.to run.with_params('1-1').and_return([1]) }
diff --git a/spec/functions/regexpescape_spec.rb b/spec/functions/regexpescape_spec.rb
index 6efa847..36dbe70 100644
--- a/spec/functions/regexpescape_spec.rb
+++ b/spec/functions/regexpescape_spec.rb
@@ -32,5 +32,10 @@ describe 'regexpescape' do
it { is_expected.to run.with_params([]).and_return([]) }
it { is_expected.to run.with_params(['one*', "two"]).and_return(['one\*', "two"]) }
it { is_expected.to run.with_params(['one*', 1, true, {}, "two"]).and_return(['one\*', 1, true, {}, "two"]) }
+
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params(['ŏʼnε*']).and_return(['ŏʼnε\*']) }
+ it { is_expected.to run.with_params(['インターネット*']).and_return(['インターネット\*']) }
+ end
end
end
diff --git a/spec/functions/reject_spec.rb b/spec/functions/reject_spec.rb
index 4863050..86db7c7 100755
--- a/spec/functions/reject_spec.rb
+++ b/spec/functions/reject_spec.rb
@@ -16,4 +16,5 @@ describe 'reject' do
it { is_expected.to run.with_params([], 'two').and_return([]) }
it { is_expected.to run.with_params(['one', 'two', 'three'], 'two').and_return(['one', 'three']) }
it { is_expected.to run.with_params(['one', 'two', 'three'], 't(wo|hree)').and_return(['one']) }
+ it { is_expected.to run.with_params(['όʼnệ', 'ţщồ', 'ţңяέέ'], 'ţ(щồ|ңяέέ)').and_return(['όʼnệ']) }
end
diff --git a/spec/functions/reverse_spec.rb b/spec/functions/reverse_spec.rb
index e00dee9..79bc0ad 100755
--- a/spec/functions/reverse_spec.rb
+++ b/spec/functions/reverse_spec.rb
@@ -15,11 +15,13 @@ describe 'reverse' do
it { is_expected.to run.with_params(['one']).and_return(['one']) }
it { is_expected.to run.with_params(['one', 'two', 'three']).and_return(['three', 'two', 'one']) }
it { is_expected.to run.with_params(['one', 'two', 'three', 'four']).and_return(['four', 'three', 'two', 'one']) }
+ it { is_expected.to run.with_params(['ổňë', 'ťŵọ', 'ŧңяəė', 'ƒŏůŗ']).and_return(['ƒŏůŗ', 'ŧңяəė', 'ťŵọ', 'ổňë']) }
it { is_expected.to run.with_params('').and_return('') }
it { is_expected.to run.with_params('a').and_return('a') }
it { is_expected.to run.with_params('abc').and_return('cba') }
it { is_expected.to run.with_params('abcd').and_return('dcba') }
+ it { is_expected.to run.with_params('āβćđ').and_return('đćβā') }
context 'when using a class extending String' do
it 'should call its reverse method' do
diff --git a/spec/functions/round_spec.rb b/spec/functions/round_spec.rb
new file mode 100755
index 0000000..8b13478
--- /dev/null
+++ b/spec/functions/round_spec.rb
@@ -0,0 +1,14 @@
+require 'spec_helper'
+
+describe 'round' do
+ it { is_expected.not_to eq(nil) }
+ it { is_expected.to run.with_params(34.3).and_return(34) }
+ it { is_expected.to run.with_params(-34.3).and_return(-34) }
+ it { is_expected.to run.with_params(34.5).and_return(35) }
+ it { is_expected.to run.with_params(-34.5).and_return(-35) }
+ it { is_expected.to run.with_params(34.7).and_return(35) }
+ it { is_expected.to run.with_params(-34.7).and_return(-35) }
+ it { is_expected.to run.with_params("test").and_raise_error Puppet::ParseError }
+ it { is_expected.to run.with_params("test", "best").and_raise_error Puppet::ParseError }
+ it { is_expected.to run.with_params(3, 4).and_raise_error Puppet::ParseError }
+end
diff --git a/spec/functions/rstrip_spec.rb b/spec/functions/rstrip_spec.rb
index d2efac8..a7663e2 100755
--- a/spec/functions/rstrip_spec.rb
+++ b/spec/functions/rstrip_spec.rb
@@ -22,6 +22,7 @@ describe 'rstrip' do
it { is_expected.to run.with_params('one ').and_return('one') }
it { is_expected.to run.with_params(' one ').and_return(' one') }
it { is_expected.to run.with_params(' one ').and_return(' one') }
+ it { is_expected.to run.with_params(' ǿňè ').and_return(' ǿňè') }
it { is_expected.to run.with_params("\tone ").and_return("\tone") }
it { is_expected.to run.with_params("\t one ").and_return("\t one") }
it { is_expected.to run.with_params("one\t").and_return('one') }
diff --git a/spec/functions/seeded_rand_spec.rb b/spec/functions/seeded_rand_spec.rb
index 38e134e..ac108f4 100644
--- a/spec/functions/seeded_rand_spec.rb
+++ b/spec/functions/seeded_rand_spec.rb
@@ -50,4 +50,9 @@ describe 'seeded_rand' do
scope.function_seeded_rand([max, seed])
end
+
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params(1000, 'ǿňè')}
+ it { is_expected.to run.with_params(1000, '文字列')}
+ end
end
diff --git a/spec/functions/shell_escape_spec.rb b/spec/functions/shell_escape_spec.rb
index 3061dec..77917dd 100644
--- a/spec/functions/shell_escape_spec.rb
+++ b/spec/functions/shell_escape_spec.rb
@@ -19,4 +19,9 @@ describe 'shell_escape' do
it { is_expected.to run.with_params('~`!@#$%^&*()_+-=[]\{}|;\':",./<>?')
.and_return('\~\`\!@\#\$\%\^\&\*\(\)_\+-\=\[\]\\\\\{\}\|\;\\\':\",./\<\>\?') }
end
+
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params('スペー スを含むテ キスト').and_return('\\ス\\ペ\\ー\\ \\ス\\を\\含\\む\\テ\\ \\ \\キ\\ス\\ト') }
+ it { is_expected.to run.with_params('μťƒ 8 ŧĕχť').and_return('\\μ\\ť\\ƒ\\ 8\\ \\ \\ŧ\\ĕ\\χ\\ť') }
+ end
end
diff --git a/spec/functions/shell_join_spec.rb b/spec/functions/shell_join_spec.rb
index 6815f7c..46305bf 100644
--- a/spec/functions/shell_join_spec.rb
+++ b/spec/functions/shell_join_spec.rb
@@ -15,6 +15,11 @@ describe 'shell_join' do
it { is_expected.to run.with_params(['foo', 'bar baz']).and_return('foo bar\ baz') }
it { is_expected.to run.with_params(['~`!@#$', '%^&*()_+-=', '[]\{}|;\':"', ',./<>?'])
.and_return('\~\`\!@\#\$ \%\^\&\*\(\)_\+-\= \[\]\\\\\{\}\|\;\\\':\" ,./\<\>\?') }
+
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params(['μťƒ', '8', 'ŧĕχť']).and_return('\\μ\\ť\\ƒ 8 \\ŧ\\ĕ\\χ\\ť') }
+ it { is_expected.to run.with_params(['スペー', 'スを含むテ', ' キスト']).and_return('\\ス\\ペ\\ー \\ス\\を\\含\\む\\テ \\ \\キ\\ス\\ト') }
+ end
end
describe 'stringification' do
diff --git a/spec/functions/shell_split_spec.rb b/spec/functions/shell_split_spec.rb
index beeb977..f8f9c90 100644
--- a/spec/functions/shell_split_spec.rb
+++ b/spec/functions/shell_split_spec.rb
@@ -20,5 +20,10 @@ describe 'shell_split' do
.and_return(['~`!@#$%^&*()_+-=[]\{}|;\':",./<>?']) }
it { is_expected.to run.with_params('\~\`\!@\#\$ \%\^\&\*\(\)_\+-\= \[\]\\\\\{\}\|\;\\\':\" ,./\<\>\?')
.and_return(['~`!@#$', '%^&*()_+-=', '[]\{}|;\':"', ',./<>?']) }
+
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params('\\μ\\ť\\ƒ 8 \\ŧ\\ĕ\\χ\\ť').and_return(['μťƒ', '8', 'ŧĕχť']) }
+ it { is_expected.to run.with_params('\\ス\\ペ\\ー \\ス\\を\\含\\む\\テ \\ \\キ\\ス\\ト').and_return(['スペー', 'スを含むテ', ' キスト']) }
+ end
end
end
diff --git a/spec/functions/shuffle_spec.rb b/spec/functions/shuffle_spec.rb
index ebc3a73..4673daa 100755
--- a/spec/functions/shuffle_spec.rb
+++ b/spec/functions/shuffle_spec.rb
@@ -26,6 +26,11 @@ describe 'shuffle' do
it { is_expected.to run.with_params('abc').and_return('bac') }
it { is_expected.to run.with_params('abcd').and_return('dcba') }
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params('ůţƒ8 ŧέχŧ şŧґíńģ').and_return('ģńş ůχţέƒŧí8ґŧŧ ') }
+ it { is_expected.to run.with_params('日本語の文字列').and_return('字本日語文列の') }
+ end
+
context 'when using a class extending String' do
it { is_expected.to run.with_params(AlsoString.new('asdfghjkl')).and_return('lkhdsfajg') }
end
diff --git a/spec/functions/size_spec.rb b/spec/functions/size_spec.rb
index c0047ee..2047423 100755
--- a/spec/functions/size_spec.rb
+++ b/spec/functions/size_spec.rb
@@ -19,11 +19,14 @@ describe 'size' do
it { is_expected.to run.with_params({}).and_return(0) }
it { is_expected.to run.with_params({'1' => '2'}).and_return(1) }
it { is_expected.to run.with_params({'1' => '2', '4' => '4'}).and_return(2) }
+ it { is_expected.to run.with_params({'€' => '@', '竹' => 'ǿňè'}).and_return(2) }
it { is_expected.to run.with_params('').and_return(0) }
it { is_expected.to run.with_params('a').and_return(1) }
it { is_expected.to run.with_params('abc').and_return(3) }
it { is_expected.to run.with_params('abcd').and_return(4) }
+ it { is_expected.to run.with_params('万').and_return(1) }
+ it { is_expected.to run.with_params('āβćđ').and_return(4) }
context 'when using a class extending String' do
it 'should call its size method' do
diff --git a/spec/functions/squeeze_spec.rb b/spec/functions/squeeze_spec.rb
index 7f09c30..b267d9a 100755
--- a/spec/functions/squeeze_spec.rb
+++ b/spec/functions/squeeze_spec.rb
@@ -16,6 +16,12 @@ describe 'squeeze' do
it { is_expected.to run.with_params('aaaaaaaaabbbbbbbbbbcccccccccc', 'b-c').and_return('aaaaaaaaabc') }
end
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params('ậậậậậậậậậậậậậậậậậậậậ').and_return('ậ') }
+ it { is_expected.to run.with_params('語語語語語語語', '語').and_return('語') }
+ it { is_expected.to run.with_params('ậậậậậậậậậậậậậậậậậ語語語語©©©©©', '©').and_return('ậậậậậậậậậậậậậậậậậ語語語語©') }
+ end
+
context 'when squeezing values in an array' do
it {
is_expected.to run \
diff --git a/spec/functions/strftime_spec.rb b/spec/functions/strftime_spec.rb
index e76774a..41cda6a 100755
--- a/spec/functions/strftime_spec.rb
+++ b/spec/functions/strftime_spec.rb
@@ -14,9 +14,9 @@ describe 'strftime' do
expect(result.to_i).to(be > 1311953157)
end
- it "using %s should be lower then 1.5 trillion" do
+ it "using %s should be greater than 1.5 trillion" do
result = scope.function_strftime(["%s"])
- expect(result.to_i).to(be < 1500000000)
+ expect(result.to_i).to(be > 1500000000)
end
it "should return a date when given %Y-%m-%d" do
diff --git a/spec/functions/strip_spec.rb b/spec/functions/strip_spec.rb
index 689b6dd..18e943d 100755
--- a/spec/functions/strip_spec.rb
+++ b/spec/functions/strip_spec.rb
@@ -30,5 +30,6 @@ describe 'strip' do
it { is_expected.to run.with_params("\tone \t").and_return('one') }
it { is_expected.to run.with_params("\t one \t").and_return('one') }
it { is_expected.to run.with_params(' o n e ').and_return('o n e') }
+ it { is_expected.to run.with_params(' ỏŋέ ').and_return('ỏŋέ') }
it { is_expected.to run.with_params(AlsoString.new(' one ')).and_return('one') }
end
diff --git a/spec/functions/suffix_spec.rb b/spec/functions/suffix_spec.rb
index efba4ab..e0eafb1 100755
--- a/spec/functions/suffix_spec.rb
+++ b/spec/functions/suffix_spec.rb
@@ -15,6 +15,8 @@ describe 'suffix' do
it { is_expected.to run.with_params([''], '').and_return(['']) }
it { is_expected.to run.with_params(['one'], 'post').and_return(['onepost']) }
it { is_expected.to run.with_params(['one', 'two', 'three'], 'post').and_return(['onepost', 'twopost', 'threepost']) }
+ it { is_expected.to run.with_params(['ỗńέ', 'ťשׂǿ', 'ŧҺř℮ə'], 'рổŝţ').and_return(['ỗńέрổŝţ', 'ťשׂǿрổŝţ', 'ŧҺř℮əрổŝţ']) }
+
it {
is_expected.to run.with_params({}).and_return({})
}
diff --git a/spec/functions/to_json_pretty_spec.rb b/spec/functions/to_json_pretty_spec.rb
new file mode 100755
index 0000000..abbcc2c
--- /dev/null
+++ b/spec/functions/to_json_pretty_spec.rb
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe 'to_json_pretty' do
+ it { is_expected.not_to eq(nil) }
+ it { is_expected.to run.with_params([]).and_return("[\n\n]") }
+ it { is_expected.to run.with_params(['one']).and_return("[\n \"one\"\n]") }
+ it { is_expected.to run.with_params(['one', 'two']).and_return("[\n \"one\",\n \"two\"\n]") }
+ it { is_expected.to run.with_params({}).and_return("{\n}") }
+ it { is_expected.to run.with_params({ 'key' => 'value' }).and_return("{\n \"key\": \"value\"\n}") }
+ it { is_expected.to run.with_params({"one" => {"oneA" => "A","oneB" => {"oneB1" => "1","oneB2" => "2"}},"two" => ["twoA","twoB"]}).and_return("{\n \"one\": {\n \"oneA\": \"A\",\n \"oneB\": {\n \"oneB1\": \"1\",\n \"oneB2\": \"2\"\n }\n },\n \"two\": [\n \"twoA\",\n \"twoB\"\n ]\n}") }
+end
diff --git a/spec/functions/to_json_spec.rb b/spec/functions/to_json_spec.rb
new file mode 100755
index 0000000..925523c
--- /dev/null
+++ b/spec/functions/to_json_spec.rb
@@ -0,0 +1,19 @@
+require 'spec_helper'
+
+describe 'to_json' do
+ it { is_expected.not_to eq(nil) }
+ it { is_expected.to run.with_params('').and_return("\"\"") }
+ it { is_expected.to run.with_params(true).and_return("true") }
+ it { is_expected.to run.with_params('one').and_return("\"one\"") }
+ it { is_expected.to run.with_params([]).and_return("[]") }
+ it { is_expected.to run.with_params(['one']).and_return("[\"one\"]") }
+ it { is_expected.to run.with_params(['one', 'two']).and_return("[\"one\",\"two\"]") }
+ it { is_expected.to run.with_params({}).and_return("{}") }
+ it { is_expected.to run.with_params({ 'key' => 'value' }).and_return("{\"key\":\"value\"}") }
+ it { is_expected.to run.with_params({"one" => {"oneA" => "A","oneB" => {"oneB1" => "1","oneB2" => "2"}},"two" => ["twoA","twoB"]}).and_return("{\"one\":{\"oneA\":\"A\",\"oneB\":{\"oneB1\":\"1\",\"oneB2\":\"2\"}},\"two\":[\"twoA\",\"twoB\"]}") }
+
+ it { is_expected.to run.with_params('‰').and_return('"‰"') }
+ it { is_expected.to run.with_params('竹').and_return('"竹"') }
+ it { is_expected.to run.with_params('Ü').and_return('"Ü"') }
+ it { is_expected.to run.with_params('∇').and_return('"∇"') }
+end
diff --git a/spec/functions/to_yaml_spec.rb b/spec/functions/to_yaml_spec.rb
new file mode 100755
index 0000000..3f69a70
--- /dev/null
+++ b/spec/functions/to_yaml_spec.rb
@@ -0,0 +1,17 @@
+require 'spec_helper'
+
+describe 'to_yaml' do
+ it { is_expected.not_to eq(nil) }
+ it { is_expected.to run.with_params('').and_return("--- ''\n") }
+ it { is_expected.to run.with_params(true).and_return("--- true\n...\n") }
+ it { is_expected.to run.with_params('one').and_return("--- one\n...\n") }
+ it { is_expected.to run.with_params([]).and_return("--- []\n") }
+ it { is_expected.to run.with_params(['one']).and_return("---\n- one\n") }
+ it { is_expected.to run.with_params(['one', 'two']).and_return("---\n- one\n- two\n") }
+ it { is_expected.to run.with_params({}).and_return("--- {}\n") }
+ it { is_expected.to run.with_params({ 'key' => 'value' }).and_return("---\nkey: value\n") }
+ it { is_expected.to run.with_params({"one" => {"oneA" => "A","oneB" => {"oneB1" => "1","oneB2" => "2"}},"two" => ["twoA","twoB"]}).and_return("---\none:\n oneA: A\n oneB:\n oneB1: '1'\n oneB2: '2'\ntwo:\n- twoA\n- twoB\n") }
+
+ it { is_expected.to run.with_params('‰').and_return("--- \"‰\"\n") }
+ it { is_expected.to run.with_params('∇').and_return("--- \"∇\"\n") }
+end
diff --git a/spec/functions/union_spec.rb b/spec/functions/union_spec.rb
index cfd38b6..3f36f24 100755
--- a/spec/functions/union_spec.rb
+++ b/spec/functions/union_spec.rb
@@ -20,5 +20,6 @@ describe 'union' do
it { is_expected.to run.with_params(['one', 'two', 'three'], ['two', 'two', 'three']).and_return(['one', 'two', 'three']) }
it { is_expected.to run.with_params(['one', 'two'], ['two', 'three'], ['one', 'three']).and_return(['one', 'two', 'three']) }
it { is_expected.to run.with_params(['one', 'two'], ['three', 'four'], ['one', 'two', 'three'], ['four']).and_return(['one', 'two', 'three', 'four']) }
+ it { is_expected.to run.with_params(['ốńə', 'ţשׂợ'], ['ŧĥяếệ', 'ƒởųŗ'], ['ốńə', 'ţשׂợ', 'ŧĥяếệ'], ['ƒởųŗ']).and_return(['ốńə', 'ţשׂợ', 'ŧĥяếệ', 'ƒởųŗ']) }
it 'should not confuse types' do is_expected.to run.with_params(['1', '2', '3'], [1, 2]).and_return(['1', '2', '3', 1, 2]) end
end
diff --git a/spec/functions/unique_spec.rb b/spec/functions/unique_spec.rb
index 24257a0..76932ec 100755
--- a/spec/functions/unique_spec.rb
+++ b/spec/functions/unique_spec.rb
@@ -1,27 +1,31 @@
require 'spec_helper'
describe 'unique' do
- describe 'signature validation' do
- it { is_expected.not_to eq(nil) }
- it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
- it {
- pending("Current implementation ignores parameters after the first.")
- is_expected.to run.with_params([], 'extra').and_raise_error(Puppet::ParseError, /wrong number of arguments/i)
- }
- it { is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError, /Requires either array or string to work/) }
- it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, /Requires either array or string to work/) }
- it { is_expected.to run.with_params(true).and_raise_error(Puppet::ParseError, /Requires either array or string to work/) }
- end
+ if Puppet.version.to_f < 5.0
+ describe 'signature validation' do
+ it { is_expected.not_to eq(nil) }
+ it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
+ it {
+ pending("Current implementation ignores parameters after the first.")
+ is_expected.to run.with_params([], 'extra').and_raise_error(Puppet::ParseError, /wrong number of arguments/i)
+ }
+ it { is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError, /Requires either array or string to work/) }
+ it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, /Requires either array or string to work/) }
+ it { is_expected.to run.with_params(true).and_raise_error(Puppet::ParseError, /Requires either array or string to work/) }
+ end
- context 'when called with an array' do
- it { is_expected.to run.with_params([]).and_return([]) }
- it { is_expected.to run.with_params(['a']).and_return(['a']) }
- it { is_expected.to run.with_params(['a', 'b', 'a']).and_return(['a', 'b']) }
- end
+ context 'when called with an array' do
+ it { is_expected.to run.with_params([]).and_return([]) }
+ it { is_expected.to run.with_params(['a']).and_return(['a']) }
+ it { is_expected.to run.with_params(['a', 'b', 'a']).and_return(['a', 'b']) }
+ it { is_expected.to run.with_params(['ã', 'ъ', 'ã']).and_return(['ã', 'ъ']) }
+ end
- context 'when called with a string' do
- it { is_expected.to run.with_params('').and_return('') }
- it { is_expected.to run.with_params('a').and_return('a') }
- it { is_expected.to run.with_params('aaba').and_return('ab') }
+ context 'when called with a string' do
+ it { is_expected.to run.with_params('').and_return('') }
+ it { is_expected.to run.with_params('a').and_return('a') }
+ it { is_expected.to run.with_params('aaba').and_return('ab') }
+ it { is_expected.to run.with_params('ããъã').and_return('ãъ') }
+ end
end
end
diff --git a/spec/functions/validate_cmd_spec.rb b/spec/functions/validate_cmd_spec.rb
index ab0cbc9..c6559e8 100755
--- a/spec/functions/validate_cmd_spec.rb
+++ b/spec/functions/validate_cmd_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe 'validate_cmd' do
+describe 'validate_cmd', :unless => Puppet::Util::Platform.windows? do
let(:touch) { File.exists?('/usr/bin/touch') ? '/usr/bin/touch' : '/bin/touch' }
describe 'signature validation' do
diff --git a/spec/functions/validate_domain_name_spec.rb b/spec/functions/validate_domain_name_spec.rb
new file mode 100644
index 0000000..69fcae4
--- /dev/null
+++ b/spec/functions/validate_domain_name_spec.rb
@@ -0,0 +1,35 @@
+require 'spec_helper'
+
+describe 'validate_domain_name' do
+ describe 'signature validation' do
+ it { is_expected.not_to eq(nil) }
+ it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
+ end
+
+ describe 'valid inputs' do
+ it { is_expected.to run.with_params('com', 'com.') }
+ it { is_expected.to run.with_params('x.com', 'x.com.') }
+ it { is_expected.to run.with_params('foo.example.com', 'foo.example.com.') }
+ it { is_expected.to run.with_params('2foo.example.com', '2foo.example.com.') }
+ it { is_expected.to run.with_params('www.2foo.example.com', 'www.2foo.example.com.') }
+ it { is_expected.to run.with_params('domain.tld', 'puppet.com') }
+ end
+
+ describe 'invalid inputs' do
+ it { is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError, /is not a string/) }
+ it { is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError, /is not a string/) }
+ it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, /is not a string/) }
+ it { is_expected.to run.with_params(true).and_raise_error(Puppet::ParseError, /is not a string/) }
+
+ it { is_expected.to run.with_params('foo.example.com', []).and_raise_error(Puppet::ParseError, /is not a string/) }
+ it { is_expected.to run.with_params('foo.example.com', {}).and_raise_error(Puppet::ParseError, /is not a string/) }
+ it { is_expected.to run.with_params('foo.example.com', 1).and_raise_error(Puppet::ParseError, /is not a string/) }
+ it { is_expected.to run.with_params('foo.example.com', true).and_raise_error(Puppet::ParseError, /is not a string/) }
+
+ it { is_expected.to run.with_params('').and_raise_error(Puppet::ParseError, /is not a syntactically correct domain name/) }
+ it { is_expected.to run.with_params('invalid domain').and_raise_error(Puppet::ParseError, /is not a syntactically correct domain name/) }
+ it { is_expected.to run.with_params('-foo.example.com').and_raise_error(Puppet::ParseError, /is not a syntactically correct domain name/) }
+ it { is_expected.to run.with_params('www.example.2com').and_raise_error(Puppet::ParseError, /is not a syntactically correct domain name/) }
+ it { is_expected.to run.with_params('192.168.1.1').and_raise_error(Puppet::ParseError, /is not a syntactically correct domain name/) }
+ end
+end
diff --git a/spec/functions/validate_ipv6_address_spec.rb b/spec/functions/validate_ipv6_address_spec.rb
index 78810d4..137db36 100755
--- a/spec/functions/validate_ipv6_address_spec.rb
+++ b/spec/functions/validate_ipv6_address_spec.rb
@@ -29,6 +29,13 @@ describe 'validate_ipv6_address' do
it { is_expected.to run.with_params('3ffe:0505:0002::', '3ffe:0505:0002::2') }
it { is_expected.to run.with_params('::1/64') }
it { is_expected.to run.with_params('fe80::a00:27ff:fe94:44d6/64') }
+ it { is_expected.to run.with_params('fe80:0000:0000:0000:0204:61ff:fe9d:f156') }
+ it { is_expected.to run.with_params('fe80:0:0:0:204:61ff:fe9d:f156') }
+ it { is_expected.to run.with_params('fe80::204:61ff:fe9d:f156') }
+ it { is_expected.to run.with_params('fe80:0:0:0:0204:61ff:254.157.241.86') }
+ it { is_expected.to run.with_params('::1') }
+ it { is_expected.to run.with_params('fe80::') }
+ it { is_expected.to run.with_params('2001::') }
end
describe 'invalid inputs' do
@@ -38,6 +45,9 @@ describe 'validate_ipv6_address' do
it { is_expected.to run.with_params('0.0.0').and_raise_error(Puppet::ParseError, /is not a valid IPv6/) }
it { is_expected.to run.with_params('0.0.0.256').and_raise_error(Puppet::ParseError, /is not a valid IPv6/) }
it { is_expected.to run.with_params('0.0.0.0.0').and_raise_error(Puppet::ParseError, /is not a valid IPv6/) }
+ it { is_expected.to run.with_params('::ffff:2.3.4').and_raise_error(Puppet::ParseError, /is not a valid IPv6/) }
+ it { is_expected.to run.with_params('::ffff:257.1.2.3').and_raise_error(Puppet::ParseError, /is not a valid IPv6/) }
+ it { is_expected.to run.with_params('::ffff:12345678901234567890.1.26').and_raise_error(Puppet::ParseError, /is not a valid IPv6/) }
it { is_expected.to run.with_params('affe:beef').and_raise_error(Puppet::ParseError, /is not a valid IPv6/) }
it { is_expected.to run.with_params('::1', {}).and_raise_error(Puppet::ParseError, /is not a string/) }
it { is_expected.to run.with_params('::1', true).and_raise_error(Puppet::ParseError, /is not a string/) }
diff --git a/spec/functions/validate_legacy_spec.rb b/spec/functions/validate_legacy_spec.rb
index 50cb317..7b48f12 100644
--- a/spec/functions/validate_legacy_spec.rb
+++ b/spec/functions/validate_legacy_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-if Puppet.version.to_f >= 4.0
+if Puppet::Util::Package.versioncmp(Puppet.version, '4.4.0') >= 0
describe 'validate_legacy' do
it { is_expected.not_to eq(nil) }
it { is_expected.to run.with_params.and_raise_error(ArgumentError) }
diff --git a/spec/functions/values_at_spec.rb b/spec/functions/values_at_spec.rb
index a8348f3..681c101 100755
--- a/spec/functions/values_at_spec.rb
+++ b/spec/functions/values_at_spec.rb
@@ -30,6 +30,11 @@ describe 'values_at' do
it { is_expected.to run.with_params([0, 1, 2], 3).and_raise_error(Puppet::ParseError, /index exceeds array size/) }
end
+ context 'when requesting a single item using UTF8 and double byte characters' do
+ it { is_expected.to run.with_params(['ẩ', 'β', 'с', 'ď'], 0).and_return(['ẩ']) }
+ it { is_expected.to run.with_params(['文', '字', 'の', '値'], 2).and_return(['の']) }
+ end
+
context 'when requesting multiple items' do
it { is_expected.to run.with_params([0, 1, 2], [1, -1]).and_raise_error(Puppet::ParseError, /Unknown format of given index/) }
it { is_expected.to run.with_params([0, 1, 2], [0, 2]).and_return([0, 2]) }
diff --git a/spec/functions/values_spec.rb b/spec/functions/values_spec.rb
index 4abf0bd..26c6dfb 100755
--- a/spec/functions/values_spec.rb
+++ b/spec/functions/values_spec.rb
@@ -16,4 +16,9 @@ describe 'values' do
result = subject.call([{ 'key1' => 'value1', 'key2' => 'value2', 'duplicate_value_key' => 'value2' }])
expect(result).to match_array(['value1', 'value2', 'value2'])
end
+
+ it 'should run with UTF8 and double byte characters' do
+ result = subject.call([{ 'かぎ' => '使用', 'ҝĕұ' => '√ẩŀứệ', 'ҝĕұďŭрļǐçằťè' => '√ẩŀứệ' }])
+ expect(result).to match_array(['使用', '√ẩŀứệ', '√ẩŀứệ'])
+ end
end
diff --git a/spec/functions/zip_spec.rb b/spec/functions/zip_spec.rb
index abca7ee..e1ae8ee 100755
--- a/spec/functions/zip_spec.rb
+++ b/spec/functions/zip_spec.rb
@@ -12,4 +12,10 @@ describe 'zip' do
it { is_expected.to run.with_params([1,2,3], [4,5,6]).and_return([[1,4], [2,5], [3,6]]) }
it { is_expected.to run.with_params([1,2,3], [4,5,6], false).and_return([[1,4], [2,5], [3,6]]) }
it { is_expected.to run.with_params([1,2,3], [4,5,6], true).and_return([1, 4, 2, 5, 3, 6]) }
+
+ context 'should run with UTF8 and double byte characters' do
+ it { is_expected.to run.with_params(['ầ', 'ь', 'ć'], ['đ', 'ề', 'ƒ']).and_return([['ầ','đ'], ['ь','ề'], ['ć', 'ƒ']]) }
+ it { is_expected.to run.with_params(['ペ', '含', '値'], ['ッ', '文', 'イ']).and_return([['ペ','ッ'], ['含','文'], ['値', 'イ']]) }
+ end
end
+
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
index 8a1907f..4d85e7d 100755
--- a/spec/spec_helper_acceptance.rb
+++ b/spec/spec_helper_acceptance.rb
@@ -1,36 +1,21 @@
#! /usr/bin/env ruby -S rspec
+require 'puppet'
require 'beaker-rspec'
require 'beaker/puppet_install_helper'
-
-UNSUPPORTED_PLATFORMS = []
+require 'beaker/module_install_helper'
run_puppet_install_helper
+install_ca_certs unless ENV['PUPPET_INSTALL_TYPE'] =~ /pe/i
+install_module_on(hosts)
+install_module_dependencies_on(hosts)
RSpec.configure do |c|
- # Project root
- proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
-
# Readable test descriptions
c.formatter = :documentation
# Configure all nodes in nodeset
c.before :suite do
- if ENV['FUTURE_PARSER'] == 'yes'
- default[:default_apply_opts] ||= {}
- default[:default_apply_opts].merge!({:parser => 'future'})
- end
-
- copy_root_module_to(default, :source => proj_root, :module_name => 'stdlib')
- end
-end
-
-def is_future_parser_enabled?
- if default[:type] == 'aio' || ENV['PUPPET_INSTALL_TYPE'] == 'agent'
- return true
- elsif default[:default_apply_opts]
- return default[:default_apply_opts][:parser] == 'future'
end
- return false
end
def get_puppet_version
diff --git a/spec/unit/ensure_resources_spec.rb b/spec/unit/ensure_resources_spec.rb
deleted file mode 100644
index aea723e..0000000
--- a/spec/unit/ensure_resources_spec.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-require 'spec_helper'
-
-describe 'test::ensure_resources', type: :class do
- let(:params) {{ resource_type: 'user', title_hash: title_param, attributes_hash: {'ensure' => 'present'} }}
-
- describe 'given a title hash of multiple resources' do
-
- let(:title_param) { {'dan' => { 'gid' => 'mygroup', 'uid' => '600' }, 'alex' => { 'gid' => 'mygroup', 'uid' => '700'}} }
-
- it { is_expected.to compile }
- it { is_expected.to contain_user('dan').with({ 'gid' => 'mygroup', 'uid' => '600', 'ensure' => 'present'}) }
- it { is_expected.to contain_user('alex').with({ 'gid' => 'mygroup', 'uid' => '700', 'ensure' => 'present'}) }
- end
-
- describe 'given a title hash of a single resource' do
-
- let(:title_param) { {'dan' => { 'gid' => 'mygroup', 'uid' => '600' }} }
-
- it { is_expected.to compile }
- it { is_expected.to contain_user('dan').with({ 'gid' => 'mygroup', 'uid' => '600', 'ensure' => 'present'}) }
- end
-end
diff --git a/spec/unit/puppet/provider/file_line/ruby_spec.rb b/spec/unit/puppet/provider/file_line/ruby_spec.rb
index 1f41f62..4ec9bae 100755
--- a/spec/unit/puppet/provider/file_line/ruby_spec.rb
+++ b/spec/unit/puppet/provider/file_line/ruby_spec.rb
@@ -2,7 +2,8 @@
require 'spec_helper'
require 'tempfile'
provider_class = Puppet::Type.type(:file_line).provider(:ruby)
-describe provider_class do
+# These tests fail on windows when run as part of the rake task. Individually they pass
+describe provider_class, :unless => Puppet::Util::Platform.windows? do
context "when adding" do
let :tmpfile do
tmp = Tempfile.new('tmp')
@@ -29,7 +30,7 @@ describe provider_class do
File.open(tmpfile, 'w') do |fh|
fh.write('foo1')
end
- expect(provider.exists?).to be_nil
+ expect(provider.exists?).to eql (false)
end
it 'should append to an existing file when creating' do
provider.create
@@ -69,7 +70,7 @@ describe provider_class do
File.open(@tmpfile, 'w') do |fh|
fh.write("foo1\nfoo2")
end
- expect(@provider.exists?).to be_nil
+ expect(@provider.exists?).to eql (false)
@provider.create
expect(File.read(@tmpfile).chomp).to eql("foo1\nfoo2\nfoo = bar")
end
@@ -112,7 +113,7 @@ describe provider_class do
File.open(@tmpfile, 'w') do |fh|
fh.write("foo1\nfoo=blah\nfoo2\nfoo=baz")
end
- expect(@provider.exists?).to be_nil
+ expect(@provider.exists?).to eql(false)
expect { @provider.create }.to raise_error(Puppet::Error, /More than one line.*matches/)
expect(File.read(@tmpfile)).to eql("foo1\nfoo=blah\nfoo2\nfoo=baz")
end
@@ -131,11 +132,30 @@ describe provider_class do
File.open(@tmpfile, 'w') do |fh|
fh.write("foo1\nfoo=blah\nfoo2\nfoo=baz")
end
- expect(@provider.exists?).to be_nil
+ expect(@provider.exists?).to eql(false)
@provider.create
expect(File.read(@tmpfile).chomp).to eql("foo1\nfoo = bar\nfoo2\nfoo = bar")
end
+ it 'should replace all lines that match, even when some lines are correct' do
+ @resource = Puppet::Type::File_line.new(
+ {
+ :name => 'neil',
+ :path => @tmpfile,
+ :line => "\thard\tcore\t0\n",
+ :match => '^[ \t]hard[ \t]+core[ \t]+.*',
+ :multiple => true,
+ }
+ )
+ @provider = provider_class.new(@resource)
+ File.open(@tmpfile, 'w') do |fh|
+ fh.write("\thard\tcore\t90\n\thard\tcore\t0\n")
+ end
+ expect(@provider.exists?).to eql(false)
+ @provider.create
+ expect(File.read(@tmpfile).chomp).to eql("\thard\tcore\t0\n\thard\tcore\t0")
+ end
+
it 'should raise an error with invalid values' do
expect {
@resource = Puppet::Type::File_line.new(
@@ -154,7 +174,7 @@ describe provider_class do
File.open(@tmpfile, 'w') do |fh|
fh.write("foo1\nfoo=blah\nfoo2")
end
- expect(@provider.exists?).to be_nil
+ expect(@provider.exists?).to eql(false)
@provider.create
expect(File.read(@tmpfile).chomp).to eql("foo1\nfoo = bar\nfoo2")
end
@@ -162,7 +182,7 @@ describe provider_class do
File.open(@tmpfile, 'w') do |fh|
fh.write("foo1\nfoo2")
end
- expect(@provider.exists?).to be_nil
+ expect(@provider.exists?).to eql(false)
@provider.create
expect(File.read(@tmpfile)).to eql("foo1\nfoo2\nfoo = bar\n")
end
@@ -170,10 +190,28 @@ describe provider_class do
File.open(@tmpfile, 'w') do |fh|
fh.write("foo1\nfoo = bar\nfoo2")
end
- expect(@provider.exists?).to be_truthy
+ expect(@provider.exists?).to eql(true)
@provider.create
expect(File.read(@tmpfile).chomp).to eql("foo1\nfoo = bar\nfoo2")
end
+
+ it 'should not add line after no matches found' do
+ @resource = Puppet::Type::File_line.new(
+ {
+ :name => 'foo',
+ :path => @tmpfile,
+ :line => 'inserted = line',
+ :match => '^foo3$',
+ :append_on_no_match => false,
+ }
+ )
+ @provider = provider_class.new(@resource)
+ File.open(@tmpfile, 'w') do |fh|
+ fh.write("foo1\nfoo = blah\nfoo2\nfoo = baz")
+ end
+ expect(@provider.exists?).to be true
+ expect(File.read(@tmpfile).chomp).to eql("foo1\nfoo = blah\nfoo2\nfoo = baz")
+ end
end
describe 'using after' do
@@ -274,7 +312,7 @@ describe provider_class do
}
)
@provider = provider_class.new(@resource)
- expect(@provider.exists?).to be_nil
+ expect(@provider.exists?).to eql (false)
@provider.create
expect(File.read(@tmpfile).chomp).to eql("foo1\ninserted = line\nfoo = blah\nfoo2\nfoo1\ninserted = line\nfoo = baz")
end
@@ -299,7 +337,7 @@ describe provider_class do
end
end
- context "when removing" do
+ context "when removing with a line" do
before :each do
# TODO: these should be ported over to use the PuppetLabs spec_helper
# file fixtures once the following pull request has been merged:
@@ -340,6 +378,23 @@ describe provider_class do
@provider.destroy
expect(File.read(@tmpfile)).to eql("foo1\nfoo2\n")
end
+
+ it 'example in the docs' do
+ @resource = Puppet::Type::File_line.new(
+ {
+ :name => 'bashrc_proxy',
+ :ensure => 'absent',
+ :path => @tmpfile,
+ :line => 'export HTTP_PROXY=http://squid.puppetlabs.vm:3128',
+ }
+ )
+ @provider = provider_class.new(@resource)
+ File.open(@tmpfile, 'w') do |fh|
+ fh.write("foo1\nfoo2\nexport HTTP_PROXY=http://squid.puppetlabs.vm:3128\nfoo4\n")
+ end
+ @provider.destroy
+ expect(File.read(@tmpfile)).to eql("foo1\nfoo2\nfoo4\n")
+ end
end
context "when removing with a match" do
@@ -367,7 +422,7 @@ describe provider_class do
File.open(@tmpfile, 'w') do |fh|
fh.write("foo1\nfoo\nfoo2")
end
- expect(@provider.exists?).to be_truthy
+ expect(@provider.exists?).to eql (true)
end
it 'should remove one line if it matches' do
@@ -378,6 +433,41 @@ describe provider_class do
expect(File.read(@tmpfile)).to eql("foo1\nfoo2")
end
+ it 'the line parameter is actually not used at all but is silently ignored if here' do
+ @resource = Puppet::Type::File_line.new(
+ {
+ :name => 'foo',
+ :path => @tmpfile,
+ :line => 'supercalifragilisticexpialidocious',
+ :ensure => 'absent',
+ :match => 'o$',
+ :match_for_absence => true,
+ }
+ )
+ File.open(@tmpfile, 'w') do |fh|
+ fh.write("foo1\nfoo\nfoo2")
+ end
+ @provider.destroy
+ expect(File.read(@tmpfile)).to eql("foo1\nfoo2")
+ end
+
+ it 'and may not be here and does not need to be here' do
+ @resource = Puppet::Type::File_line.new(
+ {
+ :name => 'foo',
+ :path => @tmpfile,
+ :ensure => 'absent',
+ :match => 'o$',
+ :match_for_absence => true,
+ }
+ )
+ File.open(@tmpfile, 'w') do |fh|
+ fh.write("foo1\nfoo\nfoo2")
+ end
+ @provider.destroy
+ expect(File.read(@tmpfile)).to eql("foo1\nfoo2")
+ end
+
it 'should raise an error if more than one line matches' do
File.open(@tmpfile, 'w') do |fh|
fh.write("foo1\nfoo\nfoo2\nfoo\nfoo")
@@ -442,6 +532,41 @@ describe provider_class do
expect(File.read(@tmpfile)).to eql("foo1\nfoo\n")
end
- end
+ it 'example in the docs' do
+ @resource = Puppet::Type::File_line.new(
+ {
+ :name => 'bashrc_proxy',
+ :ensure => 'absent',
+ :path => @tmpfile,
+ :line => 'export HTTP_PROXY=http://squid.puppetlabs.vm:3128',
+ :match => '^export\ HTTP_PROXY\=',
+ :match_for_absence => true,
+ }
+ )
+ @provider = provider_class.new(@resource)
+ File.open(@tmpfile, 'w') do |fh|
+ fh.write("foo1\nfoo2\nexport HTTP_PROXY=foo\nfoo4\n")
+ end
+ @provider.destroy
+ expect(File.read(@tmpfile)).to eql("foo1\nfoo2\nfoo4\n")
+ end
+ it 'example in the docs showing line is redundant' do
+ @resource = Puppet::Type::File_line.new(
+ {
+ :name => 'bashrc_proxy',
+ :ensure => 'absent',
+ :path => @tmpfile,
+ :match => '^export\ HTTP_PROXY\=',
+ :match_for_absence => true,
+ }
+ )
+ @provider = provider_class.new(@resource)
+ File.open(@tmpfile, 'w') do |fh|
+ fh.write("foo1\nfoo2\nexport HTTP_PROXY=foo\nfoo4\n")
+ end
+ @provider.destroy
+ expect(File.read(@tmpfile)).to eql("foo1\nfoo2\nfoo4\n")
+ end
+ end
end
diff --git a/spec/unit/puppet/type/file_line_spec.rb b/spec/unit/puppet/type/file_line_spec.rb
index 48e2670..db07352 100755
--- a/spec/unit/puppet/type/file_line_spec.rb
+++ b/spec/unit/puppet/type/file_line_spec.rb
@@ -2,14 +2,28 @@
require 'spec_helper'
require 'tempfile'
describe Puppet::Type.type(:file_line) do
+ let :tmp_path do
+ if Puppet::Util::Platform.windows?
+ 'C:\tmp\path'
+ else
+ '/tmp/path'
+ end
+ end
+ let :my_path do
+ if Puppet::Util::Platform.windows?
+ 'C:\my\path'
+ else
+ '/my/path'
+ end
+ end
let :file_line do
- Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'line', :path => '/tmp/path')
+ Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'line', :path => tmp_path)
end
it 'should accept a line and path' do
file_line[:line] = 'my_line'
expect(file_line[:line]).to eq('my_line')
- file_line[:path] = '/my/path'
- expect(file_line[:path]).to eq('/my/path')
+ file_line[:path] = my_path
+ expect(file_line[:path]).to eq(my_path)
end
it 'should accept a match regex' do
file_line[:match] = '^foo.*$'
@@ -19,7 +33,7 @@ describe Puppet::Type.type(:file_line) do
expect {
Puppet::Type.type(:file_line).new(
:name => 'foo',
- :path => '/my/path',
+ :path => my_path,
:line => 'foo=bar',
:match => '^bar=blah$'
)}.not_to raise_error
@@ -28,23 +42,44 @@ describe Puppet::Type.type(:file_line) do
expect {
Puppet::Type.type(:file_line).new(
:name => 'foo',
- :path => '/my/path',
+ :path => my_path,
:line => 'foo=bar',
:match => '^\s*foo=.*$'
)}.not_to raise_error
end
+ it 'should accept utf8 characters' do
+ expect {
+ Puppet::Type.type(:file_line).new(
+ :name => 'ƒồỗ',
+ :path => my_path,
+ :line => 'ƒồỗ=ьåя',
+ :match => '^ьåя=βļάħ$'
+ )}.not_to raise_error
+ end
+ it 'should accept double byte characters' do
+ expect {
+ Puppet::Type.type(:file_line).new(
+ :name => 'フーバー',
+ :path => my_path,
+ :line => 'この=それ',
+ :match => '^この=ああ$'
+ )}.not_to raise_error
+ end
it 'should accept posix filenames' do
- file_line[:path] = '/tmp/path'
- expect(file_line[:path]).to eq('/tmp/path')
+ file_line[:path] = tmp_path
+ expect(file_line[:path]).to eq(tmp_path)
end
it 'should not accept unqualified path' do
expect { file_line[:path] = 'file' }.to raise_error(Puppet::Error, /File paths must be fully qualified/)
end
it 'should require that a line is specified' do
- expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => '/tmp/file') }.to raise_error(Puppet::Error, /line is a required attribute/)
+ expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => tmp_path) }.to raise_error(Puppet::Error, /line is a required attribute/)
end
it 'should not require that a line is specified when matching for absence' do
- expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => '/tmp/file', :ensure => :absent, :match_for_absence => :true, :match => 'match') }.not_to raise_error
+ expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => tmp_path, :ensure => :absent, :match_for_absence => :true, :match => 'match') }.not_to raise_error
+ end
+ it 'although if a line is specified anyway when matching for absence it still works and the line is silently ignored' do
+ expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => tmp_path, :line => 'i_am_irrelevant', :ensure => :absent, :match_for_absence => :true, :match => 'match') }.not_to raise_error
end
it 'should require that a file is specified' do
expect { Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'path') }.to raise_error(Puppet::Error, /path is a required attribute/)
@@ -55,15 +90,20 @@ describe Puppet::Type.type(:file_line) do
it 'should default to replace => true' do
expect(file_line[:replace]).to eq :true
end
-
+ it 'should default to encoding => UTF-8' do
+ expect(file_line[:encoding]).to eq 'UTF-8'
+ end
+ it 'should accept encoding => iso-8859-1' do
+ expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => tmp_path, :ensure => :present, :encoding => 'iso-8859-1', :line => 'bar') }.not_to raise_error
+ end
it "should autorequire the file it manages" do
catalog = Puppet::Resource::Catalog.new
- file = Puppet::Type.type(:file).new(:name => "/tmp/path")
+ file = Puppet::Type.type(:file).new(:name => tmp_path)
catalog.add_resource file
catalog.add_resource file_line
relationship = file_line.autorequire.find do |rel|
- (rel.source.to_s == "File[/tmp/path]") and (rel.target.to_s == file_line.to_s)
+ (rel.source.to_s == "File[#{tmp_path}]") and (rel.target.to_s == file_line.to_s)
end
expect(relationship).to be_a Puppet::Relationship
end