summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rwxr-xr-xspec/acceptance/abs_spec.rb4
-rwxr-xr-xspec/acceptance/any2array_spec.rb4
-rwxr-xr-xspec/acceptance/bool2num_spec.rb12
-rwxr-xr-xspec/acceptance/count_spec.rb4
-rwxr-xr-xspec/acceptance/ensure_packages_spec.rb2
-rwxr-xr-xspec/acceptance/ensure_resource_spec.rb2
-rwxr-xr-xspec/acceptance/merge_spec.rb4
-rwxr-xr-xspec/acceptance/type_spec.rb2
-rwxr-xr-xspec/acceptance/validate_cmd_spec.rb6
-rwxr-xr-xspec/acceptance/values_spec.rb6
-rwxr-xr-xspec/acceptance/zip_spec.rb28
-rwxr-xr-xspec/functions/bool2num_spec.rb18
-rwxr-xr-xspec/functions/capitalize_spec.rb9
-rwxr-xr-xspec/functions/chomp_spec.rb9
-rwxr-xr-xspec/functions/chop_spec.rb9
-rwxr-xr-xspec/functions/downcase_spec.rb9
-rwxr-xr-xspec/functions/empty_spec.rb9
-rwxr-xr-xspec/functions/fqdn_rotate_spec.rb10
-rwxr-xr-xspec/functions/lstrip_spec.rb9
-rwxr-xr-xspec/functions/reverse_spec.rb9
-rwxr-xr-xspec/functions/rstrip_spec.rb9
-rwxr-xr-xspec/functions/shuffle_spec.rb9
-rwxr-xr-xspec/functions/strip_spec.rb9
-rwxr-xr-xspec/functions/swapcase_spec.rb9
-rwxr-xr-xspec/functions/unique_spec.rb9
-rwxr-xr-xspec/functions/upcase_spec.rb9
-rwxr-xr-xspec/functions/uriescape_spec.rb9
-rwxr-xr-xspec/functions/zip_spec.rb16
-rwxr-xr-xspec/spec_helper_acceptance.rb14
29 files changed, 227 insertions, 31 deletions
diff --git a/spec/acceptance/abs_spec.rb b/spec/acceptance/abs_spec.rb
index 8e05642..6e41e2f 100755
--- a/spec/acceptance/abs_spec.rb
+++ b/spec/acceptance/abs_spec.rb
@@ -7,7 +7,7 @@ describe 'abs function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operati
pp = <<-EOS
$input = '-34.56'
$output = abs($input)
- notify { $output: }
+ notify { "$output": }
EOS
apply_manifest(pp, :catch_failures => true) do |r|
@@ -19,7 +19,7 @@ describe 'abs function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operati
pp = <<-EOS
$input = -34.56
$output = abs($input)
- notify { $output: }
+ notify { "$output": }
EOS
apply_manifest(pp, :catch_failures => true) do |r|
diff --git a/spec/acceptance/any2array_spec.rb b/spec/acceptance/any2array_spec.rb
index 467d6af..18ea4cd 100755
--- a/spec/acceptance/any2array_spec.rb
+++ b/spec/acceptance/any2array_spec.rb
@@ -25,7 +25,7 @@ describe 'any2array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('o
EOS
apply_manifest(pp, :catch_failures => true) do |r|
- expect(r.stdout).to match(/Notice: Output: testarray/)
+ expect(r.stdout).to match(/Notice: Output: (\[|)test(,\s|)array(\]|)/)
end
end
@@ -42,7 +42,7 @@ describe 'any2array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('o
EOS
apply_manifest(pp, :catch_failures => true) do |r|
- expect(r.stdout).to match(/Notice: Output: testarray/)
+ expect(r.stdout).to match(/Notice: Output: (\[|)test(,\s|)array(\]|)/)
end
end
end
diff --git a/spec/acceptance/bool2num_spec.rb b/spec/acceptance/bool2num_spec.rb
index 7a70311..52ff75b 100755
--- a/spec/acceptance/bool2num_spec.rb
+++ b/spec/acceptance/bool2num_spec.rb
@@ -4,11 +4,11 @@ require 'spec_helper_acceptance'
describe 'bool2num function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
describe 'success' do
['false', 'f', '0', 'n', 'no'].each do |bool|
- it 'should convert a given boolean, #{bool}, to 0' do
+ it "should convert a given boolean, #{bool}, to 0" do
pp = <<-EOS
- $input = #{bool}
+ $input = "#{bool}"
$output = bool2num($input)
- notify { $output: }
+ notify { "$output": }
EOS
apply_manifest(pp, :catch_failures => true) do |r|
@@ -18,11 +18,11 @@ describe 'bool2num function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('op
end
['true', 't', '1', 'y', 'yes'].each do |bool|
- it 'should convert a given boolean, #{bool}, to 1' do
+ it "should convert a given boolean, #{bool}, to 1" do
pp = <<-EOS
- $input = #{bool}
+ $input = "#{bool}"
$output = bool2num($input)
- notify { $output: }
+ notify { "$output": }
EOS
apply_manifest(pp, :catch_failures => true) do |r|
diff --git a/spec/acceptance/count_spec.rb b/spec/acceptance/count_spec.rb
index 51a40ba..fe7ca9d 100755
--- a/spec/acceptance/count_spec.rb
+++ b/spec/acceptance/count_spec.rb
@@ -7,7 +7,7 @@ describe 'count function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('opera
pp = <<-EOS
$input = [1,2,3,4]
$output = count($input)
- notify { $output: }
+ notify { "$output": }
EOS
apply_manifest(pp, :catch_failures => true) do |r|
@@ -19,7 +19,7 @@ describe 'count function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('opera
pp = <<-EOS
$input = [1,1,1,2]
$output = count($input, 1)
- notify { $output: }
+ notify { "$output": }
EOS
apply_manifest(pp, :catch_failures => true) do |r|
diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb
index 12da0cd..3651f29 100755
--- a/spec/acceptance/ensure_packages_spec.rb
+++ b/spec/acceptance/ensure_packages_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'ensure_packages function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'ensure_packages function', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) || fact('osfamily') == 'windows') do
describe 'success' do
it 'ensure_packages a package' do
apply_manifest('package { "rake": ensure => absent, provider => "gem", }')
diff --git a/spec/acceptance/ensure_resource_spec.rb b/spec/acceptance/ensure_resource_spec.rb
index 2aad243..f1bfa54 100755
--- a/spec/acceptance/ensure_resource_spec.rb
+++ b/spec/acceptance/ensure_resource_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'ensure_resource function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'ensure_resource function', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) || fact('osfamily') == 'windows') do
describe 'success' do
it 'ensure_resource a package' do
apply_manifest('package { "rake": ensure => absent, provider => "gem", }')
diff --git a/spec/acceptance/merge_spec.rb b/spec/acceptance/merge_spec.rb
index a60e784..227b994 100755
--- a/spec/acceptance/merge_spec.rb
+++ b/spec/acceptance/merge_spec.rb
@@ -14,9 +14,9 @@ describe 'merge function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('opera
EOS
apply_manifest(pp, :catch_failures => true) do |r|
- expect(r.stdout).to match(/merge\[one\] is "1"/)
+ expect(r.stdout).to match(/merge\[one\] is ("1"|1)/)
expect(r.stdout).to match(/merge\[two\] is "dos"/)
- expect(r.stdout).to match(/merge\[three\] is {"five"=>"5"}/)
+ expect(r.stdout).to match(/merge\[three\] is {"five"=>("5"|5)}/)
end
end
end
diff --git a/spec/acceptance/type_spec.rb b/spec/acceptance/type_spec.rb
index 0043aad..15fa217 100755
--- a/spec/acceptance/type_spec.rb
+++ b/spec/acceptance/type_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'type function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'type function', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) || !(is_future_parser_enabled?)) do
describe 'success' do
it 'types arrays' do
pp = <<-EOS
diff --git a/spec/acceptance/validate_cmd_spec.rb b/spec/acceptance/validate_cmd_spec.rb
index 385676d..5ac66fd 100755
--- a/spec/acceptance/validate_cmd_spec.rb
+++ b/spec/acceptance/validate_cmd_spec.rb
@@ -37,10 +37,12 @@ describe 'validate_cmd function', :unless => UNSUPPORTED_PLATFORMS.include?(fact
} else {
$two = '/bin/aoeu'
}
- validate_cmd($one,$two,"aoeu is dvorak)
+ validate_cmd($one,$two,"aoeu is dvorak")
EOS
- expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/aoeu is dvorak/)
+ apply_manifest(pp, :expect_failures => true) do |output|
+ expect(output.stderr).to match(/aoeu is dvorak/)
+ end
end
end
describe 'failure' do
diff --git a/spec/acceptance/values_spec.rb b/spec/acceptance/values_spec.rb
index 7ef956e..a2eff32 100755
--- a/spec/acceptance/values_spec.rb
+++ b/spec/acceptance/values_spec.rb
@@ -13,8 +13,12 @@ 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 0e924e8..139079e 100755
--- a/spec/acceptance/zip_spec.rb
+++ b/spec/acceptance/zip_spec.rb
@@ -11,8 +11,11 @@ describe 'zip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operati
$output = zip($one,$two)
notice(inline_template('<%= @output.inspect %>'))
EOS
-
- expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", "5"\], \["2", "6"\], \["3", "7"\], \["4", "8"\]\]/)
+ 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
end
it 'zips two arrays of numbers & bools together' do
pp = <<-EOS
@@ -21,8 +24,11 @@ describe 'zip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operati
$output = zip($one,$two)
notice(inline_template('<%= @output.inspect %>'))
EOS
-
- expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", true\], \["2", true\], \["three", false\], \["4", false\]\]/)
+ 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
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:
@@ -35,8 +41,11 @@ describe 'zip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operati
$output = zip($one,$two,true)
notice(inline_template('<%= @output.inspect %>'))
EOS
-
- expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["1", "5", "2", "6", "3", "7", "4", "8"\]/)
+ 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
end
it 'handles unmatched length' do
# XXX Is this expected behavior?
@@ -46,8 +55,11 @@ describe 'zip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operati
$output = zip($one,$two)
notice(inline_template('<%= @output.inspect %>'))
EOS
-
- expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", "5"\], \["2", "6"\]\]/)
+ 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
end
end
describe 'failure' do
diff --git a/spec/functions/bool2num_spec.rb b/spec/functions/bool2num_spec.rb
index fbf461b..3904d7e 100755
--- a/spec/functions/bool2num_spec.rb
+++ b/spec/functions/bool2num_spec.rb
@@ -17,8 +17,22 @@ describe "the bool2num function" do
expect(result).to(eq(1))
end
- it "should convert false to 0" do
- result = scope.function_bool2num([false])
+ it "should convert 'true' to 1" do
+ result = scope.function_bool2num(['true'])
+ result.should(eq(1))
+ end
+
+ it "should convert 'false' to 0" do
+ result = scope.function_bool2num(['false'])
expect(result).to(eq(0))
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new('true')
+ result = scope.function_bool2num([value])
+ result.should(eq(1))
+ end
end
diff --git a/spec/functions/capitalize_spec.rb b/spec/functions/capitalize_spec.rb
index 0cc2d76..fd0e92b 100755
--- a/spec/functions/capitalize_spec.rb
+++ b/spec/functions/capitalize_spec.rb
@@ -16,4 +16,13 @@ describe "the capitalize function" do
result = scope.function_capitalize(["abc"])
expect(result).to(eq("Abc"))
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new('abc')
+ result = scope.function_capitalize([value])
+ result.should(eq('Abc'))
+ end
end
diff --git a/spec/functions/chomp_spec.rb b/spec/functions/chomp_spec.rb
index d2ae287..b1e1e60 100755
--- a/spec/functions/chomp_spec.rb
+++ b/spec/functions/chomp_spec.rb
@@ -16,4 +16,13 @@ describe "the chomp function" do
result = scope.function_chomp(["abc\n"])
expect(result).to(eq("abc"))
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new("abc\n")
+ result = scope.function_chomp([value])
+ result.should(eq("abc"))
+ end
end
diff --git a/spec/functions/chop_spec.rb b/spec/functions/chop_spec.rb
index d9dbb88..c8a1951 100755
--- a/spec/functions/chop_spec.rb
+++ b/spec/functions/chop_spec.rb
@@ -16,4 +16,13 @@ describe "the chop function" do
result = scope.function_chop(["asdf\n"])
expect(result).to(eq("asdf"))
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new("abc\n")
+ result = scope.function_chop([value])
+ result.should(eq('abc'))
+ end
end
diff --git a/spec/functions/downcase_spec.rb b/spec/functions/downcase_spec.rb
index a844780..edebc44 100755
--- a/spec/functions/downcase_spec.rb
+++ b/spec/functions/downcase_spec.rb
@@ -21,4 +21,13 @@ describe "the downcase function" do
result = scope.function_downcase(["asdf asdf"])
expect(result).to(eq("asdf asdf"))
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new("ASFD")
+ result = scope.function_downcase([value])
+ result.should(eq('asfd'))
+ end
end
diff --git a/spec/functions/empty_spec.rb b/spec/functions/empty_spec.rb
index 1f2ace4..6a97c4c 100755
--- a/spec/functions/empty_spec.rb
+++ b/spec/functions/empty_spec.rb
@@ -20,4 +20,13 @@ describe "the empty function" do
result = scope.function_empty(['asdf'])
expect(result).to(eq(false))
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new()
+ result = scope.function_empty([value])
+ result.should(eq(true))
+ end
end
diff --git a/spec/functions/fqdn_rotate_spec.rb b/spec/functions/fqdn_rotate_spec.rb
index b2dc1f5..40057d4 100755
--- a/spec/functions/fqdn_rotate_spec.rb
+++ b/spec/functions/fqdn_rotate_spec.rb
@@ -30,4 +30,14 @@ describe "the fqdn_rotate function" do
val2 = scope.function_fqdn_rotate(["abcdefghijklmnopqrstuvwxyz01234567890987654321"])
expect(val1).not_to eql(val2)
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1")
+ value = AlsoString.new("asdf")
+ result = scope.function_fqdn_rotate([value])
+ result.size.should(eq(4))
+ end
end
diff --git a/spec/functions/lstrip_spec.rb b/spec/functions/lstrip_spec.rb
index 7025f97..68cca1c 100755
--- a/spec/functions/lstrip_spec.rb
+++ b/spec/functions/lstrip_spec.rb
@@ -16,4 +16,13 @@ describe "the lstrip function" do
result = scope.function_lstrip([" asdf"])
expect(result).to(eq('asdf'))
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new(" asdf")
+ result = scope.function_lstrip([value])
+ result.should(eq("asdf"))
+ end
end
diff --git a/spec/functions/reverse_spec.rb b/spec/functions/reverse_spec.rb
index bfeabfb..1f04794 100755
--- a/spec/functions/reverse_spec.rb
+++ b/spec/functions/reverse_spec.rb
@@ -16,4 +16,13 @@ describe "the reverse function" do
result = scope.function_reverse(["asdfghijkl"])
expect(result).to(eq('lkjihgfdsa'))
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new('asdfghjkl')
+ result = scope.function_reverse([value])
+ result.should(eq('lkjhgfdsa'))
+ end
end
diff --git a/spec/functions/rstrip_spec.rb b/spec/functions/rstrip_spec.rb
index 81321d7..f6b4838 100755
--- a/spec/functions/rstrip_spec.rb
+++ b/spec/functions/rstrip_spec.rb
@@ -21,4 +21,13 @@ describe "the rstrip function" do
result = scope.function_rstrip([["a ","b ", "c "]])
expect(result).to(eq(['a','b','c']))
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new('asdf ')
+ result = scope.function_rstrip([value])
+ result.should(eq('asdf'))
+ end
end
diff --git a/spec/functions/shuffle_spec.rb b/spec/functions/shuffle_spec.rb
index ee0e2ff..a62c1fb 100755
--- a/spec/functions/shuffle_spec.rb
+++ b/spec/functions/shuffle_spec.rb
@@ -21,4 +21,13 @@ describe "the shuffle function" do
result = scope.function_shuffle(["adfs"])
expect(result.split("").sort.join("")).to(eq("adfs"))
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new('asdf')
+ result = scope.function_shuffle([value])
+ result.size.should(eq(4))
+ end
end
diff --git a/spec/functions/strip_spec.rb b/spec/functions/strip_spec.rb
index e228761..4ac8daf 100755
--- a/spec/functions/strip_spec.rb
+++ b/spec/functions/strip_spec.rb
@@ -15,4 +15,13 @@ describe "the strip function" do
result = scope.function_strip([" ab cd "])
expect(result).to(eq('ab cd'))
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new(' as df ')
+ result = scope.function_strip([value])
+ result.should(eq('as df'))
+ end
end
diff --git a/spec/functions/swapcase_spec.rb b/spec/functions/swapcase_spec.rb
index c6838ab..791d1df 100755
--- a/spec/functions/swapcase_spec.rb
+++ b/spec/functions/swapcase_spec.rb
@@ -16,4 +16,13 @@ describe "the swapcase function" do
result = scope.function_swapcase(["aaBBccDD"])
expect(result).to(eq('AAbbCCdd'))
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new("aaBBccDD")
+ result = scope.function_swapcase([value])
+ result.should(eq("AAbbCCdd"))
+ end
end
diff --git a/spec/functions/unique_spec.rb b/spec/functions/unique_spec.rb
index 8ec1464..7cd3a56 100755
--- a/spec/functions/unique_spec.rb
+++ b/spec/functions/unique_spec.rb
@@ -21,4 +21,13 @@ describe "the unique function" do
result = scope.function_unique([["a","a","b","b","c"]])
expect(result).to(eq(['a','b','c']))
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new('aabbc')
+ result = scope.function_unique([value])
+ result.should(eq('abc'))
+ end
end
diff --git a/spec/functions/upcase_spec.rb b/spec/functions/upcase_spec.rb
index 78e55dd..3cf8b05 100755
--- a/spec/functions/upcase_spec.rb
+++ b/spec/functions/upcase_spec.rb
@@ -21,4 +21,13 @@ describe "the upcase function" do
result = scope.function_upcase(["ABC"])
expect(result).to(eq('ABC'))
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new('abc')
+ result = scope.function_upcase([value])
+ result.should(eq('ABC'))
+ end
end
diff --git a/spec/functions/uriescape_spec.rb b/spec/functions/uriescape_spec.rb
index c44e9c1..2321e5a 100755
--- a/spec/functions/uriescape_spec.rb
+++ b/spec/functions/uriescape_spec.rb
@@ -21,4 +21,13 @@ describe "the uriescape function" do
result = scope.function_uriescape(["ABCdef"])
expect(result).to(eq('ABCdef'))
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new('abc')
+ result = scope.function_uriescape([value])
+ result.should(eq('abc'))
+ end
end
diff --git a/spec/functions/zip_spec.rb b/spec/functions/zip_spec.rb
index 744bdd7..f265fce 100755
--- a/spec/functions/zip_spec.rb
+++ b/spec/functions/zip_spec.rb
@@ -11,5 +11,21 @@ describe "the zip function" do
it "should be able to zip an array" do
result = scope.function_zip([['1','2','3'],['4','5','6']])
expect(result).to(eq([["1", "4"], ["2", "5"], ["3", "6"]]))
+ result = scope.function_zip([['1','2','3'],['4','5','6'], false])
+ result.should(eq([["1", "4"], ["2", "5"], ["3", "6"]]))
+ end
+
+ it "should be able to zip an array and flatten" do
+ result = scope.function_zip([['1','2','3'],['4','5','6'], true])
+ result.should(eq(["1", "4", "2", "5", "3", "6"]))
+ end
+
+ it "should accept objects which extend String for the second argument" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new('false')
+ result = scope.function_zip([['1','2','3'],['4','5','6'],value])
+ result.should(eq([["1", "4"], ["2", "5"], ["3", "6"]]))
end
end
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
index 53c1661..ef99723 100755
--- a/spec/spec_helper_acceptance.rb
+++ b/spec/spec_helper_acceptance.rb
@@ -12,7 +12,7 @@ unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
hosts.each do |host|
on host, "mkdir -p #{host['distmoduledir']}"
- on host, "/bin/touch #{default['puppetpath']}/hiera.yaml"
+ on host, "/bin/touch #{host['puppetpath']}/hiera.yaml"
end
end
@@ -25,10 +25,15 @@ RSpec.configure do |c|
# Configure all nodes in nodeset
c.before :suite do
+ if ENV['FUTURE_PARSER'] == 'true'
+ default[:default_apply_opts] ||= {}
+ default[:default_apply_opts].merge!({:parser => 'future'})
+ end
hosts.each do |host|
if host['platform'] !~ /windows/i
copy_root_module_to(host, :source => proj_root, :module_name => 'stdlib')
end
+
end
hosts.each do |host|
if host['platform'] =~ /windows/i
@@ -37,3 +42,10 @@ RSpec.configure do |c|
end
end
end
+
+def is_future_parser_enabled?
+ if default[:default_apply_opts]
+ return default[:default_apply_opts][:parser] == 'future'
+ end
+ return false
+end