diff options
Diffstat (limited to 'spec/acceptance')
98 files changed, 1742 insertions, 0 deletions
diff --git a/spec/acceptance/abs_spec.rb b/spec/acceptance/abs_spec.rb index 8e05642..8e05642 100644..100755 --- a/spec/acceptance/abs_spec.rb +++ b/spec/acceptance/abs_spec.rb diff --git a/spec/acceptance/any2array_spec.rb b/spec/acceptance/any2array_spec.rb index 467d6af..467d6af 100644..100755 --- a/spec/acceptance/any2array_spec.rb +++ b/spec/acceptance/any2array_spec.rb diff --git a/spec/acceptance/base64_spec.rb b/spec/acceptance/base64_spec.rb index 97e1738..97e1738 100644..100755 --- a/spec/acceptance/base64_spec.rb +++ b/spec/acceptance/base64_spec.rb diff --git a/spec/acceptance/bool2num_spec.rb b/spec/acceptance/bool2num_spec.rb index 7a70311..7a70311 100644..100755 --- a/spec/acceptance/bool2num_spec.rb +++ b/spec/acceptance/bool2num_spec.rb diff --git a/spec/acceptance/build_csv.rb b/spec/acceptance/build_csv.rb index 62ecbf1..62ecbf1 100644..100755 --- a/spec/acceptance/build_csv.rb +++ b/spec/acceptance/build_csv.rb diff --git a/spec/acceptance/capitalize_spec.rb b/spec/acceptance/capitalize_spec.rb index e5e7b7b..e5e7b7b 100644..100755 --- a/spec/acceptance/capitalize_spec.rb +++ b/spec/acceptance/capitalize_spec.rb diff --git a/spec/acceptance/chomp_spec.rb b/spec/acceptance/chomp_spec.rb index f6c1595..f6c1595 100644..100755 --- a/spec/acceptance/chomp_spec.rb +++ b/spec/acceptance/chomp_spec.rb diff --git a/spec/acceptance/chop_spec.rb b/spec/acceptance/chop_spec.rb index dbc28da..dbc28da 100644..100755 --- a/spec/acceptance/chop_spec.rb +++ b/spec/acceptance/chop_spec.rb diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index 7bda365..7bda365 100644..100755 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb diff --git a/spec/acceptance/count_spec.rb b/spec/acceptance/count_spec.rb index 51a40ba..51a40ba 100644..100755 --- a/spec/acceptance/count_spec.rb +++ b/spec/acceptance/count_spec.rb diff --git a/spec/acceptance/deep_merge_spec.rb b/spec/acceptance/deep_merge_spec.rb index c0f9b12..c0f9b12 100644..100755 --- a/spec/acceptance/deep_merge_spec.rb +++ b/spec/acceptance/deep_merge_spec.rb diff --git a/spec/acceptance/defined_with_params_spec.rb b/spec/acceptance/defined_with_params_spec.rb index fc54450..fc54450 100644..100755 --- a/spec/acceptance/defined_with_params_spec.rb +++ b/spec/acceptance/defined_with_params_spec.rb diff --git a/spec/acceptance/delete_at_spec.rb b/spec/acceptance/delete_at_spec.rb index db0c01f..db0c01f 100644..100755 --- a/spec/acceptance/delete_at_spec.rb +++ b/spec/acceptance/delete_at_spec.rb diff --git a/spec/acceptance/delete_spec.rb b/spec/acceptance/delete_spec.rb index a28604c..a28604c 100644..100755 --- a/spec/acceptance/delete_spec.rb +++ b/spec/acceptance/delete_spec.rb diff --git a/spec/acceptance/delete_undef_values_spec.rb b/spec/acceptance/delete_undef_values_spec.rb index b7eda19..b7eda19 100644..100755 --- a/spec/acceptance/delete_undef_values_spec.rb +++ b/spec/acceptance/delete_undef_values_spec.rb diff --git a/spec/acceptance/delete_values_spec.rb b/spec/acceptance/delete_values_spec.rb new file mode 100755 index 0000000..6d2369c --- /dev/null +++ b/spec/acceptance/delete_values_spec.rb @@ -0,0 +1,25 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'delete_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'should delete elements of the hash' do + pp = <<-EOS + $a = { 'a' => 'A', 'b' => 'B', 'B' => 'C', 'd' => 'B' } + $b = { 'a' => 'A', 'B' => 'C' } + $o = delete_values($a, 'B') + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles non-hash arguments' + it 'handles improper argument counts' + end +end diff --git a/spec/acceptance/difference_spec.rb b/spec/acceptance/difference_spec.rb new file mode 100755 index 0000000..2fae5c4 --- /dev/null +++ b/spec/acceptance/difference_spec.rb @@ -0,0 +1,26 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'difference function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'returns non-duplicates in the first array' do + pp = <<-EOS + $a = ['a','b','c'] + $b = ['b','c','d'] + $c = ['a'] + $o = difference($a, $b) + if $o == $c { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles non-array arguments' + it 'handles improper argument counts' + end +end diff --git a/spec/acceptance/dirname_spec.rb b/spec/acceptance/dirname_spec.rb new file mode 100755 index 0000000..97913dd --- /dev/null +++ b/spec/acceptance/dirname_spec.rb @@ -0,0 +1,42 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'dirname function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + context 'absolute path' do + it 'returns the dirname' do + pp = <<-EOS + $a = '/path/to/a/file.txt' + $b = '/path/to/a' + $o = dirname($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + context 'relative path' do + it 'returns the dirname' do + pp = <<-EOS + $a = 'path/to/a/file.txt' + $b = 'path/to/a' + $o = dirname($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + end + describe 'failure' do + it 'handles improper argument counts' + end +end diff --git a/spec/acceptance/downcase_spec.rb b/spec/acceptance/downcase_spec.rb new file mode 100755 index 0000000..bc4e706 --- /dev/null +++ b/spec/acceptance/downcase_spec.rb @@ -0,0 +1,39 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'downcase function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'returns the downcase' do + pp = <<-EOS + $a = 'AOEU' + $b = 'aoeu' + $o = downcase($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'doesn\'t affect lowercase words' do + pp = <<-EOS + $a = 'aoeu aoeu' + $b = 'aoeu aoeu' + $o = downcase($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-strings' + end +end diff --git a/spec/acceptance/empty_spec.rb b/spec/acceptance/empty_spec.rb new file mode 100755 index 0000000..8b46aac --- /dev/null +++ b/spec/acceptance/empty_spec.rb @@ -0,0 +1,39 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'empty function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'recognizes empty strings' do + pp = <<-EOS + $a = '' + $b = true + $o = empty($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'recognizes non-empty strings' do + pp = <<-EOS + $a = 'aoeu' + $b = false + $o = empty($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-strings' + end +end diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb new file mode 100755 index 0000000..145bdc5 --- /dev/null +++ b/spec/acceptance/ensure_packages_spec.rb @@ -0,0 +1,24 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'ensure_packages function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'ensure_packages a package' do + apply_manifest('package { "zsh": ensure => absent, }') + pp = <<-EOS + $a = "zsh" + ensure_packages($a) + EOS + + apply_manifest(pp, :expect_changes => true) do |r| + expect(r.stdout).to match(/Package\[zsh\]\/ensure: created/) + end + end + it 'ensures a package already declared' + it 'takes defaults arguments' + end + describe 'failure' do + it 'handles no arguments' + it 'handles non strings' + end +end diff --git a/spec/acceptance/ensure_resource_spec.rb b/spec/acceptance/ensure_resource_spec.rb new file mode 100755 index 0000000..c4d8887 --- /dev/null +++ b/spec/acceptance/ensure_resource_spec.rb @@ -0,0 +1,24 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'ensure_resource function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'ensure_resource a package' do + apply_manifest('package { "zsh": ensure => absent, }') + pp = <<-EOS + $a = "zsh" + ensure_resource('package', $a) + EOS + + apply_manifest(pp, :expect_changes => true) do |r| + expect(r.stdout).to match(/Package\[zsh\]\/ensure: created/) + end + end + it 'ensures a resource already declared' + it 'takes defaults arguments' + end + describe 'failure' do + it 'handles no arguments' + it 'handles non strings' + end +end diff --git a/spec/acceptance/flatten_spec.rb b/spec/acceptance/flatten_spec.rb new file mode 100755 index 0000000..c4d66e0 --- /dev/null +++ b/spec/acceptance/flatten_spec.rb @@ -0,0 +1,39 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'flatten function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'flattens arrays' do + pp = <<-EOS + $a = ["a","b",["c",["d","e"],"f","g"]] + $b = ["a","b","c","d","e","f","g"] + $o = flatten($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'does not affect flat arrays' do + pp = <<-EOS + $a = ["a","b","c","d","e","f","g"] + $b = ["a","b","c","d","e","f","g"] + $o = flatten($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-strings' + end +end diff --git a/spec/acceptance/floor_spec.rb b/spec/acceptance/floor_spec.rb new file mode 100755 index 0000000..0dcdad9 --- /dev/null +++ b/spec/acceptance/floor_spec.rb @@ -0,0 +1,39 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'floor function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'floors floats' do + pp = <<-EOS + $a = 12.8 + $b = 12 + $o = floor($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'floors integers' do + pp = <<-EOS + $a = 7 + $b = 7 + $o = floor($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-numbers' + end +end diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb new file mode 100755 index 0000000..b7f8bf8 --- /dev/null +++ b/spec/acceptance/fqdn_rotate_spec.rb @@ -0,0 +1,33 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + let(:facts_d) do + if fact('is_pe') == "true" + '/etc/puppetlabs/facter/facts.d' + else + '/etc/facter/facts.d' + end + end + after :each do + shell("if [ -f #{facts_d}/fqdn.txt ] ; then rm #{facts_d}/fqdn.txt ; fi") + end + it 'fqdn_rotates floats' do + shell("echo 'fqdn=fakehost.localdomain' > #{facts_d}/fqdn.txt") + pp = <<-EOS + $a = ['a','b','c','d'] + $o = fqdn_rotate($a) + notice(inline_template('fqdn_rotate is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/fqdn_rotate is \["c", "d", "a", "b"\]/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-numbers' + end +end diff --git a/spec/acceptance/get_module_path_spec.rb b/spec/acceptance/get_module_path_spec.rb new file mode 100755 index 0000000..34d91fa --- /dev/null +++ b/spec/acceptance/get_module_path_spec.rb @@ -0,0 +1,41 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'get_module_path function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'get_module_paths stdlib' do + pp = <<-EOS + $a = $::is_pe ? { + 'true' => '/opt/puppet/share/puppet/modules/stdlib', + 'false' => '/etc/puppet/modules/stdlib', + } + $o = get_module_path('stdlib') + if $o == $a { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'get_module_paths dne' do + pp = <<-EOS + $a = $::is_pe ? { + 'true' => '/etc/puppetlabs/puppet/modules/dne', + 'false' => '/etc/puppet/modules/dne', + } + $o = get_module_path('dne') + if $o == $a { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :expect_failures => true) + end + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-numbers' + end +end diff --git a/spec/acceptance/getparam_spec.rb b/spec/acceptance/getparam_spec.rb new file mode 100755 index 0000000..a84b2d1 --- /dev/null +++ b/spec/acceptance/getparam_spec.rb @@ -0,0 +1,25 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'getparam function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'getparam a package' do + pp = <<-EOS + user { "rspec": + ensure => present, + managehome => true, + } + $o = getparam(User['rspec'], 'managehome') + notice(inline_template('getparam is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :expect_changes => true) do |r| + expect(r.stdout).to match(/getparam is true/) + end + end + end + describe 'failure' do + it 'handles no arguments' + it 'handles non strings' + end +end diff --git a/spec/acceptance/getvar_spec.rb b/spec/acceptance/getvar_spec.rb new file mode 100755 index 0000000..333c467 --- /dev/null +++ b/spec/acceptance/getvar_spec.rb @@ -0,0 +1,26 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'getvar function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'getvars from classes' do + pp = <<-EOS + class a::data { $foo = 'aoeu' } + include a::data + $b = 'aoeu' + $o = getvar("a::data::foo") + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-numbers' + end +end diff --git a/spec/acceptance/grep_spec.rb b/spec/acceptance/grep_spec.rb new file mode 100755 index 0000000..b39d48e --- /dev/null +++ b/spec/acceptance/grep_spec.rb @@ -0,0 +1,26 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'grep function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'greps arrays' do + pp = <<-EOS + $a = ['aaabbb','bbbccc','dddeee'] + $b = 'bbb' + $c = ['aaabbb','bbbccc'] + $o = grep($a,$b) + if $o == $c { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-arrays' + end +end diff --git a/spec/acceptance/has_interface_with_spec.rb b/spec/acceptance/has_interface_with_spec.rb new file mode 100755 index 0000000..41ae19f --- /dev/null +++ b/spec/acceptance/has_interface_with_spec.rb @@ -0,0 +1,44 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'has_interface_with function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'has_interface_with existing ipaddress' do + pp = <<-EOS + $a = '127.0.0.1' + $o = has_interface_with('ipaddress', $a) + notice(inline_template('has_interface_with is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/has_interface_with is true/) + end + end + it 'has_interface_with absent ipaddress' do + pp = <<-EOS + $a = '128.0.0.1' + $o = has_interface_with('ipaddress', $a) + notice(inline_template('has_interface_with is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/has_interface_with is false/) + end + end + it 'has_interface_with existing interface' do + pp = <<-EOS + $a = 'lo' + $o = has_interface_with($a) + notice(inline_template('has_interface_with is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/has_interface_with is true/) + end + end + end + describe 'failure' do + it 'handles no arguments' + it 'handles non strings' + end +end diff --git a/spec/acceptance/has_ip_address_spec.rb b/spec/acceptance/has_ip_address_spec.rb new file mode 100755 index 0000000..7d5fd87 --- /dev/null +++ b/spec/acceptance/has_ip_address_spec.rb @@ -0,0 +1,33 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'has_ip_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'has_ip_address existing ipaddress' do + pp = <<-EOS + $a = '127.0.0.1' + $o = has_ip_address($a) + notice(inline_template('has_ip_address is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/has_ip_address is true/) + end + end + it 'has_ip_address absent ipaddress' do + pp = <<-EOS + $a = '128.0.0.1' + $o = has_ip_address($a) + notice(inline_template('has_ip_address is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/has_ip_address is false/) + end + end + end + describe 'failure' do + it 'handles no arguments' + it 'handles non strings' + end +end diff --git a/spec/acceptance/has_ip_network_spec.rb b/spec/acceptance/has_ip_network_spec.rb new file mode 100755 index 0000000..692eaf9 --- /dev/null +++ b/spec/acceptance/has_ip_network_spec.rb @@ -0,0 +1,33 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'has_ip_network function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'has_ip_network existing ipaddress' do + pp = <<-EOS + $a = '127.0.0.0' + $o = has_ip_network($a) + notice(inline_template('has_ip_network is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/has_ip_network is true/) + end + end + it 'has_ip_network absent ipaddress' do + pp = <<-EOS + $a = '128.0.0.0' + $o = has_ip_network($a) + notice(inline_template('has_ip_network is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/has_ip_network is false/) + end + end + end + describe 'failure' do + it 'handles no arguments' + it 'handles non strings' + end +end diff --git a/spec/acceptance/has_key_spec.rb b/spec/acceptance/has_key_spec.rb new file mode 100755 index 0000000..c8557cb --- /dev/null +++ b/spec/acceptance/has_key_spec.rb @@ -0,0 +1,41 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'has_key function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'has_keys in hashes' do + pp = <<-EOS + $a = { 'aaa' => 'bbb','bbb' => 'ccc','ddd' => 'eee' } + $b = 'bbb' + $c = true + $o = has_key($a,$b) + if $o == $c { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'has_keys not in hashes' do + pp = <<-EOS + $a = { 'aaa' => 'bbb','bbb' => 'ccc','ddd' => 'eee' } + $b = 'ccc' + $c = false + $o = has_key($a,$b) + if $o == $c { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-hashes' + end +end diff --git a/spec/acceptance/hash_spec.rb b/spec/acceptance/hash_spec.rb new file mode 100755 index 0000000..ed53834 --- /dev/null +++ b/spec/acceptance/hash_spec.rb @@ -0,0 +1,26 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'hash function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'hashs arrays' do + pp = <<-EOS + $a = ['aaa','bbb','bbb','ccc','ddd','eee'] + $b = { 'aaa' => 'bbb', 'bbb' => 'ccc', 'ddd' => 'eee' } + $o = hash($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'handles odd-length arrays' + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-arrays' + end +end diff --git a/spec/acceptance/intersection_spec.rb b/spec/acceptance/intersection_spec.rb new file mode 100755 index 0000000..66b8652 --- /dev/null +++ b/spec/acceptance/intersection_spec.rb @@ -0,0 +1,27 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'intersection function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'intersections arrays' do + pp = <<-EOS + $a = ['aaa','bbb','ccc'] + $b = ['bbb','ccc','ddd','eee'] + $c = ['bbb','ccc'] + $o = intersection($a,$b) + if $o == $c { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'intersections empty arrays' + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-arrays' + end +end diff --git a/spec/acceptance/is_array_spec.rb b/spec/acceptance/is_array_spec.rb new file mode 100755 index 0000000..9c6bad7 --- /dev/null +++ b/spec/acceptance/is_array_spec.rb @@ -0,0 +1,67 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'is_array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'is_arrays arrays' do + pp = <<-EOS + $a = ['aaa','bbb','ccc'] + $b = true + $o = is_array($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_arrays empty arrays' do + pp = <<-EOS + $a = [] + $b = true + $o = is_array($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_arrays strings' do + pp = <<-EOS + $a = "aoeu" + $b = false + $o = is_array($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_arrays hashes' do + pp = <<-EOS + $a = {'aaa'=>'bbb'} + $b = false + $o = is_array($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-arrays' + end +end diff --git a/spec/acceptance/is_bool_spec.rb b/spec/acceptance/is_bool_spec.rb new file mode 100755 index 0000000..60079f9 --- /dev/null +++ b/spec/acceptance/is_bool_spec.rb @@ -0,0 +1,81 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'is_bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'is_bools arrays' do + pp = <<-EOS + $a = ['aaa','bbb','ccc'] + $b = false + $o = is_bool($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_bools true' do + pp = <<-EOS + $a = true + $b = true + $o = is_bool($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_bools false' do + pp = <<-EOS + $a = false + $b = true + $o = is_bool($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_bools strings' do + pp = <<-EOS + $a = "true" + $b = false + $o = is_bool($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_bools hashes' do + pp = <<-EOS + $a = {'aaa'=>'bbb'} + $b = false + $o = is_bool($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-arrays' + end +end diff --git a/spec/acceptance/is_domain_name_spec.rb b/spec/acceptance/is_domain_name_spec.rb new file mode 100755 index 0000000..e0f03fa --- /dev/null +++ b/spec/acceptance/is_domain_name_spec.rb @@ -0,0 +1,83 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'is_domain_name function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'is_domain_names arrays' do + pp = <<-EOS + $a = ['aaa.com','bbb','ccc'] + $o = is_domain_name($a) + notice(inline_template('is_domain_name is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/is_domain_name is false/) + end + end + it 'is_domain_names true' do + pp = <<-EOS + $a = true + $o = is_domain_name($a) + notice(inline_template('is_domain_name is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/is_domain_name is false/) + end + end + it 'is_domain_names false' do + pp = <<-EOS + $a = false + $o = is_domain_name($a) + notice(inline_template('is_domain_name is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/is_domain_name is false/) + end + end + it 'is_domain_names strings with hyphens' do + pp = <<-EOS + $a = "3foo-bar.2bar-fuzz.com" + $b = true + $o = is_domain_name($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_domain_names strings beginning with hyphens' do + pp = <<-EOS + $a = "-bar.2bar-fuzz.com" + $b = false + $o = is_domain_name($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_domain_names hashes' do + pp = <<-EOS + $a = {'aaa'=>'www.com'} + $o = is_domain_name($a) + notice(inline_template('is_domain_name is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/is_domain_name is false/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-arrays' + end +end diff --git a/spec/acceptance/is_float_spec.rb b/spec/acceptance/is_float_spec.rb new file mode 100755 index 0000000..79b01f0 --- /dev/null +++ b/spec/acceptance/is_float_spec.rb @@ -0,0 +1,86 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'is_float function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'is_floats arrays' do + pp = <<-EOS + $a = ['aaa.com','bbb','ccc'] + $o = is_float($a) + notice(inline_template('is_floats is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/is_float is false/) + end + end + it 'is_floats true' do + pp = <<-EOS + $a = true + $o = is_float($a) + notice(inline_template('is_floats is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/is_float is false/) + end + end + it 'is_floats strings' do + pp = <<-EOS + $a = "3.5" + $b = true + $o = is_float($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_floats floats' do + pp = <<-EOS + $a = 3.5 + $b = true + $o = is_float($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_floats integers' do + pp = <<-EOS + $a = 3 + $b = false + $o = is_float($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_floats hashes' do + pp = <<-EOS + $a = {'aaa'=>'www.com'} + $o = is_float($a) + notice(inline_template('is_float is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/is_floats is false/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-arrays' + end +end diff --git a/spec/acceptance/is_function_available_spec.rb b/spec/acceptance/is_function_available_spec.rb new file mode 100755 index 0000000..2b5dd6d --- /dev/null +++ b/spec/acceptance/is_function_available_spec.rb @@ -0,0 +1,58 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'is_function_available function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'is_function_availables arrays' do + pp = <<-EOS + $a = ['fail','include','require'] + $o = is_function_available($a) + notice(inline_template('is_function_available is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/is_function_available is false/) + end + end + it 'is_function_availables true' do + pp = <<-EOS + $a = true + $o = is_function_available($a) + notice(inline_template('is_function_available is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/is_function_available is false/) + end + end + it 'is_function_availables strings' do + pp = <<-EOS + $a = "fail" + $b = true + $o = is_function_available($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_function_availables function_availables' do + pp = <<-EOS + $a = "is_function_available" + $o = is_function_available($a) + notice(inline_template('is_function_available is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/is_function_available is true/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-arrays' + end +end diff --git a/spec/acceptance/is_hash_spec.rb b/spec/acceptance/is_hash_spec.rb new file mode 100755 index 0000000..2ef310a --- /dev/null +++ b/spec/acceptance/is_hash_spec.rb @@ -0,0 +1,63 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'is_hash function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'is_hashs arrays' do + pp = <<-EOS + $a = ['aaa','bbb','ccc'] + $o = is_hash($a) + notice(inline_template('is_hash is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/is_hash is false/) + end + end + it 'is_hashs empty hashs' do + pp = <<-EOS + $a = {} + $b = true + $o = is_hash($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_hashs strings' do + pp = <<-EOS + $a = "aoeu" + $b = false + $o = is_hash($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_hashs hashes' do + pp = <<-EOS + $a = {'aaa'=>'bbb'} + $b = true + $o = is_hash($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + end +end diff --git a/spec/acceptance/is_integer_spec.rb b/spec/acceptance/is_integer_spec.rb new file mode 100755 index 0000000..bf6902b --- /dev/null +++ b/spec/acceptance/is_integer_spec.rb @@ -0,0 +1,95 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'is_integer function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'is_integers arrays' do + pp = <<-EOS + $a = ['aaa.com','bbb','ccc'] + $b = false + $o = is_integer($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_integers true' do + pp = <<-EOS + $a = true + $b = false + $o = is_integer($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_integers strings' do + pp = <<-EOS + $a = "3" + $b = true + $o = is_integer($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_integers floats' do + pp = <<-EOS + $a = 3.5 + $b = false + $o = is_integer($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_integers integers' do + pp = <<-EOS + $a = 3 + $b = true + $o = is_integer($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_integers hashes' do + pp = <<-EOS + $a = {'aaa'=>'www.com'} + $b = false + $o = is_integer($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-arrays' + end +end diff --git a/spec/acceptance/is_ip_address_spec.rb b/spec/acceptance/is_ip_address_spec.rb new file mode 100755 index 0000000..ed7a854 --- /dev/null +++ b/spec/acceptance/is_ip_address_spec.rb @@ -0,0 +1,80 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'is_ip_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'is_ip_addresss ipv4' do + pp = <<-EOS + $a = '1.2.3.4' + $b = true + $o = is_ip_address($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_ip_addresss ipv6' do + pp = <<-EOS + $a = "fe80:0000:cd12:d123:e2f8:47ff:fe09:dd74" + $b = true + $o = is_ip_address($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_ip_addresss ipv6 compressed' do + pp = <<-EOS + $a = "fe00::1" + $b = true + $o = is_ip_address($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_ip_addresss strings' do + pp = <<-EOS + $a = "aoeu" + $b = false + $o = is_ip_address($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_ip_addresss ipv4 out of range' do + pp = <<-EOS + $a = '1.2.3.400' + $b = false + $o = is_ip_address($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + end +end diff --git a/spec/acceptance/is_mac_address_spec.rb b/spec/acceptance/is_mac_address_spec.rb new file mode 100755 index 0000000..a2c892f --- /dev/null +++ b/spec/acceptance/is_mac_address_spec.rb @@ -0,0 +1,38 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'is_mac_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'is_mac_addresss a mac' do + pp = <<-EOS + $a = '00:a0:1f:12:7f:a0' + $b = true + $o = is_mac_address($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_mac_addresss a mac out of range' do + pp = <<-EOS + $a = '00:a0:1f:12:7f:g0' + $b = false + $o = is_mac_address($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + end +end diff --git a/spec/acceptance/is_numeric_spec.rb b/spec/acceptance/is_numeric_spec.rb new file mode 100755 index 0000000..21c8988 --- /dev/null +++ b/spec/acceptance/is_numeric_spec.rb @@ -0,0 +1,95 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'is_numeric function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'is_numerics arrays' do + pp = <<-EOS + $a = ['aaa.com','bbb','ccc'] + $b = false + $o = is_numeric($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_numerics true' do + pp = <<-EOS + $a = true + $b = false + $o = is_numeric($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_numerics strings' do + pp = <<-EOS + $a = "3" + $b = true + $o = is_numeric($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_numerics floats' do + pp = <<-EOS + $a = 3.5 + $b = true + $o = is_numeric($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_numerics integers' do + pp = <<-EOS + $a = 3 + $b = true + $o = is_numeric($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_numerics hashes' do + pp = <<-EOS + $a = {'aaa'=>'www.com'} + $b = false + $o = is_numeric($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + it 'handles non-arrays' + end +end diff --git a/spec/acceptance/is_string_spec.rb b/spec/acceptance/is_string_spec.rb new file mode 100755 index 0000000..bda6cd7 --- /dev/null +++ b/spec/acceptance/is_string_spec.rb @@ -0,0 +1,102 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'is_string function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'is_strings arrays' do + pp = <<-EOS + $a = ['aaa.com','bbb','ccc'] + $b = false + $o = is_string($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_strings true' do + pp = <<-EOS + $a = true + $b = false + $o = is_string($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_strings strings' do + pp = <<-EOS + $a = "aoeu" + $o = is_string($a) + notice(inline_template('is_string is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/is_string is true/) + end + end + it 'is_strings number strings' do + pp = <<-EOS + $a = "3" + $o = is_string($a) + notice(inline_template('is_string is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/is_string is true/) + end + end + it 'is_strings floats' do + pp = <<-EOS + $a = 3.5 + $b = false + $o = is_string($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_strings integers' do + pp = <<-EOS + $a = 3 + $b = false + $o = is_string($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'is_strings hashes' do + pp = <<-EOS + $a = {'aaa'=>'www.com'} + $b = false + $o = is_string($a) + if $o == $b { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end + describe 'failure' do + it 'handles improper argument counts' + end +end diff --git a/spec/acceptance/join_keys_to_values_spec.rb b/spec/acceptance/join_keys_to_values_spec.rb new file mode 100755 index 0000000..70493fd --- /dev/null +++ b/spec/acceptance/join_keys_to_values_spec.rb @@ -0,0 +1,24 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'join_keys_to_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'join_keys_to_valuess hashes' do + pp = <<-EOS + $a = {'aaa'=>'bbb','ccc'=>'ddd'} + $b = ':' + $o = join_keys_to_values($a,$b) + notice(inline_template('join_keys_to_values is <%= @o.sort.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/join_keys_to_values is \["aaa:bbb", "ccc:ddd"\]/) + end + end + it 'handles non hashes' + it 'handles empty hashes' + end + describe 'failure' do + it 'handles improper argument counts' + end +end diff --git a/spec/acceptance/join_spec.rb b/spec/acceptance/join_spec.rb new file mode 100755 index 0000000..5397ce2 --- /dev/null +++ b/spec/acceptance/join_spec.rb @@ -0,0 +1,26 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'join function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'joins arrays' do + pp = <<-EOS + $a = ['aaa','bbb','ccc'] + $b = ':' + $c = 'aaa:bbb:ccc' + $o = join($a,$b) + if $o == $c { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'handles non arrays' + end + describe 'failure' do + it 'handles improper argument counts' + end +end diff --git a/spec/acceptance/keys_spec.rb b/spec/acceptance/keys_spec.rb new file mode 100755 index 0000000..176918e --- /dev/null +++ b/spec/acceptance/keys_spec.rb @@ -0,0 +1,23 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'keys function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'keyss hashes' do + pp = <<-EOS + $a = {'aaa'=>'bbb','ccc'=>'ddd'} + $o = keys($a) + notice(inline_template('keys is <%= @o.sort.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/keys is \["aaa", "ccc"\]/) + end + end + it 'handles non hashes' + it 'handles empty hashes' + end + describe 'failure' do + it 'handles improper argument counts' + end +end diff --git a/spec/acceptance/loadyaml_spec.rb b/spec/acceptance/loadyaml_spec.rb new file mode 100644 index 0000000..944a727 --- /dev/null +++ b/spec/acceptance/loadyaml_spec.rb @@ -0,0 +1,31 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'loadyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'loadyamls array of values' do + shell('echo "--- + aaa: 1 + bbb: 2 + ccc: 3 + ddd: 4" > /testyaml.yaml') + pp = <<-EOS + $o = loadyaml('/testyaml.yaml') + notice(inline_template('loadyaml[aaa] is <%= @o["aaa"].inspect %>')) + notice(inline_template('loadyaml[bbb] is <%= @o["bbb"].inspect %>')) + notice(inline_template('loadyaml[ccc] is <%= @o["ccc"].inspect %>')) + notice(inline_template('loadyaml[ddd] is <%= @o["ddd"].inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/loadyaml\[aaa\] is 1/) + expect(r.stdout).to match(/loadyaml\[bbb\] is 2/) + expect(r.stdout).to match(/loadyaml\[ccc\] is 3/) + expect(r.stdout).to match(/loadyaml\[ddd\] is 4/) + end + end + end + describe 'failure' do + it 'fails with no arguments' + end +end diff --git a/spec/acceptance/lstrip_spec.rb b/spec/acceptance/lstrip_spec.rb new file mode 100755 index 0000000..3dc952f --- /dev/null +++ b/spec/acceptance/lstrip_spec.rb @@ -0,0 +1,34 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'lstrip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'lstrips arrays' do + pp = <<-EOS + $a = [" the "," public "," art","galleries "] + # Anagram: Large picture halls, I bet + $o = lstrip($a) + notice(inline_template('lstrip is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/lstrip is \["the ", "public ", "art", "galleries "\]/) + end + end + it 'lstrips strings' do + pp = <<-EOS + $a = " blowzy night-frumps vex'd jack q " + $o = lstrip($a) + notice(inline_template('lstrip is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/lstrip is "blowzy night-frumps vex'd jack q "/) + end + end + end + describe 'failure' do + it 'handles no arguments' + it 'handles non strings or arrays' + end +end diff --git a/spec/acceptance/max_spec.rb b/spec/acceptance/max_spec.rb new file mode 100755 index 0000000..f04e3d2 --- /dev/null +++ b/spec/acceptance/max_spec.rb @@ -0,0 +1,20 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'max function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'maxs arrays' do + pp = <<-EOS + $o = max("the","public","art","galleries") + notice(inline_template('max is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/max is "the"/) + end + end + end + describe 'failure' do + it 'handles no arguments' + end +end diff --git a/spec/acceptance/member_spec.rb b/spec/acceptance/member_spec.rb new file mode 100755 index 0000000..b467dbb --- /dev/null +++ b/spec/acceptance/member_spec.rb @@ -0,0 +1,26 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'member function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'members arrays' do + pp = <<-EOS + $a = ['aaa','bbb','ccc'] + $b = 'ccc' + $c = true + $o = member($a,$b) + if $o == $c { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + it 'members arrays without members' + end + describe 'failure' do + it 'handles improper argument counts' + end +end diff --git a/spec/acceptance/merge_spec.rb b/spec/acceptance/merge_spec.rb new file mode 100755 index 0000000..a60e784 --- /dev/null +++ b/spec/acceptance/merge_spec.rb @@ -0,0 +1,23 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'merge function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'should merge two hashes' do + pp = <<-EOS + $a = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } } + $b = {'two' => 'dos', 'three' => { 'five' => 5 } } + $o = merge($a, $b) + notice(inline_template('merge[one] is <%= @o["one"].inspect %>')) + notice(inline_template('merge[two] is <%= @o["two"].inspect %>')) + notice(inline_template('merge[three] is <%= @o["three"].inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/merge\[one\] is "1"/) + expect(r.stdout).to match(/merge\[two\] is "dos"/) + expect(r.stdout).to match(/merge\[three\] is {"five"=>"5"}/) + end + end + end +end diff --git a/spec/acceptance/min_spec.rb b/spec/acceptance/min_spec.rb new file mode 100755 index 0000000..509092d --- /dev/null +++ b/spec/acceptance/min_spec.rb @@ -0,0 +1,20 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'min function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'mins arrays' do + pp = <<-EOS + $o = min("the","public","art","galleries") + notice(inline_template('min is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/min is "art"/) + end + end + end + describe 'failure' do + it 'handles no arguments' + end +end diff --git a/spec/acceptance/nodesets/centos-6-vcloud.yml b/spec/acceptance/nodesets/centos-6-vcloud.yml new file mode 100644 index 0000000..ca9c1d3 --- /dev/null +++ b/spec/acceptance/nodesets/centos-6-vcloud.yml @@ -0,0 +1,15 @@ +HOSTS: + 'centos-6-vcloud': + roles: + - master + platform: el-6-x86_64 + hypervisor: vcloud + template: centos-6-x86_64 +CONFIG: + type: foss + ssh: + keys: "~/.ssh/id_rsa-acceptance" + datastore: instance0 + folder: Delivery/Quality Assurance/Enterprise/Dynamic + resourcepool: delivery/Quality Assurance/Enterprise/Dynamic + pooling_api: http://vcloud.delivery.puppetlabs.net/ diff --git a/spec/acceptance/num2bool_spec.rb b/spec/acceptance/num2bool_spec.rb index 1d99ba0..1d99ba0 100644..100755 --- a/spec/acceptance/num2bool_spec.rb +++ b/spec/acceptance/num2bool_spec.rb diff --git a/spec/acceptance/parsejson_spec.rb b/spec/acceptance/parsejson_spec.rb index 5097810..5097810 100644..100755 --- a/spec/acceptance/parsejson_spec.rb +++ b/spec/acceptance/parsejson_spec.rb diff --git a/spec/acceptance/parseyaml_spec.rb b/spec/acceptance/parseyaml_spec.rb index 4b4bf3d..4b4bf3d 100644..100755 --- a/spec/acceptance/parseyaml_spec.rb +++ b/spec/acceptance/parseyaml_spec.rb diff --git a/spec/acceptance/pick_default_spec.rb b/spec/acceptance/pick_default_spec.rb index a663f54..a663f54 100644..100755 --- a/spec/acceptance/pick_default_spec.rb +++ b/spec/acceptance/pick_default_spec.rb diff --git a/spec/acceptance/pick_spec.rb b/spec/acceptance/pick_spec.rb index 46cf63f..46cf63f 100644..100755 --- a/spec/acceptance/pick_spec.rb +++ b/spec/acceptance/pick_spec.rb diff --git a/spec/acceptance/prefix_spec.rb b/spec/acceptance/prefix_spec.rb index de55530..de55530 100644..100755 --- a/spec/acceptance/prefix_spec.rb +++ b/spec/acceptance/prefix_spec.rb diff --git a/spec/acceptance/range_spec.rb b/spec/acceptance/range_spec.rb index a3ccd33..a3ccd33 100644..100755 --- a/spec/acceptance/range_spec.rb +++ b/spec/acceptance/range_spec.rb diff --git a/spec/acceptance/reject_spec.rb b/spec/acceptance/reject_spec.rb index 7f16a00..7f16a00 100644..100755 --- a/spec/acceptance/reject_spec.rb +++ b/spec/acceptance/reject_spec.rb diff --git a/spec/acceptance/reverse_spec.rb b/spec/acceptance/reverse_spec.rb index c3f0156..c3f0156 100644..100755 --- a/spec/acceptance/reverse_spec.rb +++ b/spec/acceptance/reverse_spec.rb diff --git a/spec/acceptance/rstrip_spec.rb b/spec/acceptance/rstrip_spec.rb index b57a8b0..b57a8b0 100644..100755 --- a/spec/acceptance/rstrip_spec.rb +++ b/spec/acceptance/rstrip_spec.rb diff --git a/spec/acceptance/shuffle_spec.rb b/spec/acceptance/shuffle_spec.rb index 02d1201..02d1201 100644..100755 --- a/spec/acceptance/shuffle_spec.rb +++ b/spec/acceptance/shuffle_spec.rb diff --git a/spec/acceptance/size_spec.rb b/spec/acceptance/size_spec.rb index a52b778..a52b778 100644..100755 --- a/spec/acceptance/size_spec.rb +++ b/spec/acceptance/size_spec.rb diff --git a/spec/acceptance/sort_spec.rb b/spec/acceptance/sort_spec.rb index c85bfab..c85bfab 100644..100755 --- a/spec/acceptance/sort_spec.rb +++ b/spec/acceptance/sort_spec.rb diff --git a/spec/acceptance/squeeze_spec.rb b/spec/acceptance/squeeze_spec.rb index 400a458..400a458 100644..100755 --- a/spec/acceptance/squeeze_spec.rb +++ b/spec/acceptance/squeeze_spec.rb diff --git a/spec/acceptance/str2bool_spec.rb b/spec/acceptance/str2bool_spec.rb index cf549da..cf549da 100644..100755 --- a/spec/acceptance/str2bool_spec.rb +++ b/spec/acceptance/str2bool_spec.rb diff --git a/spec/acceptance/str2saltedsha512_spec.rb b/spec/acceptance/str2saltedsha512_spec.rb index 993e63b..993e63b 100644..100755 --- a/spec/acceptance/str2saltedsha512_spec.rb +++ b/spec/acceptance/str2saltedsha512_spec.rb diff --git a/spec/acceptance/strftime_spec.rb b/spec/acceptance/strftime_spec.rb index 53b7f90..53b7f90 100644..100755 --- a/spec/acceptance/strftime_spec.rb +++ b/spec/acceptance/strftime_spec.rb diff --git a/spec/acceptance/strip_spec.rb b/spec/acceptance/strip_spec.rb index 906fd7a..906fd7a 100644..100755 --- a/spec/acceptance/strip_spec.rb +++ b/spec/acceptance/strip_spec.rb diff --git a/spec/acceptance/suffix_spec.rb b/spec/acceptance/suffix_spec.rb index 630f866..630f866 100644..100755 --- a/spec/acceptance/suffix_spec.rb +++ b/spec/acceptance/suffix_spec.rb diff --git a/spec/acceptance/swapcase_spec.rb b/spec/acceptance/swapcase_spec.rb index b7894fb..b7894fb 100644..100755 --- a/spec/acceptance/swapcase_spec.rb +++ b/spec/acceptance/swapcase_spec.rb diff --git a/spec/acceptance/time_spec.rb b/spec/acceptance/time_spec.rb index cdb2960..cdb2960 100644..100755 --- a/spec/acceptance/time_spec.rb +++ b/spec/acceptance/time_spec.rb diff --git a/spec/acceptance/to_bytes_spec.rb b/spec/acceptance/to_bytes_spec.rb index 2b4c61f..2b4c61f 100644..100755 --- a/spec/acceptance/to_bytes_spec.rb +++ b/spec/acceptance/to_bytes_spec.rb diff --git a/spec/acceptance/type_spec.rb b/spec/acceptance/type_spec.rb index 0043aad..0043aad 100644..100755 --- a/spec/acceptance/type_spec.rb +++ b/spec/acceptance/type_spec.rb diff --git a/spec/acceptance/union_spec.rb b/spec/acceptance/union_spec.rb index 6db8d0c..6db8d0c 100644..100755 --- a/spec/acceptance/union_spec.rb +++ b/spec/acceptance/union_spec.rb diff --git a/spec/acceptance/unique_spec.rb b/spec/acceptance/unique_spec.rb index bfadad1..bfadad1 100644..100755 --- a/spec/acceptance/unique_spec.rb +++ b/spec/acceptance/unique_spec.rb diff --git a/spec/acceptance/unsupported_spec.rb b/spec/acceptance/unsupported_spec.rb index 1c559f6..1c559f6 100644..100755 --- a/spec/acceptance/unsupported_spec.rb +++ b/spec/acceptance/unsupported_spec.rb diff --git a/spec/acceptance/upcase_spec.rb b/spec/acceptance/upcase_spec.rb index 3d2906d..3d2906d 100644..100755 --- a/spec/acceptance/upcase_spec.rb +++ b/spec/acceptance/upcase_spec.rb diff --git a/spec/acceptance/uriescape_spec.rb b/spec/acceptance/uriescape_spec.rb index 7e30205..7e30205 100644..100755 --- a/spec/acceptance/uriescape_spec.rb +++ b/spec/acceptance/uriescape_spec.rb diff --git a/spec/acceptance/validate_absolute_path_spec.rb b/spec/acceptance/validate_absolute_path_spec.rb index 7082e84..7082e84 100644..100755 --- a/spec/acceptance/validate_absolute_path_spec.rb +++ b/spec/acceptance/validate_absolute_path_spec.rb diff --git a/spec/acceptance/validate_array_spec.rb b/spec/acceptance/validate_array_spec.rb index b53e98c..b53e98c 100644..100755 --- a/spec/acceptance/validate_array_spec.rb +++ b/spec/acceptance/validate_array_spec.rb diff --git a/spec/acceptance/validate_augeas_spec.rb b/spec/acceptance/validate_augeas_spec.rb index aeec67a..aeec67a 100644..100755 --- a/spec/acceptance/validate_augeas_spec.rb +++ b/spec/acceptance/validate_augeas_spec.rb diff --git a/spec/acceptance/validate_bool_spec.rb b/spec/acceptance/validate_bool_spec.rb index c837f08..c837f08 100644..100755 --- a/spec/acceptance/validate_bool_spec.rb +++ b/spec/acceptance/validate_bool_spec.rb diff --git a/spec/acceptance/validate_cmd_spec.rb b/spec/acceptance/validate_cmd_spec.rb index 385676d..385676d 100644..100755 --- a/spec/acceptance/validate_cmd_spec.rb +++ b/spec/acceptance/validate_cmd_spec.rb diff --git a/spec/acceptance/validate_hash_spec.rb b/spec/acceptance/validate_hash_spec.rb index 52fb615..52fb615 100644..100755 --- a/spec/acceptance/validate_hash_spec.rb +++ b/spec/acceptance/validate_hash_spec.rb diff --git a/spec/acceptance/validate_ipv4_address_spec.rb b/spec/acceptance/validate_ipv4_address_spec.rb index 64841c3..64841c3 100644..100755 --- a/spec/acceptance/validate_ipv4_address_spec.rb +++ b/spec/acceptance/validate_ipv4_address_spec.rb diff --git a/spec/acceptance/validate_ipv6_address_spec.rb b/spec/acceptance/validate_ipv6_address_spec.rb index 6426d1a..6426d1a 100644..100755 --- a/spec/acceptance/validate_ipv6_address_spec.rb +++ b/spec/acceptance/validate_ipv6_address_spec.rb diff --git a/spec/acceptance/validate_re_spec.rb b/spec/acceptance/validate_re_spec.rb index 22f6d47..22f6d47 100644..100755 --- a/spec/acceptance/validate_re_spec.rb +++ b/spec/acceptance/validate_re_spec.rb diff --git a/spec/acceptance/validate_slength_spec.rb b/spec/acceptance/validate_slength_spec.rb index 1ab2bb9..1ab2bb9 100644..100755 --- a/spec/acceptance/validate_slength_spec.rb +++ b/spec/acceptance/validate_slength_spec.rb diff --git a/spec/acceptance/validate_string_spec.rb b/spec/acceptance/validate_string_spec.rb index 8956f48..8956f48 100644..100755 --- a/spec/acceptance/validate_string_spec.rb +++ b/spec/acceptance/validate_string_spec.rb diff --git a/spec/acceptance/values_at_spec.rb b/spec/acceptance/values_at_spec.rb index da63cf3..da63cf3 100644..100755 --- a/spec/acceptance/values_at_spec.rb +++ b/spec/acceptance/values_at_spec.rb diff --git a/spec/acceptance/values_spec.rb b/spec/acceptance/values_spec.rb index 7ef956e..7ef956e 100644..100755 --- a/spec/acceptance/values_spec.rb +++ b/spec/acceptance/values_spec.rb diff --git a/spec/acceptance/zip_spec.rb b/spec/acceptance/zip_spec.rb index 0e924e8..0e924e8 100644..100755 --- a/spec/acceptance/zip_spec.rb +++ b/spec/acceptance/zip_spec.rb |