From 9a3107fed17a1cfe9d829517ed91c345c6fec774 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Wed, 12 Mar 2014 18:22:23 +0000 Subject: Add beaker framework. This prepares the module for beaker acceptance tests. --- spec/acceptance/nodesets/centos-64-x64-pe.yml | 12 ++++++++++++ spec/acceptance/nodesets/centos-64-x64.yml | 10 ++++++++++ spec/acceptance/nodesets/centos-65-x64.yml | 10 ++++++++++ spec/acceptance/nodesets/default.yml | 1 + spec/acceptance/nodesets/fedora-18-x64.yml | 10 ++++++++++ spec/acceptance/nodesets/sles-11-x64.yml | 10 ++++++++++ spec/acceptance/nodesets/ubuntu-server-10044-x64.yml | 10 ++++++++++ spec/acceptance/nodesets/ubuntu-server-12042-x64.yml | 10 ++++++++++ spec/acceptance/unsupported_spec.rb | 10 ++++++++++ 9 files changed, 83 insertions(+) create mode 100644 spec/acceptance/nodesets/centos-64-x64-pe.yml create mode 100644 spec/acceptance/nodesets/centos-64-x64.yml create mode 100644 spec/acceptance/nodesets/centos-65-x64.yml create mode 120000 spec/acceptance/nodesets/default.yml create mode 100644 spec/acceptance/nodesets/fedora-18-x64.yml create mode 100644 spec/acceptance/nodesets/sles-11-x64.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-10044-x64.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-12042-x64.yml create mode 100644 spec/acceptance/unsupported_spec.rb (limited to 'spec/acceptance') diff --git a/spec/acceptance/nodesets/centos-64-x64-pe.yml b/spec/acceptance/nodesets/centos-64-x64-pe.yml new file mode 100644 index 0000000..7d9242f --- /dev/null +++ b/spec/acceptance/nodesets/centos-64-x64-pe.yml @@ -0,0 +1,12 @@ +HOSTS: + centos-64-x64: + roles: + - master + - database + - dashboard + platform: el-6-x86_64 + box : centos-64-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: pe diff --git a/spec/acceptance/nodesets/centos-64-x64.yml b/spec/acceptance/nodesets/centos-64-x64.yml new file mode 100644 index 0000000..05540ed --- /dev/null +++ b/spec/acceptance/nodesets/centos-64-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-64-x64: + roles: + - master + platform: el-6-x86_64 + box : centos-64-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/centos-65-x64.yml b/spec/acceptance/nodesets/centos-65-x64.yml new file mode 100644 index 0000000..4e2cb80 --- /dev/null +++ b/spec/acceptance/nodesets/centos-65-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-65-x64: + roles: + - master + platform: el-6-x86_64 + box : centos-65-x64-vbox436-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box + hypervisor : vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml new file mode 120000 index 0000000..2719644 --- /dev/null +++ b/spec/acceptance/nodesets/default.yml @@ -0,0 +1 @@ +centos-64-x64.yml \ No newline at end of file diff --git a/spec/acceptance/nodesets/fedora-18-x64.yml b/spec/acceptance/nodesets/fedora-18-x64.yml new file mode 100644 index 0000000..1361649 --- /dev/null +++ b/spec/acceptance/nodesets/fedora-18-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + fedora-18-x64: + roles: + - master + platform: fedora-18-x86_64 + box : fedora-18-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/fedora-18-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/sles-11-x64.yml b/spec/acceptance/nodesets/sles-11-x64.yml new file mode 100644 index 0000000..41abe21 --- /dev/null +++ b/spec/acceptance/nodesets/sles-11-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + sles-11-x64.local: + roles: + - master + platform: sles-11-x64 + box : sles-11sp1-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/sles-11sp1-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml b/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml new file mode 100644 index 0000000..5ca1514 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-server-10044-x64: + roles: + - master + platform: ubuntu-10.04-amd64 + box : ubuntu-server-10044-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml b/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml new file mode 100644 index 0000000..d065b30 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-server-12042-x64: + roles: + - master + platform: ubuntu-12.04-amd64 + box : ubuntu-server-12042-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/unsupported_spec.rb b/spec/acceptance/unsupported_spec.rb new file mode 100644 index 0000000..449f35a --- /dev/null +++ b/spec/acceptance/unsupported_spec.rb @@ -0,0 +1,10 @@ +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 -- cgit v1.2.3 From afb78e2b253dfe43816e20afa2f4732eb9dc17eb Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Thu, 13 Mar 2014 18:21:38 +0000 Subject: Add some acceptance tests for functions. --- spec/acceptance/abs_spec.rb | 27 +++++++++++++++++ spec/acceptance/any2array_spec.rb | 46 +++++++++++++++++++++++++++++ spec/acceptance/base64_spec.rb | 15 ++++++++++ spec/acceptance/bool2num_spec.rb | 31 +++++++++++++++++++ spec/acceptance/capitalize_spec.rb | 30 +++++++++++++++++++ spec/acceptance/chomp_spec.rb | 18 +++++++++++ spec/acceptance/chop_spec.rb | 42 ++++++++++++++++++++++++++ spec/acceptance/concat_spec.rb | 15 ++++++++++ spec/acceptance/count_spec.rb | 27 +++++++++++++++++ spec/acceptance/deep_merge_spec.rb | 17 +++++++++++ spec/acceptance/defined_with_params_spec.rb | 19 ++++++++++++ spec/acceptance/delete_at_spec.rb | 16 ++++++++++ spec/acceptance/delete_spec.rb | 16 ++++++++++ spec/acceptance/delete_undef_values_spec.rb | 16 ++++++++++ 14 files changed, 335 insertions(+) create mode 100644 spec/acceptance/abs_spec.rb create mode 100644 spec/acceptance/any2array_spec.rb create mode 100644 spec/acceptance/base64_spec.rb create mode 100644 spec/acceptance/bool2num_spec.rb create mode 100644 spec/acceptance/capitalize_spec.rb create mode 100644 spec/acceptance/chomp_spec.rb create mode 100644 spec/acceptance/chop_spec.rb create mode 100644 spec/acceptance/concat_spec.rb create mode 100644 spec/acceptance/count_spec.rb create mode 100644 spec/acceptance/deep_merge_spec.rb create mode 100644 spec/acceptance/defined_with_params_spec.rb create mode 100644 spec/acceptance/delete_at_spec.rb create mode 100644 spec/acceptance/delete_spec.rb create mode 100644 spec/acceptance/delete_undef_values_spec.rb (limited to 'spec/acceptance') diff --git a/spec/acceptance/abs_spec.rb b/spec/acceptance/abs_spec.rb new file mode 100644 index 0000000..0921497 --- /dev/null +++ b/spec/acceptance/abs_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper_acceptance' + +describe 'abs function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + it 'should accept a string' do + pp = <<-EOS + $input = '-34.56' + $output = abs($input) + notify { $output: } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: 34.56/) + end + end + + it 'should accept a float' do + pp = <<-EOS + $input = -34.56 + $output = abs($input) + notify { $output: } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: 34.56/) + end + end +end diff --git a/spec/acceptance/any2array_spec.rb b/spec/acceptance/any2array_spec.rb new file mode 100644 index 0000000..7d452ed --- /dev/null +++ b/spec/acceptance/any2array_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper_acceptance' + +describe 'any2array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + it 'should create an empty array' do + pp = <<-EOS + $input = '' + $output = any2array($input) + validate_array($output) + notify { "Output: ${output}": } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: Output: /) + end + end + + it 'should leave arrays modified' do + pp = <<-EOS + $input = ['test', 'array'] + $output = any2array($input) + validate_array($output) + notify { "Output: ${output}": } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: Output: testarray/) + end + end + + it 'should turn a hash into an array' do + pp = <<-EOS + $input = {'test' => 'array'} + $output = any2array($input) + + validate_array($output) + # Check each element of the array is a plain string. + validate_string($output[0]) + validate_string($output[1]) + notify { "Output: ${output}": } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: Output: testarray/) + end + end +end diff --git a/spec/acceptance/base64_spec.rb b/spec/acceptance/base64_spec.rb new file mode 100644 index 0000000..c29b3a7 --- /dev/null +++ b/spec/acceptance/base64_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper_acceptance' + +describe 'base64 function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + it 'should encode then decode a string' do + pp = <<-EOS + $encodestring = base64('encode', 'thestring') + $decodestring = base64('decode', $encodestring) + notify { $decodestring: } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/thestring/) + end + end +end diff --git a/spec/acceptance/bool2num_spec.rb b/spec/acceptance/bool2num_spec.rb new file mode 100644 index 0000000..5bdb452 --- /dev/null +++ b/spec/acceptance/bool2num_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper_acceptance' + +describe 'bool2num function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + ['false', 'f', '0', 'n', 'no'].each do |bool| + it 'should convert a given boolean, #{bool}, to 0' do + pp = <<-EOS + $input = #{bool} + $output = bool2num($input) + notify { $output: } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: 0/) + end + end + end + + ['true', 't', '1', 'y', 'yes'].each do |bool| + it 'should convert a given boolean, #{bool}, to 1' do + pp = <<-EOS + $input = #{bool} + $output = bool2num($input) + notify { $output: } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: 1/) + end + end + end +end diff --git a/spec/acceptance/capitalize_spec.rb b/spec/acceptance/capitalize_spec.rb new file mode 100644 index 0000000..41e16e9 --- /dev/null +++ b/spec/acceptance/capitalize_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper_acceptance' + +describe 'capitalize function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + it 'should capitalize the first letter of a string' do + pp = <<-EOS + $input = 'this is a string' + $output = capitalize($input) + notify { $output: } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: This is a string/) + end + end + + it 'should capitalize the first letter of an array of strings' do + pp = <<-EOS + $input = ['this', 'is', 'a', 'string'] + $output = capitalize($input) + notify { $output: } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: This/) + expect(r.stdout).to match(/Notice: Is/) + expect(r.stdout).to match(/Notice: A/) + expect(r.stdout).to match(/Notice: String/) + end + end +end diff --git a/spec/acceptance/chomp_spec.rb b/spec/acceptance/chomp_spec.rb new file mode 100644 index 0000000..052226f --- /dev/null +++ b/spec/acceptance/chomp_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper_acceptance' + +describe 'chomp function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + it 'should eat the newline' do + pp = <<-EOS + $input = "test\n" + if size($input) != 5 { + fail("Size of ${input} is not 5.") + } + $output = chomp($input) + if size($output) != 4 { + fail("Size of ${input} is not 4.") + } + EOS + + apply_manifest(pp, :catch_failures => true) + end +end diff --git a/spec/acceptance/chop_spec.rb b/spec/acceptance/chop_spec.rb new file mode 100644 index 0000000..f1183a1 --- /dev/null +++ b/spec/acceptance/chop_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper_acceptance' + +describe 'chop function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + it 'should eat the last character' do + pp = <<-EOS + $input = "test" + if size($input) != 4 { + fail("Size of ${input} is not 4.") + } + $output = chop($input) + if size($output) != 3 { + fail("Size of ${input} is not 3.") + } + EOS + + apply_manifest(pp, :catch_failures => true) + end + + it 'should eat the last two characters of \r\n' do + pp = <<-EOS + $input = "test\r\n" + if size($input) != 6 { + fail("Size of ${input} is not 6.") + } + $output = chop($input) + if size($output) != 4 { + fail("Size of ${input} is not 4.") + } + EOS + + apply_manifest(pp, :catch_failures => true) + end + + it 'should not fail on empty strings' do + pp = <<-EOS + $input = "" + $output = chop($input) + EOS + + apply_manifest(pp, :catch_failures => true) + end +end diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb new file mode 100644 index 0000000..1fe7729 --- /dev/null +++ b/spec/acceptance/concat_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper_acceptance' + +describe 'concat function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + it 'should concat one array to another' do + pp = <<-EOS + $output = concat(['1','2','3'],['4','5','6']) + validate_array($output) + if size($output) != 6 { + fail("${output} should have 6 elements.") + } + EOS + + apply_manifest(pp, :catch_failures => true) + end +end diff --git a/spec/acceptance/count_spec.rb b/spec/acceptance/count_spec.rb new file mode 100644 index 0000000..cc46be0 --- /dev/null +++ b/spec/acceptance/count_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper_acceptance' + +describe 'count function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + it 'should count elements in an array' do + pp = <<-EOS + $input = [1,2,3,4] + $output = count($input) + notify { $output: } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: 4/) + end + end + + it 'should count elements in an array that match a second argument' do + pp = <<-EOS + $input = [1,1,1,2] + $output = count($input, 1) + notify { $output: } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: 3/) + end + end +end diff --git a/spec/acceptance/deep_merge_spec.rb b/spec/acceptance/deep_merge_spec.rb new file mode 100644 index 0000000..c7f35be --- /dev/null +++ b/spec/acceptance/deep_merge_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper_acceptance' + +describe 'deep_merge function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + it 'should deep merge two hashes' do + pp = <<-EOS + $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } } + $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } } + $merged_hash = deep_merge($hash1, $hash2) + + if $merged_hash != { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } } { + fail("Hash was incorrectly merged.") + } + EOS + + apply_manifest(pp, :catch_failures => true) + end +end diff --git a/spec/acceptance/defined_with_params_spec.rb b/spec/acceptance/defined_with_params_spec.rb new file mode 100644 index 0000000..eb549e5 --- /dev/null +++ b/spec/acceptance/defined_with_params_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper_acceptance' + +describe 'defined_with_params function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + it 'should successfully notify' do + pp = <<-EOS + user { 'dan': + ensure => present, + } + + if defined_with_params(User[dan], {'ensure' => 'present' }) { + notify { 'User defined with ensure=>present': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: User defined with ensure=>present/) + end + end +end diff --git a/spec/acceptance/delete_at_spec.rb b/spec/acceptance/delete_at_spec.rb new file mode 100644 index 0000000..42d7a77 --- /dev/null +++ b/spec/acceptance/delete_at_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper_acceptance' + +describe 'delete_at function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + it 'should delete elements of the array' do + pp = <<-EOS + $output = delete_at(['a','b','c','b'], 1) + if $output == ['a','c','b'] { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end +end diff --git a/spec/acceptance/delete_spec.rb b/spec/acceptance/delete_spec.rb new file mode 100644 index 0000000..63804bc --- /dev/null +++ b/spec/acceptance/delete_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper_acceptance' + +describe 'delete function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + it 'should delete elements of the array' do + pp = <<-EOS + $output = delete(['a','b','c','b'], 'b') + if $output == ['a','c'] { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end +end diff --git a/spec/acceptance/delete_undef_values_spec.rb b/spec/acceptance/delete_undef_values_spec.rb new file mode 100644 index 0000000..1ecdf4c --- /dev/null +++ b/spec/acceptance/delete_undef_values_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper_acceptance' + +describe 'delete_undef_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + it 'should delete elements of the array' do + pp = <<-EOS + $output = delete_undef_values({a=>'A', b=>'', c=>undef, d => false}) + if $output == { a => 'A', b => '', d => false } { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end +end -- cgit v1.2.3 From fcbc4b59a69c62239d15aa11ce7fccaeb93da9cf Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Fri, 14 Mar 2014 18:17:12 -0700 Subject: First set of tests --- spec/acceptance/validate_array_spec.rb | 36 ++++++++++++++++ spec/acceptance/validate_augeas_spec.rb | 39 +++++++++++++++++ spec/acceptance/validate_bool_spec.rb | 36 ++++++++++++++++ spec/acceptance/validate_cmd_spec.rb | 49 +++++++++++++++++++++ spec/acceptance/validate_hash_spec.rb | 36 ++++++++++++++++ spec/acceptance/validate_re_spec.rb | 46 ++++++++++++++++++++ spec/acceptance/validate_slength_spec.rb | 71 +++++++++++++++++++++++++++++++ spec/acceptance/validate_string_spec.rb | 35 +++++++++++++++ spec/acceptance/values_at_spec.rb | 71 +++++++++++++++++++++++++++++++ spec/acceptance/values_spec.rb | 30 +++++++++++++ spec/acceptance/zip_spec.rb | 73 ++++++++++++++++++++++++++++++++ 11 files changed, 522 insertions(+) create mode 100644 spec/acceptance/validate_array_spec.rb create mode 100644 spec/acceptance/validate_augeas_spec.rb create mode 100644 spec/acceptance/validate_bool_spec.rb create mode 100644 spec/acceptance/validate_cmd_spec.rb create mode 100644 spec/acceptance/validate_hash_spec.rb create mode 100644 spec/acceptance/validate_re_spec.rb create mode 100644 spec/acceptance/validate_slength_spec.rb create mode 100644 spec/acceptance/validate_string_spec.rb create mode 100644 spec/acceptance/values_at_spec.rb create mode 100644 spec/acceptance/values_spec.rb create mode 100644 spec/acceptance/zip_spec.rb (limited to 'spec/acceptance') diff --git a/spec/acceptance/validate_array_spec.rb b/spec/acceptance/validate_array_spec.rb new file mode 100644 index 0000000..da9f465 --- /dev/null +++ b/spec/acceptance/validate_array_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper_acceptance' + +describe 'validate_array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'validates a single argument' do + pp = <<-EOS + $one = ['a', 'b'] + validate_array($one) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates an multiple arguments' do + pp = <<-EOS + $one = ['a', 'b'] + $two = [['c'], 'd'] + validate_array($one,$two) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates a non-array' do + { + %{validate_array({'a' => 'hash' })} => "Hash", + %{validate_array('string')} => "String", + %{validate_array(false)} => "FalseClass", + %{validate_array(undef)} => "String" + }.each do |pp,type| + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/a #{type}/) + end + end + end + describe 'failure' do + it 'handles improper number of arguments' + end +end diff --git a/spec/acceptance/validate_augeas_spec.rb b/spec/acceptance/validate_augeas_spec.rb new file mode 100644 index 0000000..8b904f5 --- /dev/null +++ b/spec/acceptance/validate_augeas_spec.rb @@ -0,0 +1,39 @@ +require 'spec_helper_acceptance' + +describe 'validate_augeas function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'prep' do + it 'installs augeas for tests' + end + describe 'success' do + it 'validates a single argument' do + pp = <<-EOS + $one = { 'a' => 1 } + validate_hash($one) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates an multiple arguments' do + pp = <<-EOS + $one = { 'a' => 1 } + $two = { 'b' => 2 } + validate_hash($one,$two) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates a non-hash' do + { + %{validate_hash('{ "not" => "hash" }')} => "String", + %{validate_hash('string')} => "String", + %{validate_hash(["array"])} => "Array", + %{validate_hash(undef)} => "String", + }.each do |pp,type| + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/a #{type}/) + end + end + end + describe 'failure' do + it 'handles improper number of arguments' + end +end diff --git a/spec/acceptance/validate_bool_spec.rb b/spec/acceptance/validate_bool_spec.rb new file mode 100644 index 0000000..4e77da2 --- /dev/null +++ b/spec/acceptance/validate_bool_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper_acceptance' + +describe 'validate_bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'validates a single argument' do + pp = <<-EOS + $one = true + validate_bool($one) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates an multiple arguments' do + pp = <<-EOS + $one = true + $two = false + validate_bool($one,$two) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates a non-bool' do + { + %{validate_bool('true')} => "String", + %{validate_bool('false')} => "String", + %{validate_bool([true])} => "Array", + %{validate_bool(undef)} => "String", + }.each do |pp,type| + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/a #{type}/) + end + end + end + describe 'failure' do + it 'handles improper number of arguments' + end +end diff --git a/spec/acceptance/validate_cmd_spec.rb b/spec/acceptance/validate_cmd_spec.rb new file mode 100644 index 0000000..b4d6575 --- /dev/null +++ b/spec/acceptance/validate_cmd_spec.rb @@ -0,0 +1,49 @@ +require 'spec_helper_acceptance' + +describe 'validate_cmd function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'validates a true command' do + pp = <<-EOS + $one = 'foo' + if $::osfamily == 'windows' { + $two = 'echo' #shell built-in + } else { + $two = '/bin/echo' + } + validate_cmd($one,$two) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates a fail command' do + pp = <<-EOS + $one = 'foo' + if $::osfamily == 'windows' { + $two = 'C:/aoeu' + } else { + $two = '/bin/aoeu' + } + validate_cmd($one,$two) + EOS + + apply_manifest(pp, :expect_failures => true) + end + it 'validates a fail command with a custom error message' do + pp = <<-EOS + $one = 'foo' + if $::osfamily == 'windows' { + $two = 'C:/aoeu' + } else { + $two = '/bin/aoeu' + } + validate_cmd($one,$two,"aoeu is dvorak) + EOS + + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/aoeu is dvorak/) + end + end + describe 'failure' do + it 'handles improper number of arguments' + it 'handles improper argument types' + end +end diff --git a/spec/acceptance/validate_hash_spec.rb b/spec/acceptance/validate_hash_spec.rb new file mode 100644 index 0000000..d26c9e7 --- /dev/null +++ b/spec/acceptance/validate_hash_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper_acceptance' + +describe 'validate_hash function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'validates a single argument' do + pp = <<-EOS + $one = { 'a' => 1 } + validate_hash($one) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates an multiple arguments' do + pp = <<-EOS + $one = { 'a' => 1 } + $two = { 'b' => 2 } + validate_hash($one,$two) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates a non-hash' do + { + %{validate_hash('{ "not" => "hash" }')} => "String", + %{validate_hash('string')} => "String", + %{validate_hash(["array"])} => "Array", + %{validate_hash(undef)} => "String", + }.each do |pp,type| + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/a #{type}/) + end + end + end + describe 'failure' do + it 'handles improper number of arguments' + end +end diff --git a/spec/acceptance/validate_re_spec.rb b/spec/acceptance/validate_re_spec.rb new file mode 100644 index 0000000..8d7e634 --- /dev/null +++ b/spec/acceptance/validate_re_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper_acceptance' + +describe 'validate_re function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'validates a string' do + pp = <<-EOS + $one = 'one' + $two = '^one$' + validate_re($one,$two) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates an array' do + pp = <<-EOS + $one = 'one' + $two = ['^one$', '^two'] + validate_re($one,$two) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates a failed array' do + pp = <<-EOS + $one = 'one' + $two = ['^two$', '^three'] + validate_re($one,$two) + EOS + + apply_manifest(pp, :expect_failures => true) + end + it 'validates a failed array with a custom error message' do + pp = <<-EOS + $one = '3.4.3' + $two = '^2.7' + validate_re($one,$two,"The $puppetversion fact does not match 2.7") + EOS + + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/does not match/) + end + end + describe 'failure' do + it 'handles improper number of arguments' + it 'handles improper argument types' + end +end diff --git a/spec/acceptance/validate_slength_spec.rb b/spec/acceptance/validate_slength_spec.rb new file mode 100644 index 0000000..96b2a6f --- /dev/null +++ b/spec/acceptance/validate_slength_spec.rb @@ -0,0 +1,71 @@ +require 'spec_helper_acceptance' + +describe 'validate_slength function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'validates a single string max' do + pp = <<-EOS + $one = 'discombobulate' + $two = 17 + validate_slength($one,$two) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates multiple string maxes' do + pp = <<-EOS + $one = ['discombobulate', 'moo'] + $two = 17 + validate_slength($one,$two) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates min/max of strings in array' do + pp = <<-EOS + $one = ['discombobulate', 'moo'] + $two = 17 + $three = 3 + validate_slength($one,$two,$three) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates a single string max of incorrect length' do + pp = <<-EOS + $one = 'discombobulate' + $two = 1 + validate_slength($one,$two) + EOS + + apply_manifest(pp, :expect_failures => true) + end + it 'validates multiple string maxes of incorrect length' do + pp = <<-EOS + $one = ['discombobulate', 'moo'] + $two = 3 + validate_slength($one,$two) + EOS + + apply_manifest(pp, :expect_failures => true) + end + it 'validates multiple strings min/maxes of incorrect length' do + pp = <<-EOS + $one = ['discombobulate', 'moo'] + $two = 17 + $three = 10 + validate_slength($one,$two,$three) + EOS + + apply_manifest(pp, :expect_failures => true) + end + end + describe 'failure' do + it 'handles improper number of arguments' + it 'handles improper first argument type' + it 'handles non-strings in array of first argument' + it 'handles improper second argument type' + it 'handles improper third argument type' + it 'handles negative ranges' + it 'handles improper ranges' + end +end diff --git a/spec/acceptance/validate_string_spec.rb b/spec/acceptance/validate_string_spec.rb new file mode 100644 index 0000000..f8658c5 --- /dev/null +++ b/spec/acceptance/validate_string_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper_acceptance' + +describe 'validate_string function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'validates a single argument' do + pp = <<-EOS + $one = 'string' + validate_string($one) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates an multiple arguments' do + pp = <<-EOS + $one = 'string' + $two = 'also string' + validate_string($one,$two) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates a non-string' do + { + %{validate_string({ 'a' => 'hash' })} => "Hash", + %{validate_string(['array'])} => "Array", + %{validate_string(false)} => "FalseClass", + }.each do |pp,type| + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/a #{type}/) + end + end + end + describe 'failure' do + it 'handles improper number of arguments' + end +end diff --git a/spec/acceptance/values_at_spec.rb b/spec/acceptance/values_at_spec.rb new file mode 100644 index 0000000..fb661dd --- /dev/null +++ b/spec/acceptance/values_at_spec.rb @@ -0,0 +1,71 @@ +require 'spec_helper_acceptance' + +describe 'values_at function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'returns a specific value' do + pp = <<-EOS + $one = ['a','b','c','d','e'] + $two = 1 + $output = values_at($one,$two) + notice(inline_template('<%= @output.inspect %>')) + EOS + + expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["b"\]/) + end + it 'returns a specific negative index value' do + pp = <<-EOS + $one = ['a','b','c','d','e'] + $two = "-1" + $output = values_at($one,$two) + notice(inline_template('<%= @output.inspect %>')) + EOS + + expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["e"\]/) + end + it 'returns a range of values' do + pp = <<-EOS + $one = ['a','b','c','d','e'] + $two = "1-3" + $output = values_at($one,$two) + notice(inline_template('<%= @output.inspect %>')) + EOS + + expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["b", "c", "d"\]/) + end + it 'returns a negative specific value and range of values' do + pp = <<-EOS + $one = ['a','b','c','d','e'] + $two = ["1-3",0] + $output = values_at($one,$two) + notice(inline_template('<%= @output.inspect %>')) + EOS + + expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["b", "c", "d", "a"\]/) + end + end + describe 'failure' do + it 'handles improper number of arguments' do + pp = <<-EOS + $one = ['a','b','c','d','e'] + $output = values_at($one) + notice(inline_template('<%= @output.inspect %>')) + EOS + + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/Wrong number of arguments/) + end + it 'handles non-indicies arguments' do + pp = <<-EOS + $one = ['a','b','c','d','e'] + $two = [] + $output = values_at($one,$two) + notice(inline_template('<%= @output.inspect %>')) + EOS + + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/at least one positive index/) + end + + it 'detects index ranges smaller than the start range' + it 'handles index ranges larger than array' + it 'handles non-integer indicies' + end +end diff --git a/spec/acceptance/values_spec.rb b/spec/acceptance/values_spec.rb new file mode 100644 index 0000000..0c12702 --- /dev/null +++ b/spec/acceptance/values_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper_acceptance' + +describe 'values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'returns an array of values' do + pp = <<-EOS + $arg = { + 'a' => 1, + 'b' => 2, + 'c' => 3, + } + $output = values($arg) + notice(inline_template('<%= @output.sort.inspect %>')) + EOS + + expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["1", "2", "3"\]/) + end + end + describe 'failure' do + it 'handles non-hash arguments' do + pp = <<-EOS + $arg = "foo" + $output = values($arg) + notice(inline_template('<%= @output.inspect %>')) + EOS + + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/Requires hash/) + end + end +end diff --git a/spec/acceptance/zip_spec.rb b/spec/acceptance/zip_spec.rb new file mode 100644 index 0000000..a551b80 --- /dev/null +++ b/spec/acceptance/zip_spec.rb @@ -0,0 +1,73 @@ +require 'spec_helper_acceptance' +require 'puppet' + +describe 'zip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'zips two arrays of numbers together' do + pp = <<-EOS + $one = [1,2,3,4] + $two = [5,6,7,8] + $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"\]\]/) + end + it 'zips two arrays of numbers & bools together' do + pp = <<-EOS + $one = [1,2,"three",4] + $two = [true,true,false,false] + $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\]\]/) + 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: + # 1 t y true yes + # 0 f n false no + # undef undefined + pp = <<-EOS + $one = [1,2,3,4] + $two = [5,6,7,8] + $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"\]/) + end + it 'handles unmatched length' do + # XXX Is this expected behavior? + pp = <<-EOS + $one = [1,2] + $two = [5,6,7,8] + $output = zip($one,$two) + notice(inline_template('<%= @output.inspect %>')) + EOS + + expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", "5"\], \["2", "6"\]\]/) + end + end + describe 'failure' do + it 'handles improper number of arguments' do + pp = <<-EOS + $one = [1,2] + $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 + pp = <<-EOS + $one = "a string" + $two = [5,6,7,8] + $output = zip($one,$two) + notice(inline_template('<%= @output.inspect %>')) + EOS + + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/Requires array/) + end + end +end -- cgit v1.2.3 From f8f147e794ad305bb8f2dbf5e3a612f0659834ba Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Tue, 8 Apr 2014 15:04:55 -0700 Subject: Add success/fail groups --- spec/acceptance/abs_spec.rb | 36 +++++++------- spec/acceptance/any2array_spec.rb | 66 +++++++++++++------------ spec/acceptance/base64_spec.rb | 18 ++++--- spec/acceptance/bool2num_spec.rb | 40 +++++++-------- spec/acceptance/capitalize_spec.rb | 42 ++++++++-------- spec/acceptance/chomp_spec.rb | 26 +++++----- spec/acceptance/chop_spec.rb | 66 +++++++++++++------------ spec/acceptance/concat_spec.rb | 20 ++++---- spec/acceptance/count_spec.rb | 36 +++++++------- spec/acceptance/deep_merge_spec.rb | 22 +++++---- spec/acceptance/defined_with_params_spec.rb | 24 ++++----- spec/acceptance/delete_at_spec.rb | 20 ++++---- spec/acceptance/delete_spec.rb | 20 ++++---- spec/acceptance/delete_undef_values_spec.rb | 20 ++++---- spec/acceptance/num2bool_spec.rb | 75 +++++++++++++++++++++++++++++ 15 files changed, 317 insertions(+), 214 deletions(-) create mode 100644 spec/acceptance/num2bool_spec.rb (limited to 'spec/acceptance') diff --git a/spec/acceptance/abs_spec.rb b/spec/acceptance/abs_spec.rb index 0921497..eeae89b 100644 --- a/spec/acceptance/abs_spec.rb +++ b/spec/acceptance/abs_spec.rb @@ -1,27 +1,29 @@ require 'spec_helper_acceptance' describe 'abs function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do - it 'should accept a string' do - pp = <<-EOS - $input = '-34.56' - $output = abs($input) - notify { $output: } - EOS + describe 'success' do + it 'should accept a string' do + pp = <<-EOS + $input = '-34.56' + $output = abs($input) + notify { $output: } + EOS - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: 34.56/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: 34.56/) + end end - end - it 'should accept a float' do - pp = <<-EOS - $input = -34.56 - $output = abs($input) - notify { $output: } - EOS + it 'should accept a float' do + pp = <<-EOS + $input = -34.56 + $output = abs($input) + notify { $output: } + EOS - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: 34.56/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: 34.56/) + end end end end diff --git a/spec/acceptance/any2array_spec.rb b/spec/acceptance/any2array_spec.rb index 7d452ed..0127303 100644 --- a/spec/acceptance/any2array_spec.rb +++ b/spec/acceptance/any2array_spec.rb @@ -1,46 +1,48 @@ require 'spec_helper_acceptance' describe 'any2array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do - it 'should create an empty array' do - pp = <<-EOS - $input = '' - $output = any2array($input) - validate_array($output) - notify { "Output: ${output}": } - EOS + describe 'success' do + it 'should create an empty array' do + pp = <<-EOS + $input = '' + $output = any2array($input) + validate_array($output) + notify { "Output: ${output}": } + EOS - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: Output: /) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: Output: /) + end end - end - it 'should leave arrays modified' do - pp = <<-EOS - $input = ['test', 'array'] - $output = any2array($input) - validate_array($output) - notify { "Output: ${output}": } - EOS + it 'should leave arrays modified' do + pp = <<-EOS + $input = ['test', 'array'] + $output = any2array($input) + validate_array($output) + notify { "Output: ${output}": } + EOS - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: Output: testarray/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: Output: testarray/) + end end - end - it 'should turn a hash into an array' do - pp = <<-EOS - $input = {'test' => 'array'} - $output = any2array($input) + it 'should turn a hash into an array' do + pp = <<-EOS + $input = {'test' => 'array'} + $output = any2array($input) - validate_array($output) - # Check each element of the array is a plain string. - validate_string($output[0]) - validate_string($output[1]) - notify { "Output: ${output}": } - EOS + validate_array($output) + # Check each element of the array is a plain string. + validate_string($output[0]) + validate_string($output[1]) + notify { "Output: ${output}": } + EOS - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: Output: testarray/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: Output: testarray/) + end end end end diff --git a/spec/acceptance/base64_spec.rb b/spec/acceptance/base64_spec.rb index c29b3a7..30ba689 100644 --- a/spec/acceptance/base64_spec.rb +++ b/spec/acceptance/base64_spec.rb @@ -1,15 +1,17 @@ require 'spec_helper_acceptance' describe 'base64 function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do - it 'should encode then decode a string' do - pp = <<-EOS - $encodestring = base64('encode', 'thestring') - $decodestring = base64('decode', $encodestring) - notify { $decodestring: } - EOS + describe 'success' do + it 'should encode then decode a string' do + pp = <<-EOS + $encodestring = base64('encode', 'thestring') + $decodestring = base64('decode', $encodestring) + notify { $decodestring: } + EOS - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/thestring/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/thestring/) + end end end end diff --git a/spec/acceptance/bool2num_spec.rb b/spec/acceptance/bool2num_spec.rb index 5bdb452..1cbd88d 100644 --- a/spec/acceptance/bool2num_spec.rb +++ b/spec/acceptance/bool2num_spec.rb @@ -1,30 +1,32 @@ require 'spec_helper_acceptance' describe 'bool2num function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do - ['false', 'f', '0', 'n', 'no'].each do |bool| - it 'should convert a given boolean, #{bool}, to 0' do - pp = <<-EOS - $input = #{bool} - $output = bool2num($input) - notify { $output: } - EOS + describe 'success' do + ['false', 'f', '0', 'n', 'no'].each do |bool| + it 'should convert a given boolean, #{bool}, to 0' do + pp = <<-EOS + $input = #{bool} + $output = bool2num($input) + notify { $output: } + EOS - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: 0/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: 0/) + end end end - end - ['true', 't', '1', 'y', 'yes'].each do |bool| - it 'should convert a given boolean, #{bool}, to 1' do - pp = <<-EOS - $input = #{bool} - $output = bool2num($input) - notify { $output: } - EOS + ['true', 't', '1', 'y', 'yes'].each do |bool| + it 'should convert a given boolean, #{bool}, to 1' do + pp = <<-EOS + $input = #{bool} + $output = bool2num($input) + notify { $output: } + EOS - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: 1/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: 1/) + end end end end diff --git a/spec/acceptance/capitalize_spec.rb b/spec/acceptance/capitalize_spec.rb index 41e16e9..c04b401 100644 --- a/spec/acceptance/capitalize_spec.rb +++ b/spec/acceptance/capitalize_spec.rb @@ -1,30 +1,32 @@ require 'spec_helper_acceptance' describe 'capitalize function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do - it 'should capitalize the first letter of a string' do - pp = <<-EOS - $input = 'this is a string' - $output = capitalize($input) - notify { $output: } - EOS + describe 'success' do + it 'should capitalize the first letter of a string' do + pp = <<-EOS + $input = 'this is a string' + $output = capitalize($input) + notify { $output: } + EOS - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: This is a string/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: This is a string/) + end end - end - it 'should capitalize the first letter of an array of strings' do - pp = <<-EOS - $input = ['this', 'is', 'a', 'string'] - $output = capitalize($input) - notify { $output: } - EOS + it 'should capitalize the first letter of an array of strings' do + pp = <<-EOS + $input = ['this', 'is', 'a', 'string'] + $output = capitalize($input) + notify { $output: } + EOS - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: This/) - expect(r.stdout).to match(/Notice: Is/) - expect(r.stdout).to match(/Notice: A/) - expect(r.stdout).to match(/Notice: String/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: This/) + expect(r.stdout).to match(/Notice: Is/) + expect(r.stdout).to match(/Notice: A/) + expect(r.stdout).to match(/Notice: String/) + end end end end diff --git a/spec/acceptance/chomp_spec.rb b/spec/acceptance/chomp_spec.rb index 052226f..c4af9d9 100644 --- a/spec/acceptance/chomp_spec.rb +++ b/spec/acceptance/chomp_spec.rb @@ -1,18 +1,20 @@ require 'spec_helper_acceptance' describe 'chomp function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do - it 'should eat the newline' do - pp = <<-EOS - $input = "test\n" - if size($input) != 5 { - fail("Size of ${input} is not 5.") - } - $output = chomp($input) - if size($output) != 4 { - fail("Size of ${input} is not 4.") - } - EOS + describe 'success' do + it 'should eat the newline' do + pp = <<-EOS + $input = "test\n" + if size($input) != 5 { + fail("Size of ${input} is not 5.") + } + $output = chomp($input) + if size($output) != 4 { + fail("Size of ${input} is not 4.") + } + EOS - apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_failures => true) + end end end diff --git a/spec/acceptance/chop_spec.rb b/spec/acceptance/chop_spec.rb index f1183a1..8774390 100644 --- a/spec/acceptance/chop_spec.rb +++ b/spec/acceptance/chop_spec.rb @@ -1,42 +1,44 @@ require 'spec_helper_acceptance' describe 'chop function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do - it 'should eat the last character' do - pp = <<-EOS - $input = "test" - if size($input) != 4 { - fail("Size of ${input} is not 4.") - } - $output = chop($input) - if size($output) != 3 { - fail("Size of ${input} is not 3.") - } - EOS + describe 'success' do + it 'should eat the last character' do + pp = <<-EOS + $input = "test" + if size($input) != 4 { + fail("Size of ${input} is not 4.") + } + $output = chop($input) + if size($output) != 3 { + fail("Size of ${input} is not 3.") + } + EOS - apply_manifest(pp, :catch_failures => true) - end + apply_manifest(pp, :catch_failures => true) + end - it 'should eat the last two characters of \r\n' do - pp = <<-EOS - $input = "test\r\n" - if size($input) != 6 { - fail("Size of ${input} is not 6.") - } - $output = chop($input) - if size($output) != 4 { - fail("Size of ${input} is not 4.") - } - EOS + it 'should eat the last two characters of \r\n' do + pp = <<-EOS + $input = "test\r\n" + if size($input) != 6 { + fail("Size of ${input} is not 6.") + } + $output = chop($input) + if size($output) != 4 { + fail("Size of ${input} is not 4.") + } + EOS - apply_manifest(pp, :catch_failures => true) - end + apply_manifest(pp, :catch_failures => true) + end - it 'should not fail on empty strings' do - pp = <<-EOS - $input = "" - $output = chop($input) - EOS + it 'should not fail on empty strings' do + pp = <<-EOS + $input = "" + $output = chop($input) + EOS - apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_failures => true) + end end end diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index 1fe7729..24b5955 100644 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb @@ -1,15 +1,17 @@ require 'spec_helper_acceptance' describe 'concat function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do - it 'should concat one array to another' do - pp = <<-EOS - $output = concat(['1','2','3'],['4','5','6']) - validate_array($output) - if size($output) != 6 { - fail("${output} should have 6 elements.") - } - EOS + describe 'success' do + it 'should concat one array to another' do + pp = <<-EOS + $output = concat(['1','2','3'],['4','5','6']) + validate_array($output) + if size($output) != 6 { + fail("${output} should have 6 elements.") + } + EOS - apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_failures => true) + end end end diff --git a/spec/acceptance/count_spec.rb b/spec/acceptance/count_spec.rb index cc46be0..0a0f5d7 100644 --- a/spec/acceptance/count_spec.rb +++ b/spec/acceptance/count_spec.rb @@ -1,27 +1,29 @@ require 'spec_helper_acceptance' describe 'count function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do - it 'should count elements in an array' do - pp = <<-EOS - $input = [1,2,3,4] - $output = count($input) - notify { $output: } - EOS + describe 'success' do + it 'should count elements in an array' do + pp = <<-EOS + $input = [1,2,3,4] + $output = count($input) + notify { $output: } + EOS - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: 4/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: 4/) + end end - end - it 'should count elements in an array that match a second argument' do - pp = <<-EOS - $input = [1,1,1,2] - $output = count($input, 1) - notify { $output: } - EOS + it 'should count elements in an array that match a second argument' do + pp = <<-EOS + $input = [1,1,1,2] + $output = count($input, 1) + notify { $output: } + EOS - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: 3/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: 3/) + end end end end diff --git a/spec/acceptance/deep_merge_spec.rb b/spec/acceptance/deep_merge_spec.rb index c7f35be..676d23d 100644 --- a/spec/acceptance/deep_merge_spec.rb +++ b/spec/acceptance/deep_merge_spec.rb @@ -1,17 +1,19 @@ require 'spec_helper_acceptance' describe 'deep_merge function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do - it 'should deep merge two hashes' do - pp = <<-EOS - $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } } - $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } } - $merged_hash = deep_merge($hash1, $hash2) + describe 'success' do + it 'should deep merge two hashes' do + pp = <<-EOS + $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } } + $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } } + $merged_hash = deep_merge($hash1, $hash2) - if $merged_hash != { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } } { - fail("Hash was incorrectly merged.") - } - EOS + if $merged_hash != { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } } { + fail("Hash was incorrectly merged.") + } + EOS - apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_failures => true) + end end end diff --git a/spec/acceptance/defined_with_params_spec.rb b/spec/acceptance/defined_with_params_spec.rb index eb549e5..7477453 100644 --- a/spec/acceptance/defined_with_params_spec.rb +++ b/spec/acceptance/defined_with_params_spec.rb @@ -1,19 +1,21 @@ require 'spec_helper_acceptance' describe 'defined_with_params function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do - it 'should successfully notify' do - pp = <<-EOS - user { 'dan': - ensure => present, - } + describe 'success' do + it 'should successfully notify' do + pp = <<-EOS + user { 'dan': + ensure => present, + } - if defined_with_params(User[dan], {'ensure' => 'present' }) { - notify { 'User defined with ensure=>present': } - } - EOS + if defined_with_params(User[dan], {'ensure' => 'present' }) { + notify { 'User defined with ensure=>present': } + } + EOS - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: User defined with ensure=>present/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: User defined with ensure=>present/) + end end end end diff --git a/spec/acceptance/delete_at_spec.rb b/spec/acceptance/delete_at_spec.rb index 42d7a77..f2c5cfe 100644 --- a/spec/acceptance/delete_at_spec.rb +++ b/spec/acceptance/delete_at_spec.rb @@ -1,16 +1,18 @@ require 'spec_helper_acceptance' describe 'delete_at function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do - it 'should delete elements of the array' do - pp = <<-EOS - $output = delete_at(['a','b','c','b'], 1) - if $output == ['a','c','b'] { - notify { 'output correct': } - } - EOS + describe 'success' do + it 'should delete elements of the array' do + pp = <<-EOS + $output = delete_at(['a','b','c','b'], 1) + if $output == ['a','c','b'] { + notify { 'output correct': } + } + EOS - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: output correct/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end end end end diff --git a/spec/acceptance/delete_spec.rb b/spec/acceptance/delete_spec.rb index 63804bc..e54d816 100644 --- a/spec/acceptance/delete_spec.rb +++ b/spec/acceptance/delete_spec.rb @@ -1,16 +1,18 @@ require 'spec_helper_acceptance' describe 'delete function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do - it 'should delete elements of the array' do - pp = <<-EOS - $output = delete(['a','b','c','b'], 'b') - if $output == ['a','c'] { - notify { 'output correct': } - } - EOS + describe 'success' do + it 'should delete elements of the array' do + pp = <<-EOS + $output = delete(['a','b','c','b'], 'b') + if $output == ['a','c'] { + notify { 'output correct': } + } + EOS - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: output correct/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end end end end diff --git a/spec/acceptance/delete_undef_values_spec.rb b/spec/acceptance/delete_undef_values_spec.rb index 1ecdf4c..c2ac931 100644 --- a/spec/acceptance/delete_undef_values_spec.rb +++ b/spec/acceptance/delete_undef_values_spec.rb @@ -1,16 +1,18 @@ require 'spec_helper_acceptance' describe 'delete_undef_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do - it 'should delete elements of the array' do - pp = <<-EOS - $output = delete_undef_values({a=>'A', b=>'', c=>undef, d => false}) - if $output == { a => 'A', b => '', d => false } { - notify { 'output correct': } - } - EOS + describe 'success' do + it 'should delete elements of the array' do + pp = <<-EOS + $output = delete_undef_values({a=>'A', b=>'', c=>undef, d => false}) + if $output == { a => 'A', b => '', d => false } { + notify { 'output correct': } + } + EOS - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: output correct/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end end end end diff --git a/spec/acceptance/num2bool_spec.rb b/spec/acceptance/num2bool_spec.rb new file mode 100644 index 0000000..cdfbc70 --- /dev/null +++ b/spec/acceptance/num2bool_spec.rb @@ -0,0 +1,75 @@ +require 'spec_helper_acceptance' + +describe 'num2bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'bools positive numbers and numeric strings as true' do + pp = <<-EOS + $a = 1 + $b = "1" + $c = "50" + $ao = num2bool($a) + $bo = num2bool($b) + $co = num2bool($c) + notice(inline_template('a is <%= @ao.inspect %>')) + notice(inline_template('b is <%= @bo.inspect %>')) + notice(inline_template('c is <%= @co.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/a is true/) + expect(r.stdout).to match(/b is true/) + expect(r.stdout).to match(/c is true/) + end + end + it 'bools negative numbers as false' do + pp = <<-EOS + $a = 0 + $b = -0.1 + $c = ["-50","1"] + $ao = num2bool($a) + $bo = num2bool($b) + $co = num2bool($c) + notice(inline_template('a is <%= @ao.inspect %>')) + notice(inline_template('b is <%= @bo.inspect %>')) + notice(inline_template('c is <%= @co.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/a is false/) + expect(r.stdout).to match(/b is false/) + expect(r.stdout).to match(/c is false/) + end + end + end + describe 'failure' do + it 'fails on words' do + pp = <<-EOS + $a = "a" + $ao = num2bool($a) + notice(inline_template('a is <%= @ao.inspect %>')) + EOS + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/not look like a number/) + end + + it 'fails on numberwords' do + pp = <<-EOS + $b = "1b" + $bo = num2bool($b) + notice(inline_template('b is <%= @bo.inspect %>')) + EOS + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/not look like a number/) + + end + + it 'fails on non-numeric/strings' do + pending "The function will call .to_s.to_i on anything not a Numeric or + String, and results in 0. Is this intended?" + pp = <<-EOS + $c = {"c" => "-50"} + $co = num2bool($c) + notice(inline_template('c is <%= @co.inspect %>')) + EOS + expect(apply_manifest(ppc :expect_failures => true).stderr).to match(/Unable to parse/) + end + end +end -- cgit v1.2.3 From 8a269c6722594611cb981f1a97d4288e5acc9fd7 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Tue, 8 Apr 2014 16:38:33 -0700 Subject: Add build_csv --- spec/acceptance/build_csv.rb | 69 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 spec/acceptance/build_csv.rb (limited to 'spec/acceptance') diff --git a/spec/acceptance/build_csv.rb b/spec/acceptance/build_csv.rb new file mode 100644 index 0000000..556d1f8 --- /dev/null +++ b/spec/acceptance/build_csv.rb @@ -0,0 +1,69 @@ +#!/usr/bin/env ruby +# vim: set sw=2 sts=2 et tw=80 : +require 'rspec' +require 'pry' + +#XXX Super ugly hack to keep from starting beaker nodes +module Kernel + # make an alias of the original require + alias_method :original_require, :require + # rewrite require + def require name + original_require name if name != 'spec_helper_acceptance' + end +end +UNSUPPORTED_PLATFORMS = [] +def fact(*args) [] end +#XXX End hax + +# Get a list of functions for test coverage +function_list = Dir[File.join(File.dirname(__FILE__),"..","..","lib","puppet","parser","functions","*.rb")].collect do |function_rb| + File.basename(function_rb,".rb") +end + +## Configure rspec to parse tests +options = RSpec::Core::ConfigurationOptions.new(['spec/acceptance']) +configuration = RSpec::configuration +world = RSpec::world +options.parse_options +options.configure(configuration) +configuration.load_spec_files + +## Collect up tests and example groups into a hash +def get_tests(children) + children.inject({}) do |memo,c| + memo[c.description] = Hash.new + memo[c.description]["groups"] = get_tests(c.children) unless c.children.empty? + memo[c.description]["tests"] = c.examples.collect { |e| + e.description unless e.pending? + }.compact unless c.examples.empty? + memo[c.description]["pending_tests"] = c.examples.collect { |e| + e.description if e.pending? + }.compact unless c.examples.empty? + memo + end +end + +# Convert tests hash to csv format +def to_csv(function_list,tests) + function_list.collect do |function_name| + if v = tests["#{function_name} function"] + positive_tests = v["groups"]["success"] ? v["groups"]["success"]["tests"].length : 0 + negative_tests = v["groups"]["failure"] ? v["groups"]["failure"]["tests"].length : 0 + pending_tests = + (v["groups"]["failure"] ? v["groups"]["success"]["pending_tests"].length : 0) + + (v["groups"]["failure"] ? v["groups"]["failure"]["pending_tests"].length : 0) + else + positive_tests = 0 + negative_tests = 0 + pending_tests = 0 + end + sprintf("%-25s, %-9d, %-9d, %-9d", function_name,positive_tests,negative_tests,pending_tests) + end.compact +end + +tests = get_tests(world.example_groups) +csv = to_csv(function_list,tests) +percentage_tested = "#{tests.count*100/function_list.count}%" +printf("%-25s, %-9s, %-9s, %-9s\n","#{percentage_tested} have tests.","Positive","Negative","Pending") +puts csv -- cgit v1.2.3 From 90222959b14a10c3519c88f74e244b13b07fd78b Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Wed, 9 Apr 2014 14:35:34 -0700 Subject: Adding more tests --- spec/acceptance/parsejson_spec.rb | 33 ++++++++++++++++++++++++ spec/acceptance/parseyaml_spec.rb | 34 ++++++++++++++++++++++++ spec/acceptance/pick_spec.rb | 43 +++++++++++++++++++++++++++++++ spec/acceptance/prefix_spec.rb | 41 +++++++++++++++++++++++++++++ spec/acceptance/reject_spec.rb | 41 +++++++++++++++++++++++++++++ spec/acceptance/size_spec.rb | 54 +++++++++++++++++++++++++++++++++++++++ spec/acceptance/sort_spec.rb | 33 ++++++++++++++++++++++++ 7 files changed, 279 insertions(+) create mode 100644 spec/acceptance/parsejson_spec.rb create mode 100644 spec/acceptance/parseyaml_spec.rb create mode 100644 spec/acceptance/pick_spec.rb create mode 100644 spec/acceptance/prefix_spec.rb create mode 100644 spec/acceptance/reject_spec.rb create mode 100644 spec/acceptance/size_spec.rb create mode 100644 spec/acceptance/sort_spec.rb (limited to 'spec/acceptance') diff --git a/spec/acceptance/parsejson_spec.rb b/spec/acceptance/parsejson_spec.rb new file mode 100644 index 0000000..b2ae030 --- /dev/null +++ b/spec/acceptance/parsejson_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper_acceptance' + +describe 'parsejson function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'parses valid json' do + pp = <<-EOS + $a = '{"hunter": "washere", "tests": "passing"}' + $ao = parsejson($a) + $tests = $ao['tests'] + notice(inline_template('tests are <%= @tests.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/tests are "passing"/) + end + end + end + describe 'failure' do + it 'raises error on incorrect json' do + pp = <<-EOS + $a = '{"hunter": "washere", "tests": "passing",}' + $ao = parsejson($a) + notice(inline_template('a is <%= @ao.inspect %>')) + EOS + + apply_manifest(pp, :expect_failures => true) do |r| + expect(r.stderr).to match(/expected next name/) + end + end + + it 'raises error on incorrect number of arguments' + end +end diff --git a/spec/acceptance/parseyaml_spec.rb b/spec/acceptance/parseyaml_spec.rb new file mode 100644 index 0000000..01e0988 --- /dev/null +++ b/spec/acceptance/parseyaml_spec.rb @@ -0,0 +1,34 @@ +require 'spec_helper_acceptance' + +describe 'parseyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'parses valid yaml' do + pp = <<-EOS + $a = "---\nhunter: washere\ntests: passing\n" + $o = parseyaml($a) + $tests = $o['tests'] + notice(inline_template('tests are <%= @tests.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/tests are "passing"/) + end + end + end + describe 'failure' do + it 'raises error on incorrect yaml' do + pp = <<-EOS + $a = "---\nhunter: washere\ntests: passing\n:" + $o = parseyaml($a) + $tests = $o['tests'] + notice(inline_template('tests are <%= @tests.inspect %>')) + EOS + + apply_manifest(pp, :expect_failures => true) do |r| + expect(r.stderr).to match(/syntax error/) + end + end + + it 'raises error on incorrect number of arguments' + end +end diff --git a/spec/acceptance/pick_spec.rb b/spec/acceptance/pick_spec.rb new file mode 100644 index 0000000..8a768a9 --- /dev/null +++ b/spec/acceptance/pick_spec.rb @@ -0,0 +1,43 @@ +require 'spec_helper_acceptance' + +describe 'pick function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'picks a default value' do + pp = <<-EOS + $a = undef + $o = pick($a, 'default') + notice(inline_template('picked is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/picked is "default"/) + end + end + it 'picks the first set value' do + pp = <<-EOS + $a = "something" + $b = "long" + $o = pick($a, $b, 'default') + notice(inline_template('picked is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/picked is "something"/) + end + end + end + describe 'failure' do + it 'raises error with all undef values' do + pp = <<-EOS + $a = undef + $b = undef + $o = pick($a, $b) + notice(inline_template('picked is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :expect_failures => true) do |r| + expect(r.stderr).to match(/must receive at least one non empty value/) + end + end + end +end diff --git a/spec/acceptance/prefix_spec.rb b/spec/acceptance/prefix_spec.rb new file mode 100644 index 0000000..d7b80a8 --- /dev/null +++ b/spec/acceptance/prefix_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper_acceptance' + +describe 'prefix function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'prefixes array of values' do + pp = <<-EOS + $o = prefix(['a','b','c'],'p') + notice(inline_template('prefix is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/prefix is \["pa", "pb", "pc"\]/) + end + end + it 'prefixs with empty array' do + pp = <<-EOS + $o = prefix([],'p') + notice(inline_template('prefix is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/prefix is \[\]/) + end + end + it 'prefixs array of values with undef' do + pp = <<-EOS + $o = prefix(['a','b','c'], undef) + notice(inline_template('prefix is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/prefix is \["a", "b", "c"\]/) + end + end + end + describe 'failure' do + it 'fails with no arguments' + it 'fails when first argument is not array' + it 'fails when second argument is not string' + end +end diff --git a/spec/acceptance/reject_spec.rb b/spec/acceptance/reject_spec.rb new file mode 100644 index 0000000..5333f36 --- /dev/null +++ b/spec/acceptance/reject_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper_acceptance' + +describe 'reject function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'rejects array of values' do + pp = <<-EOS + $o = reject(['aaa','bbb','ccc','aaaddd'], 'aaa') + notice(inline_template('reject is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/reject is \["bbb", "ccc"\]/) + end + end + it 'rejects with empty array' do + pp = <<-EOS + $o = reject([],'aaa') + notice(inline_template('reject is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/reject is \[\]/) + end + end + it 'rejects array of values with undef' do + pp = <<-EOS + $o = reject(['aaa','bbb','ccc','aaaddd'], undef) + notice(inline_template('reject is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/reject is \["aaa", "bbb", "ccc", "aaaddd"\]/) + end + end + end + describe 'failure' do + it 'fails with no arguments' + it 'fails when first argument is not array' + it 'fails when second argument is not string' + end +end diff --git a/spec/acceptance/size_spec.rb b/spec/acceptance/size_spec.rb new file mode 100644 index 0000000..2aacf0b --- /dev/null +++ b/spec/acceptance/size_spec.rb @@ -0,0 +1,54 @@ +require 'spec_helper_acceptance' + +describe 'size function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'single string size' do + pp = <<-EOS + $a = 'discombobulate' + $o =size($a) + notice(inline_template('size is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/size is 14/) + end + end + it 'with empty string' do + pp = <<-EOS + $a = '' + $o =size($a) + notice(inline_template('size is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/size is 0/) + end + end + it 'with undef' do + pp = <<-EOS + $a = undef + $o =size($a) + notice(inline_template('size is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/size is 0/) + end + end + it 'strings in array' do + pp = <<-EOS + $a = ['discombobulate', 'moo'] + $o =size($a) + notice(inline_template('size is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/size is 2/) + end + end + end + describe 'failure' do + it 'handles no arguments' + it 'handles non strings or arrays' + end +end diff --git a/spec/acceptance/sort_spec.rb b/spec/acceptance/sort_spec.rb new file mode 100644 index 0000000..1868a03 --- /dev/null +++ b/spec/acceptance/sort_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper_acceptance' + +describe 'sort function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'sorts arrays' do + pp = <<-EOS + $a = ["the","public","art","galleries"] + # Anagram: Large picture halls, I bet + $o =sort($a) + notice(inline_template('sort is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/sort is \["art", "galleries", "public", "the"\]/) + end + end + it 'sorts strings' do + pp = <<-EOS + $a = "blowzy night-frumps vex'd jack q" + $o =sort($a) + notice(inline_template('sort is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/sort is " '-abcdefghijklmnopqrstuvwxyz"/) + end + end + end + describe 'failure' do + it 'handles no arguments' + it 'handles non strings or arrays' + end +end -- cgit v1.2.3 From 80590a9bfe2a8c0d288125d17cfb9f01c8563a7a Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 28 Apr 2014 17:28:22 -0700 Subject: Add more specs --- spec/acceptance/pick_default_spec.rb | 53 +++++++++++++++++ spec/acceptance/range_spec.rb | 35 ++++++++++++ spec/acceptance/reject_spec.rb | 2 +- spec/acceptance/reverse_spec.rb | 22 ++++++++ spec/acceptance/rstrip_spec.rb | 33 +++++++++++ spec/acceptance/shuffle_spec.rb | 33 +++++++++++ spec/acceptance/size_spec.rb | 8 +-- spec/acceptance/sort_spec.rb | 4 +- spec/acceptance/squeeze_spec.rb | 46 +++++++++++++++ spec/acceptance/str2bool_spec.rb | 30 ++++++++++ spec/acceptance/str2saltedsha512_spec.rb | 21 +++++++ spec/acceptance/strftime_spec.rb | 21 +++++++ spec/acceptance/strip_spec.rb | 33 +++++++++++ spec/acceptance/suffix_spec.rb | 41 ++++++++++++++ spec/acceptance/swapcase_spec.rb | 21 +++++++ spec/acceptance/time_spec.rb | 35 ++++++++++++ spec/acceptance/to_bytes_spec.rb | 26 +++++++++ spec/acceptance/type_spec.rb | 36 ++++++++++++ spec/acceptance/union_spec.rb | 23 ++++++++ spec/acceptance/unique_spec.rb | 32 +++++++++++ spec/acceptance/upcase_spec.rb | 32 +++++++++++ spec/acceptance/uriescape_spec.rb | 22 ++++++++ spec/acceptance/validate_absolute_path_spec.rb | 30 ++++++++++ spec/acceptance/validate_augeas_spec.rb | 78 +++++++++++++------------- spec/acceptance/validate_ipv4_address_spec.rb | 30 ++++++++++ spec/acceptance/validate_ipv6_address_spec.rb | 30 ++++++++++ spec/acceptance/values_at_spec.rb | 3 +- 27 files changed, 733 insertions(+), 47 deletions(-) create mode 100644 spec/acceptance/pick_default_spec.rb create mode 100644 spec/acceptance/range_spec.rb create mode 100644 spec/acceptance/reverse_spec.rb create mode 100644 spec/acceptance/rstrip_spec.rb create mode 100644 spec/acceptance/shuffle_spec.rb create mode 100644 spec/acceptance/squeeze_spec.rb create mode 100644 spec/acceptance/str2bool_spec.rb create mode 100644 spec/acceptance/str2saltedsha512_spec.rb create mode 100644 spec/acceptance/strftime_spec.rb create mode 100644 spec/acceptance/strip_spec.rb create mode 100644 spec/acceptance/suffix_spec.rb create mode 100644 spec/acceptance/swapcase_spec.rb create mode 100644 spec/acceptance/time_spec.rb create mode 100644 spec/acceptance/to_bytes_spec.rb create mode 100644 spec/acceptance/type_spec.rb create mode 100644 spec/acceptance/union_spec.rb create mode 100644 spec/acceptance/unique_spec.rb create mode 100644 spec/acceptance/upcase_spec.rb create mode 100644 spec/acceptance/uriescape_spec.rb create mode 100644 spec/acceptance/validate_absolute_path_spec.rb create mode 100644 spec/acceptance/validate_ipv4_address_spec.rb create mode 100644 spec/acceptance/validate_ipv6_address_spec.rb (limited to 'spec/acceptance') diff --git a/spec/acceptance/pick_default_spec.rb b/spec/acceptance/pick_default_spec.rb new file mode 100644 index 0000000..e94a999 --- /dev/null +++ b/spec/acceptance/pick_default_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper_acceptance' + +describe 'pick_default function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'pick_defaults a default value' do + pp = <<-EOS + $a = undef + $o = pick_default($a, 'default') + notice(inline_template('picked is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/picked is "default"/) + end + end + it 'pick_defaults with no value' do + pp = <<-EOS + $a = undef + $b = undef + $o = pick_default($a,$b) + notice(inline_template('picked is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/picked is ""/) + end + end + it 'pick_defaults the first set value' do + pp = <<-EOS + $a = "something" + $b = "long" + $o = pick_default($a, $b, 'default') + notice(inline_template('picked is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/picked is "something"/) + end + end + end + describe 'failure' do + it 'raises error with no values' do + pp = <<-EOS + $o = pick_default() + notice(inline_template('picked is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :expect_failures => true) do |r| + expect(r.stderr).to match(/Must receive at least one argument/) + end + end + end +end diff --git a/spec/acceptance/range_spec.rb b/spec/acceptance/range_spec.rb new file mode 100644 index 0000000..0387e4e --- /dev/null +++ b/spec/acceptance/range_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper_acceptance' + +describe 'range function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'ranges letters' do + pp = <<-EOS + $o = range('a','d') + notice(inline_template('range is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/range is \["a", "b", "c", "d"\]/) + end + end + it 'ranges letters with a step' do + pp = <<-EOS + $o = range('a','d', '2') + notice(inline_template('range is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/range is \["a", "c"\]/) + end + end + it 'ranges letters with a negative step' + it 'ranges numbers' + it 'ranges numbers with a step' + it 'ranges numbers with a negative step' + it 'ranges numeric strings' + it 'ranges zero padded numbers' + end + describe 'failure' do + it 'fails with no arguments' + end +end diff --git a/spec/acceptance/reject_spec.rb b/spec/acceptance/reject_spec.rb index 5333f36..52b8755 100644 --- a/spec/acceptance/reject_spec.rb +++ b/spec/acceptance/reject_spec.rb @@ -29,7 +29,7 @@ describe 'reject function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('oper EOS apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/reject is \["aaa", "bbb", "ccc", "aaaddd"\]/) + expect(r.stdout).to match(/reject is \[\]/) end end end diff --git a/spec/acceptance/reverse_spec.rb b/spec/acceptance/reverse_spec.rb new file mode 100644 index 0000000..29bdc25 --- /dev/null +++ b/spec/acceptance/reverse_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper_acceptance' + +describe 'reverse function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'reverses strings' do + pp = <<-EOS + $a = "the public art galleries" + # Anagram: Large picture halls, I bet + $o = reverse($a) + notice(inline_template('reverse is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/reverse is "seirellag tra cilbup eht"/) + end + end + end + describe 'failure' do + it 'handles no arguments' + it 'handles non strings or arrays' + end +end diff --git a/spec/acceptance/rstrip_spec.rb b/spec/acceptance/rstrip_spec.rb new file mode 100644 index 0000000..11ed60a --- /dev/null +++ b/spec/acceptance/rstrip_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper_acceptance' + +describe 'rstrip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'rstrips arrays' do + pp = <<-EOS + $a = [" the "," public "," art","galleries "] + # Anagram: Large picture halls, I bet + $o = rstrip($a) + notice(inline_template('rstrip is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/rstrip is \[" the", " public", " art", "galleries"\]/) + end + end + it 'rstrips strings' do + pp = <<-EOS + $a = " blowzy night-frumps vex'd jack q " + $o = rstrip($a) + notice(inline_template('rstrip is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/rstrip 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/shuffle_spec.rb b/spec/acceptance/shuffle_spec.rb new file mode 100644 index 0000000..e22171f --- /dev/null +++ b/spec/acceptance/shuffle_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper_acceptance' + +describe 'shuffle function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'shuffles arrays' do + pp = <<-EOS + $a = ["the","public","art","galleries"] + # Anagram: Large picture halls, I bet + $o = shuffle($a) + notice(inline_template('shuffle is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to_not match(/shuffle is \["the", "public", "art", "galleries"\]/) + end + end + it 'shuffles strings' do + pp = <<-EOS + $a = "blowzy night-frumps vex'd jack q" + $o = shuffle($a) + notice(inline_template('shuffle is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to_not match(/shuffle 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/size_spec.rb b/spec/acceptance/size_spec.rb index 2aacf0b..d79140e 100644 --- a/spec/acceptance/size_spec.rb +++ b/spec/acceptance/size_spec.rb @@ -5,7 +5,7 @@ describe 'size function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operat it 'single string size' do pp = <<-EOS $a = 'discombobulate' - $o =size($a) + $o = size($a) notice(inline_template('size is <%= @o.inspect %>')) EOS @@ -16,7 +16,7 @@ describe 'size function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operat it 'with empty string' do pp = <<-EOS $a = '' - $o =size($a) + $o = size($a) notice(inline_template('size is <%= @o.inspect %>')) EOS @@ -27,7 +27,7 @@ describe 'size function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operat it 'with undef' do pp = <<-EOS $a = undef - $o =size($a) + $o = size($a) notice(inline_template('size is <%= @o.inspect %>')) EOS @@ -38,7 +38,7 @@ describe 'size function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operat it 'strings in array' do pp = <<-EOS $a = ['discombobulate', 'moo'] - $o =size($a) + $o = size($a) notice(inline_template('size is <%= @o.inspect %>')) EOS diff --git a/spec/acceptance/sort_spec.rb b/spec/acceptance/sort_spec.rb index 1868a03..ae7c9db 100644 --- a/spec/acceptance/sort_spec.rb +++ b/spec/acceptance/sort_spec.rb @@ -6,7 +6,7 @@ describe 'sort function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operat pp = <<-EOS $a = ["the","public","art","galleries"] # Anagram: Large picture halls, I bet - $o =sort($a) + $o = sort($a) notice(inline_template('sort is <%= @o.inspect %>')) EOS @@ -17,7 +17,7 @@ describe 'sort function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operat it 'sorts strings' do pp = <<-EOS $a = "blowzy night-frumps vex'd jack q" - $o =sort($a) + $o = sort($a) notice(inline_template('sort is <%= @o.inspect %>')) EOS diff --git a/spec/acceptance/squeeze_spec.rb b/spec/acceptance/squeeze_spec.rb new file mode 100644 index 0000000..82e3233 --- /dev/null +++ b/spec/acceptance/squeeze_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper_acceptance' + +describe 'squeeze function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'squeezes arrays' do + pp = <<-EOS + # Real words! + $a = ["wallless", "laparohysterosalpingooophorectomy", "brrr", "goddessship"] + $o = squeeze($a) + notice(inline_template('squeeze is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/squeeze is \["wales", "laparohysterosalpingophorectomy", "br", "godeship"\]/) + end + end + it 'squeezez arrays with an argument' + it 'squeezes strings' do + pp = <<-EOS + $a = "wallless laparohysterosalpingooophorectomy brrr goddessship" + $o = squeeze($a) + notice(inline_template('squeeze is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/squeeze is "wales laparohysterosalpingophorectomy br godeship"/) + end + end + + it 'squeezes strings with an argument' do + pp = <<-EOS + $a = "countessship duchessship governessship hostessship" + $o = squeeze($a, 's') + notice(inline_template('squeeze is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/squeeze is "counteship ducheship governeship hosteship"/) + end + end + end + describe 'failure' do + it 'handles no arguments' + it 'handles non strings or arrays' + end +end diff --git a/spec/acceptance/str2bool_spec.rb b/spec/acceptance/str2bool_spec.rb new file mode 100644 index 0000000..a3ba5fe --- /dev/null +++ b/spec/acceptance/str2bool_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper_acceptance' + +describe 'str2bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'works with "y"' do + pp = <<-EOS + $o = str2bool('y') + notice(inline_template('str2bool is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/str2bool is true/) + end + end + it 'works with "Y"' + it 'works with "yes"' + it 'works with "1"' + it 'works with "true"' + it 'works with "n"' + it 'works with "N"' + it 'works with "no"' + it 'works with "0"' + it 'works with "false"' + it 'works with undef' + end + describe 'failure' do + it 'handles no arguments' + it 'handles non arrays or strings' + end +end diff --git a/spec/acceptance/str2saltedsha512_spec.rb b/spec/acceptance/str2saltedsha512_spec.rb new file mode 100644 index 0000000..d353e22 --- /dev/null +++ b/spec/acceptance/str2saltedsha512_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper_acceptance' + +describe 'str2saltedsha512 function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'works with "y"' do + pp = <<-EOS + $o = str2saltedsha512('password') + notice(inline_template('str2saltedsha512 is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/str2saltedsha512 is "[a-f0-9]{136}"/) + end + end + end + describe 'failure' do + it 'handles no arguments' + it 'handles more than one argument' + it 'handles non strings' + end +end diff --git a/spec/acceptance/strftime_spec.rb b/spec/acceptance/strftime_spec.rb new file mode 100644 index 0000000..73a01c0 --- /dev/null +++ b/spec/acceptance/strftime_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper_acceptance' + +describe 'strftime function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'gives the Century' do + pp = <<-EOS + $o = strftime('%C') + notice(inline_template('strftime is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/strftime is "20"/) + end + end + it 'takes a timezone argument' + end + describe 'failure' do + it 'handles no arguments' + it 'handles invalid format strings' + end +end diff --git a/spec/acceptance/strip_spec.rb b/spec/acceptance/strip_spec.rb new file mode 100644 index 0000000..fe0c7e9 --- /dev/null +++ b/spec/acceptance/strip_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper_acceptance' + +describe 'strip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'strips arrays' do + pp = <<-EOS + $a = [" the "," public "," art","galleries "] + # Anagram: Large picture halls, I bet + $o = strip($a) + notice(inline_template('strip is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/strip is \["the", "public", "art", "galleries"\]/) + end + end + it 'strips strings' do + pp = <<-EOS + $a = " blowzy night-frumps vex'd jack q " + $o = strip($a) + notice(inline_template('strip is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/strip 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/suffix_spec.rb b/spec/acceptance/suffix_spec.rb new file mode 100644 index 0000000..493bc2b --- /dev/null +++ b/spec/acceptance/suffix_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper_acceptance' + +describe 'suffix function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'suffixes array of values' do + pp = <<-EOS + $o = suffix(['a','b','c'],'p') + notice(inline_template('suffix is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/suffix is \["ap", "bp", "cp"\]/) + end + end + it 'suffixs with empty array' do + pp = <<-EOS + $o = suffix([],'p') + notice(inline_template('suffix is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/suffix is \[\]/) + end + end + it 'suffixs array of values with undef' do + pp = <<-EOS + $o = suffix(['a','b','c'], undef) + notice(inline_template('suffix is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/suffix is \["a", "b", "c"\]/) + end + end + end + describe 'failure' do + it 'fails with no arguments' + it 'fails when first argument is not array' + it 'fails when second argument is not string' + end +end diff --git a/spec/acceptance/swapcase_spec.rb b/spec/acceptance/swapcase_spec.rb new file mode 100644 index 0000000..d4ae0dd --- /dev/null +++ b/spec/acceptance/swapcase_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper_acceptance' + +describe 'swapcase function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'works with strings' do + pp = <<-EOS + $o = swapcase('aBcD') + notice(inline_template('swapcase is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/swapcase is "AbCd"/) + end + end + it 'works with arrays' + end + describe 'failure' do + it 'handles no arguments' + it 'handles non arrays or strings' + end +end diff --git a/spec/acceptance/time_spec.rb b/spec/acceptance/time_spec.rb new file mode 100644 index 0000000..2a5e52a --- /dev/null +++ b/spec/acceptance/time_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper_acceptance' + +describe 'time function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'gives the time' do + pp = <<-EOS + $o = time() + notice(inline_template('time is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + m = r.stdout.match(/time is (\d+)\D/) + + # When I wrote this test + expect(Integer(m[1])).to be > 1398894170 + end + end + it 'takes a timezone argument' do + pp = <<-EOS + $o = time('UTC') + notice(inline_template('time is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + m = r.stdout.match(/time is (\d+)\D/) + + expect(Integer(m[1])).to be > 1398894170 + end + end + end + describe 'failure' do + it 'handles more arguments' + it 'handles invalid timezones' + end +end diff --git a/spec/acceptance/to_bytes_spec.rb b/spec/acceptance/to_bytes_spec.rb new file mode 100644 index 0000000..34f3647 --- /dev/null +++ b/spec/acceptance/to_bytes_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper_acceptance' + +describe 'to_bytes function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'converts kB to B' do + pp = <<-EOS + $o = to_bytes('4 kB') + notice(inline_template('to_bytes is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + m = r.stdout.match(/to_bytes is (\d+)\D/) + expect(m[1]).to eq("4096") + end + end + it 'works without the B in unit' + it 'works without a space before unit' + it 'works without a unit' + it 'converts fractions' + end + describe 'failure' do + it 'handles no arguments' + it 'handles non integer arguments' + it 'handles unknown units like uB' + end +end diff --git a/spec/acceptance/type_spec.rb b/spec/acceptance/type_spec.rb new file mode 100644 index 0000000..dc72f74 --- /dev/null +++ b/spec/acceptance/type_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper_acceptance' + +describe 'type function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) 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 %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/type is "array"/) + 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 %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/type is "string"/) + end + end + it 'types hashes' + it 'types integers' + it 'types floats' + it 'types booleans' + end + describe 'failure' do + it 'handles no arguments' + end +end diff --git a/spec/acceptance/union_spec.rb b/spec/acceptance/union_spec.rb new file mode 100644 index 0000000..f413d9a --- /dev/null +++ b/spec/acceptance/union_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper_acceptance' + +describe 'union function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'unions arrays' do + pp = <<-EOS + $a = ["the","public"] + $b = ["art","galleries"] + # Anagram: Large picture halls, I bet + $o = union($a,$b) + notice(inline_template('union is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/union is \["the", "public", "art", "galleries"\]/) + end + end + end + describe 'failure' do + it 'handles no arguments' + it 'handles non arrays' + end +end diff --git a/spec/acceptance/unique_spec.rb b/spec/acceptance/unique_spec.rb new file mode 100644 index 0000000..ea63cb4 --- /dev/null +++ b/spec/acceptance/unique_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper_acceptance' + +describe 'unique function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'uniques arrays' do + pp = <<-EOS + $a = ["wallless", "wallless", "brrr", "goddessship"] + $o = unique($a) + notice(inline_template('unique is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/unique is \["wallless", "brrr", "goddessship"\]/) + end + end + it 'uniques strings' do + pp = <<-EOS + $a = "wallless laparohysterosalpingooophorectomy brrr goddessship" + $o = unique($a) + notice(inline_template('unique is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/unique is "wales prohytingcmbd"/) + end + end + end + describe 'failure' do + it 'handles no arguments' + it 'handles non strings or arrays' + end +end diff --git a/spec/acceptance/upcase_spec.rb b/spec/acceptance/upcase_spec.rb new file mode 100644 index 0000000..50e6302 --- /dev/null +++ b/spec/acceptance/upcase_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper_acceptance' + +describe 'upcase function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'upcases arrays' do + pp = <<-EOS + $a = ["wallless", "laparohysterosalpingooophorectomy", "brrr", "goddessship"] + $o = upcase($a) + notice(inline_template('upcase is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/upcase is \["WALLLESS", "LAPAROHYSTEROSALPINGOOOPHORECTOMY", "BRRR", "GODDESSSHIP"\]/) + end + end + it 'upcases strings' do + pp = <<-EOS + $a = "wallless laparohysterosalpingooophorectomy brrr goddessship" + $o = upcase($a) + notice(inline_template('upcase is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/upcase is "WALLLESS LAPAROHYSTEROSALPINGOOOPHORECTOMY BRRR GODDESSSHIP"/) + end + end + end + describe 'failure' do + it 'handles no arguments' + it 'handles non strings or arrays' + end +end diff --git a/spec/acceptance/uriescape_spec.rb b/spec/acceptance/uriescape_spec.rb new file mode 100644 index 0000000..0b8a549 --- /dev/null +++ b/spec/acceptance/uriescape_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper_acceptance' + +describe 'uriescape function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'uriescape strings' do + pp = <<-EOS + $a = ":/?#[]@!$&'()*+,;= \\\"{}" + $o = uriescape($a) + notice(inline_template('uriescape is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/uriescape is ":\/\?%23\[\]@!\$&'\(\)\*\+,;=%20%22%7B%7D"/) + end + end + it 'does nothing if a string is already safe' + end + describe 'failure' do + it 'handles no arguments' + it 'handles non strings or arrays' + end +end diff --git a/spec/acceptance/validate_absolute_path_spec.rb b/spec/acceptance/validate_absolute_path_spec.rb new file mode 100644 index 0000000..35ee974 --- /dev/null +++ b/spec/acceptance/validate_absolute_path_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper_acceptance' + +describe 'validate_absolute_path function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + %w{ + C:/ + C:\\\\ + C:\\\\WINDOWS\\\\System32 + C:/windows/system32 + X:/foo/bar + X:\\\\foo\\\\bar + /var/tmp + /var/lib/puppet + /var/opt/../lib/puppet + }.each do |path| + it "validates a single argument #{path}" do + pp = <<-EOS + $one = '#{path}' + validate_absolute_path($one) + EOS + + apply_manifest(pp, :catch_failures => true) + end + end + end + describe 'failure' do + it 'handles improper number of arguments' + it 'handles relative paths' + end +end diff --git a/spec/acceptance/validate_augeas_spec.rb b/spec/acceptance/validate_augeas_spec.rb index 8b904f5..2175ada 100644 --- a/spec/acceptance/validate_augeas_spec.rb +++ b/spec/acceptance/validate_augeas_spec.rb @@ -1,39 +1,39 @@ -require 'spec_helper_acceptance' - -describe 'validate_augeas function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do - describe 'prep' do - it 'installs augeas for tests' - end - describe 'success' do - it 'validates a single argument' do - pp = <<-EOS - $one = { 'a' => 1 } - validate_hash($one) - EOS - - apply_manifest(pp, :catch_failures => true) - end - it 'validates an multiple arguments' do - pp = <<-EOS - $one = { 'a' => 1 } - $two = { 'b' => 2 } - validate_hash($one,$two) - EOS - - apply_manifest(pp, :catch_failures => true) - end - it 'validates a non-hash' do - { - %{validate_hash('{ "not" => "hash" }')} => "String", - %{validate_hash('string')} => "String", - %{validate_hash(["array"])} => "Array", - %{validate_hash(undef)} => "String", - }.each do |pp,type| - expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/a #{type}/) - end - end - end - describe 'failure' do - it 'handles improper number of arguments' - end -end +#require 'spec_helper_acceptance' +# +#describe 'validate_augeas function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do +# describe 'prep' do +# it 'installs augeas for tests' +# end +# describe 'success' do +# it 'validates a single argument' do +# pp = <<-EOS +# $one = { 'a' => 1 } +# validate_hash($one) +# EOS +# +# apply_manifest(pp, :catch_failures => true) +# end +# it 'validates an multiple arguments' do +# pp = <<-EOS +# $one = { 'a' => 1 } +# $two = { 'b' => 2 } +# validate_hash($one,$two) +# EOS +# +# apply_manifest(pp, :catch_failures => true) +# end +# it 'validates a non-hash' do +# { +# %{validate_hash('{ "not" => "hash" }')} => "String", +# %{validate_hash('string')} => "String", +# %{validate_hash(["array"])} => "Array", +# %{validate_hash(undef)} => "String", +# }.each do |pp,type| +# expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/a #{type}/) +# end +# end +# end +# describe 'failure' do +# it 'handles improper number of arguments' +# end +#end diff --git a/spec/acceptance/validate_ipv4_address_spec.rb b/spec/acceptance/validate_ipv4_address_spec.rb new file mode 100644 index 0000000..b98b81c --- /dev/null +++ b/spec/acceptance/validate_ipv4_address_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper_acceptance' + +describe 'validate_ipv4_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'validates a single argument' do + pp = <<-EOS + $one = '1.2.3.4' + validate_ipv4_address($one) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates an multiple arguments' do + pp = <<-EOS + $one = '1.2.3.4' + $two = '5.6.7.8' + validate_ipv4_address($one,$two) + EOS + + apply_manifest(pp, :catch_failures => true) + end + end + describe 'failure' do + it 'handles improper number of arguments' + it 'handles ipv6 addresses' + it 'handles non-ipv4 strings' + it 'handles numbers' + it 'handles no arguments' + end +end diff --git a/spec/acceptance/validate_ipv6_address_spec.rb b/spec/acceptance/validate_ipv6_address_spec.rb new file mode 100644 index 0000000..3e73a82 --- /dev/null +++ b/spec/acceptance/validate_ipv6_address_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper_acceptance' + +describe 'validate_ipv6_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'validates a single argument' do + pp = <<-EOS + $one = '3ffe:0505:0002::' + validate_ipv6_address($one) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates an multiple arguments' do + pp = <<-EOS + $one = '3ffe:0505:0002::' + $two = '3ffe:0505:0001::' + validate_ipv6_address($one,$two) + EOS + + apply_manifest(pp, :catch_failures => true) + end + end + describe 'failure' do + it 'handles improper number of arguments' + it 'handles ipv6 addresses' + it 'handles non-ipv6 strings' + it 'handles numbers' + it 'handles no arguments' + end +end diff --git a/spec/acceptance/values_at_spec.rb b/spec/acceptance/values_at_spec.rb index fb661dd..f341e3d 100644 --- a/spec/acceptance/values_at_spec.rb +++ b/spec/acceptance/values_at_spec.rb @@ -13,9 +13,10 @@ describe 'values_at function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('o expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["b"\]/) end it 'returns a specific negative index value' do + pending("negative numbers don't work") pp = <<-EOS $one = ['a','b','c','d','e'] - $two = "-1" + $two = -1 $output = values_at($one,$two) notice(inline_template('<%= @output.inspect %>')) EOS -- cgit v1.2.3 From af49ef4ca2e4c2219c1c547bdc7f368d3eb777eb Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Fri, 2 May 2014 12:56:22 -0700 Subject: Fix the validate_augeas beaker tests --- spec/acceptance/validate_augeas_spec.rb | 101 ++++++++++++++++++++------------ 1 file changed, 62 insertions(+), 39 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/validate_augeas_spec.rb b/spec/acceptance/validate_augeas_spec.rb index 2175ada..98ee6d1 100644 --- a/spec/acceptance/validate_augeas_spec.rb +++ b/spec/acceptance/validate_augeas_spec.rb @@ -1,39 +1,62 @@ -#require 'spec_helper_acceptance' -# -#describe 'validate_augeas function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do -# describe 'prep' do -# it 'installs augeas for tests' -# end -# describe 'success' do -# it 'validates a single argument' do -# pp = <<-EOS -# $one = { 'a' => 1 } -# validate_hash($one) -# EOS -# -# apply_manifest(pp, :catch_failures => true) -# end -# it 'validates an multiple arguments' do -# pp = <<-EOS -# $one = { 'a' => 1 } -# $two = { 'b' => 2 } -# validate_hash($one,$two) -# EOS -# -# apply_manifest(pp, :catch_failures => true) -# end -# it 'validates a non-hash' do -# { -# %{validate_hash('{ "not" => "hash" }')} => "String", -# %{validate_hash('string')} => "String", -# %{validate_hash(["array"])} => "Array", -# %{validate_hash(undef)} => "String", -# }.each do |pp,type| -# expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/a #{type}/) -# end -# end -# end -# describe 'failure' do -# it 'handles improper number of arguments' -# end -#end +require 'spec_helper_acceptance' + +describe 'validate_augeas function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'prep' do + it 'installs augeas for tests' + end + describe 'success' do + context 'valid inputs with no 3rd argument' do + { + 'root:x:0:0:root:/root:/bin/bash\n' => 'Passwd.lns', + 'proc /proc proc nodev,noexec,nosuid 0 0\n' => 'Fstab.lns' + }.each do |line,lens| + it "validates a single argument for #{lens}" do + pp = <<-EOS + $line = "#{line}" + $lens = "#{lens}" + validate_augeas($line, $lens) + EOS + + apply_manifest(pp, :catch_failures => true) + end + end + end + context 'valid inputs with 3rd and 4th arguments' do + it "validates a restricted value" do + line = 'root:x:0:0:root:/root:/bin/barsh\n' + lens = 'Passwd.lns' + restriction = '$file/*[shell="/bin/barsh"]' + pp = <<-EOS + $line = "#{line}" + $lens = "#{lens}" + $restriction = ['#{restriction}'] + validate_augeas($line, $lens, $restriction, "my custom failure message") + EOS + + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/my custom failure message/) + end + end + context 'invalid inputs' do + { + 'root:x:0:0:root' => 'Passwd.lns', + '127.0.1.1' => 'Hosts.lns' + }.each do |line,lens| + it "validates a single argument for #{lens}" do + pp = <<-EOS + $line = "#{line}" + $lens = "#{lens}" + validate_augeas($line, $lens) + EOS + + apply_manifest(pp, :expect_failures => true) + end + end + end + context 'garbage inputs' do + it 'raises an error on invalid inputs' + end + end + describe 'failure' do + it 'handles improper number of arguments' + end +end -- cgit v1.2.3 From 226cc7653c468afecf70ca3cdc8594ba874998db Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Fri, 2 May 2014 13:42:25 -0700 Subject: Update build_csv to understand contexts --- spec/acceptance/build_csv.rb | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/build_csv.rb b/spec/acceptance/build_csv.rb index 556d1f8..62ecbf1 100644 --- a/spec/acceptance/build_csv.rb +++ b/spec/acceptance/build_csv.rb @@ -1,7 +1,6 @@ #!/usr/bin/env ruby # vim: set sw=2 sts=2 et tw=80 : require 'rspec' -require 'pry' #XXX Super ugly hack to keep from starting beaker nodes module Kernel @@ -44,15 +43,30 @@ def get_tests(children) end end +def count_test_types_in(type,group) + return 0 if group.nil? + group.inject(0) do |m,(k,v)| + m += v.length if k == type + m += count_tests_in(v) if v.is_a?(Hash) + m + end +end +def count_tests_in(group) + count_test_types_in('tests',group) +end +def count_pending_tests_in(group) + count_test_types_in('pending_tests',group) +end + # Convert tests hash to csv format def to_csv(function_list,tests) function_list.collect do |function_name| if v = tests["#{function_name} function"] - positive_tests = v["groups"]["success"] ? v["groups"]["success"]["tests"].length : 0 - negative_tests = v["groups"]["failure"] ? v["groups"]["failure"]["tests"].length : 0 + positive_tests = count_tests_in(v["groups"]["success"]) + negative_tests = count_tests_in(v["groups"]["failure"]) pending_tests = - (v["groups"]["failure"] ? v["groups"]["success"]["pending_tests"].length : 0) + - (v["groups"]["failure"] ? v["groups"]["failure"]["pending_tests"].length : 0) + count_pending_tests_in(v["groups"]["failure"]) + + count_pending_tests_in(v["groups"]["failure"]) else positive_tests = 0 negative_tests = 0 -- cgit v1.2.3 From 09f892023c726eabaa85a308c2dbffd8e8b71fbd Mon Sep 17 00:00:00 2001 From: Andrea Veri Date: Wed, 7 May 2014 11:49:25 +0200 Subject: Add the missing shebangs and fix the wrong ones for rpmlint to stop complaining loudly --- spec/acceptance/abs_spec.rb | 1 + spec/acceptance/any2array_spec.rb | 1 + spec/acceptance/base64_spec.rb | 1 + spec/acceptance/bool2num_spec.rb | 1 + spec/acceptance/capitalize_spec.rb | 1 + spec/acceptance/chomp_spec.rb | 1 + spec/acceptance/chop_spec.rb | 1 + spec/acceptance/concat_spec.rb | 1 + spec/acceptance/count_spec.rb | 1 + spec/acceptance/deep_merge_spec.rb | 1 + spec/acceptance/defined_with_params_spec.rb | 1 + spec/acceptance/delete_at_spec.rb | 1 + spec/acceptance/delete_spec.rb | 1 + spec/acceptance/delete_undef_values_spec.rb | 1 + spec/acceptance/num2bool_spec.rb | 1 + spec/acceptance/parsejson_spec.rb | 1 + spec/acceptance/parseyaml_spec.rb | 1 + spec/acceptance/pick_default_spec.rb | 1 + spec/acceptance/pick_spec.rb | 1 + spec/acceptance/prefix_spec.rb | 1 + spec/acceptance/range_spec.rb | 1 + spec/acceptance/reject_spec.rb | 1 + spec/acceptance/reverse_spec.rb | 1 + spec/acceptance/rstrip_spec.rb | 1 + spec/acceptance/shuffle_spec.rb | 1 + spec/acceptance/size_spec.rb | 1 + spec/acceptance/sort_spec.rb | 1 + spec/acceptance/squeeze_spec.rb | 1 + spec/acceptance/str2bool_spec.rb | 1 + spec/acceptance/str2saltedsha512_spec.rb | 1 + spec/acceptance/strftime_spec.rb | 1 + spec/acceptance/strip_spec.rb | 1 + spec/acceptance/suffix_spec.rb | 1 + spec/acceptance/swapcase_spec.rb | 1 + spec/acceptance/time_spec.rb | 1 + spec/acceptance/to_bytes_spec.rb | 1 + spec/acceptance/type_spec.rb | 1 + spec/acceptance/union_spec.rb | 1 + spec/acceptance/unique_spec.rb | 1 + spec/acceptance/unsupported_spec.rb | 1 + spec/acceptance/upcase_spec.rb | 1 + spec/acceptance/uriescape_spec.rb | 1 + spec/acceptance/validate_absolute_path_spec.rb | 1 + spec/acceptance/validate_array_spec.rb | 1 + spec/acceptance/validate_augeas_spec.rb | 1 + spec/acceptance/validate_bool_spec.rb | 1 + spec/acceptance/validate_cmd_spec.rb | 1 + spec/acceptance/validate_hash_spec.rb | 1 + spec/acceptance/validate_ipv4_address_spec.rb | 1 + spec/acceptance/validate_ipv6_address_spec.rb | 1 + spec/acceptance/validate_re_spec.rb | 1 + spec/acceptance/validate_slength_spec.rb | 1 + spec/acceptance/validate_string_spec.rb | 1 + spec/acceptance/values_at_spec.rb | 1 + spec/acceptance/values_spec.rb | 1 + spec/acceptance/zip_spec.rb | 1 + 56 files changed, 56 insertions(+) (limited to 'spec/acceptance') diff --git a/spec/acceptance/abs_spec.rb b/spec/acceptance/abs_spec.rb index eeae89b..8e05642 100644 --- a/spec/acceptance/abs_spec.rb +++ b/spec/acceptance/abs_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'abs function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/any2array_spec.rb b/spec/acceptance/any2array_spec.rb index 0127303..467d6af 100644 --- a/spec/acceptance/any2array_spec.rb +++ b/spec/acceptance/any2array_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'any2array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/base64_spec.rb b/spec/acceptance/base64_spec.rb index 30ba689..97e1738 100644 --- a/spec/acceptance/base64_spec.rb +++ b/spec/acceptance/base64_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'base64 function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/bool2num_spec.rb b/spec/acceptance/bool2num_spec.rb index 1cbd88d..7a70311 100644 --- a/spec/acceptance/bool2num_spec.rb +++ b/spec/acceptance/bool2num_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'bool2num function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/capitalize_spec.rb b/spec/acceptance/capitalize_spec.rb index c04b401..e5e7b7b 100644 --- a/spec/acceptance/capitalize_spec.rb +++ b/spec/acceptance/capitalize_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'capitalize function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/chomp_spec.rb b/spec/acceptance/chomp_spec.rb index c4af9d9..f6c1595 100644 --- a/spec/acceptance/chomp_spec.rb +++ b/spec/acceptance/chomp_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'chomp function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/chop_spec.rb b/spec/acceptance/chop_spec.rb index 8774390..dbc28da 100644 --- a/spec/acceptance/chop_spec.rb +++ b/spec/acceptance/chop_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'chop function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index 24b5955..7bda365 100644 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'concat function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/count_spec.rb b/spec/acceptance/count_spec.rb index 0a0f5d7..51a40ba 100644 --- a/spec/acceptance/count_spec.rb +++ b/spec/acceptance/count_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'count function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/deep_merge_spec.rb b/spec/acceptance/deep_merge_spec.rb index 676d23d..c0f9b12 100644 --- a/spec/acceptance/deep_merge_spec.rb +++ b/spec/acceptance/deep_merge_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'deep_merge function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/defined_with_params_spec.rb b/spec/acceptance/defined_with_params_spec.rb index 7477453..fc54450 100644 --- a/spec/acceptance/defined_with_params_spec.rb +++ b/spec/acceptance/defined_with_params_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'defined_with_params function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/delete_at_spec.rb b/spec/acceptance/delete_at_spec.rb index f2c5cfe..db0c01f 100644 --- a/spec/acceptance/delete_at_spec.rb +++ b/spec/acceptance/delete_at_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'delete_at function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/delete_spec.rb b/spec/acceptance/delete_spec.rb index e54d816..a28604c 100644 --- a/spec/acceptance/delete_spec.rb +++ b/spec/acceptance/delete_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'delete function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/delete_undef_values_spec.rb b/spec/acceptance/delete_undef_values_spec.rb index c2ac931..b7eda19 100644 --- a/spec/acceptance/delete_undef_values_spec.rb +++ b/spec/acceptance/delete_undef_values_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'delete_undef_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/num2bool_spec.rb b/spec/acceptance/num2bool_spec.rb index cdfbc70..1d99ba0 100644 --- a/spec/acceptance/num2bool_spec.rb +++ b/spec/acceptance/num2bool_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'num2bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/parsejson_spec.rb b/spec/acceptance/parsejson_spec.rb index b2ae030..5097810 100644 --- a/spec/acceptance/parsejson_spec.rb +++ b/spec/acceptance/parsejson_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'parsejson function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/parseyaml_spec.rb b/spec/acceptance/parseyaml_spec.rb index 01e0988..4b4bf3d 100644 --- a/spec/acceptance/parseyaml_spec.rb +++ b/spec/acceptance/parseyaml_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'parseyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/pick_default_spec.rb b/spec/acceptance/pick_default_spec.rb index e94a999..a663f54 100644 --- a/spec/acceptance/pick_default_spec.rb +++ b/spec/acceptance/pick_default_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'pick_default function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/pick_spec.rb b/spec/acceptance/pick_spec.rb index 8a768a9..46cf63f 100644 --- a/spec/acceptance/pick_spec.rb +++ b/spec/acceptance/pick_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'pick function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/prefix_spec.rb b/spec/acceptance/prefix_spec.rb index d7b80a8..de55530 100644 --- a/spec/acceptance/prefix_spec.rb +++ b/spec/acceptance/prefix_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'prefix function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/range_spec.rb b/spec/acceptance/range_spec.rb index 0387e4e..a3ccd33 100644 --- a/spec/acceptance/range_spec.rb +++ b/spec/acceptance/range_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'range function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/reject_spec.rb b/spec/acceptance/reject_spec.rb index 52b8755..7f16a00 100644 --- a/spec/acceptance/reject_spec.rb +++ b/spec/acceptance/reject_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'reject function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/reverse_spec.rb b/spec/acceptance/reverse_spec.rb index 29bdc25..c3f0156 100644 --- a/spec/acceptance/reverse_spec.rb +++ b/spec/acceptance/reverse_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'reverse function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/rstrip_spec.rb b/spec/acceptance/rstrip_spec.rb index 11ed60a..b57a8b0 100644 --- a/spec/acceptance/rstrip_spec.rb +++ b/spec/acceptance/rstrip_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'rstrip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/shuffle_spec.rb b/spec/acceptance/shuffle_spec.rb index e22171f..02d1201 100644 --- a/spec/acceptance/shuffle_spec.rb +++ b/spec/acceptance/shuffle_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'shuffle function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/size_spec.rb b/spec/acceptance/size_spec.rb index d79140e..a52b778 100644 --- a/spec/acceptance/size_spec.rb +++ b/spec/acceptance/size_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'size function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/sort_spec.rb b/spec/acceptance/sort_spec.rb index ae7c9db..c85bfab 100644 --- a/spec/acceptance/sort_spec.rb +++ b/spec/acceptance/sort_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'sort function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/squeeze_spec.rb b/spec/acceptance/squeeze_spec.rb index 82e3233..400a458 100644 --- a/spec/acceptance/squeeze_spec.rb +++ b/spec/acceptance/squeeze_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'squeeze function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/str2bool_spec.rb b/spec/acceptance/str2bool_spec.rb index a3ba5fe..cf549da 100644 --- a/spec/acceptance/str2bool_spec.rb +++ b/spec/acceptance/str2bool_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'str2bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/str2saltedsha512_spec.rb b/spec/acceptance/str2saltedsha512_spec.rb index d353e22..993e63b 100644 --- a/spec/acceptance/str2saltedsha512_spec.rb +++ b/spec/acceptance/str2saltedsha512_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'str2saltedsha512 function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/strftime_spec.rb b/spec/acceptance/strftime_spec.rb index 73a01c0..53b7f90 100644 --- a/spec/acceptance/strftime_spec.rb +++ b/spec/acceptance/strftime_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'strftime function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/strip_spec.rb b/spec/acceptance/strip_spec.rb index fe0c7e9..906fd7a 100644 --- a/spec/acceptance/strip_spec.rb +++ b/spec/acceptance/strip_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'strip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/suffix_spec.rb b/spec/acceptance/suffix_spec.rb index 493bc2b..630f866 100644 --- a/spec/acceptance/suffix_spec.rb +++ b/spec/acceptance/suffix_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'suffix function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/swapcase_spec.rb b/spec/acceptance/swapcase_spec.rb index d4ae0dd..b7894fb 100644 --- a/spec/acceptance/swapcase_spec.rb +++ b/spec/acceptance/swapcase_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'swapcase function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/time_spec.rb b/spec/acceptance/time_spec.rb index 2a5e52a..cdb2960 100644 --- a/spec/acceptance/time_spec.rb +++ b/spec/acceptance/time_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'time function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/to_bytes_spec.rb b/spec/acceptance/to_bytes_spec.rb index 34f3647..2b4c61f 100644 --- a/spec/acceptance/to_bytes_spec.rb +++ b/spec/acceptance/to_bytes_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'to_bytes function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/type_spec.rb b/spec/acceptance/type_spec.rb index dc72f74..0043aad 100644 --- a/spec/acceptance/type_spec.rb +++ b/spec/acceptance/type_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'type function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/union_spec.rb b/spec/acceptance/union_spec.rb index f413d9a..6db8d0c 100644 --- a/spec/acceptance/union_spec.rb +++ b/spec/acceptance/union_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'union function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/unique_spec.rb b/spec/acceptance/unique_spec.rb index ea63cb4..bfadad1 100644 --- a/spec/acceptance/unique_spec.rb +++ b/spec/acceptance/unique_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'unique function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/unsupported_spec.rb b/spec/acceptance/unsupported_spec.rb index 449f35a..1c559f6 100644 --- a/spec/acceptance/unsupported_spec.rb +++ b/spec/acceptance/unsupported_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'unsupported distributions and OSes', :if => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/upcase_spec.rb b/spec/acceptance/upcase_spec.rb index 50e6302..3d2906d 100644 --- a/spec/acceptance/upcase_spec.rb +++ b/spec/acceptance/upcase_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'upcase function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/uriescape_spec.rb b/spec/acceptance/uriescape_spec.rb index 0b8a549..7e30205 100644 --- a/spec/acceptance/uriescape_spec.rb +++ b/spec/acceptance/uriescape_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'uriescape function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/validate_absolute_path_spec.rb b/spec/acceptance/validate_absolute_path_spec.rb index 35ee974..7082e84 100644 --- a/spec/acceptance/validate_absolute_path_spec.rb +++ b/spec/acceptance/validate_absolute_path_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'validate_absolute_path function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/validate_array_spec.rb b/spec/acceptance/validate_array_spec.rb index da9f465..b53e98c 100644 --- a/spec/acceptance/validate_array_spec.rb +++ b/spec/acceptance/validate_array_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'validate_array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/validate_augeas_spec.rb b/spec/acceptance/validate_augeas_spec.rb index 98ee6d1..aeec67a 100644 --- a/spec/acceptance/validate_augeas_spec.rb +++ b/spec/acceptance/validate_augeas_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'validate_augeas function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/validate_bool_spec.rb b/spec/acceptance/validate_bool_spec.rb index 4e77da2..c837f08 100644 --- a/spec/acceptance/validate_bool_spec.rb +++ b/spec/acceptance/validate_bool_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'validate_bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/validate_cmd_spec.rb b/spec/acceptance/validate_cmd_spec.rb index b4d6575..385676d 100644 --- a/spec/acceptance/validate_cmd_spec.rb +++ b/spec/acceptance/validate_cmd_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'validate_cmd function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/validate_hash_spec.rb b/spec/acceptance/validate_hash_spec.rb index d26c9e7..52fb615 100644 --- a/spec/acceptance/validate_hash_spec.rb +++ b/spec/acceptance/validate_hash_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'validate_hash function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/validate_ipv4_address_spec.rb b/spec/acceptance/validate_ipv4_address_spec.rb index b98b81c..64841c3 100644 --- a/spec/acceptance/validate_ipv4_address_spec.rb +++ b/spec/acceptance/validate_ipv4_address_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'validate_ipv4_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/validate_ipv6_address_spec.rb b/spec/acceptance/validate_ipv6_address_spec.rb index 3e73a82..6426d1a 100644 --- a/spec/acceptance/validate_ipv6_address_spec.rb +++ b/spec/acceptance/validate_ipv6_address_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'validate_ipv6_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/validate_re_spec.rb b/spec/acceptance/validate_re_spec.rb index 8d7e634..22f6d47 100644 --- a/spec/acceptance/validate_re_spec.rb +++ b/spec/acceptance/validate_re_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'validate_re function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/validate_slength_spec.rb b/spec/acceptance/validate_slength_spec.rb index 96b2a6f..1ab2bb9 100644 --- a/spec/acceptance/validate_slength_spec.rb +++ b/spec/acceptance/validate_slength_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'validate_slength function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/validate_string_spec.rb b/spec/acceptance/validate_string_spec.rb index f8658c5..8956f48 100644 --- a/spec/acceptance/validate_string_spec.rb +++ b/spec/acceptance/validate_string_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'validate_string function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/values_at_spec.rb b/spec/acceptance/values_at_spec.rb index f341e3d..da63cf3 100644 --- a/spec/acceptance/values_at_spec.rb +++ b/spec/acceptance/values_at_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'values_at function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/values_spec.rb b/spec/acceptance/values_spec.rb index 0c12702..7ef956e 100644 --- a/spec/acceptance/values_spec.rb +++ b/spec/acceptance/values_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do diff --git a/spec/acceptance/zip_spec.rb b/spec/acceptance/zip_spec.rb index a551b80..0e924e8 100644 --- a/spec/acceptance/zip_spec.rb +++ b/spec/acceptance/zip_spec.rb @@ -1,3 +1,4 @@ +#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' require 'puppet' -- cgit v1.2.3 From 890ef5c471027eb164e0296d4fd172a0115319d6 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Tue, 6 May 2014 18:48:59 -0700 Subject: Adding more spec coverage --- spec/acceptance/delete_values_spec.rb | 25 +++++++ spec/acceptance/difference_spec.rb | 26 +++++++ spec/acceptance/dirname_spec.rb | 42 +++++++++++ spec/acceptance/downcase_spec.rb | 39 ++++++++++ spec/acceptance/empty_spec.rb | 39 ++++++++++ spec/acceptance/ensure_packages_spec.rb | 24 ++++++ spec/acceptance/ensure_resource_spec.rb | 24 ++++++ spec/acceptance/flatten_spec.rb | 39 ++++++++++ spec/acceptance/floor_spec.rb | 39 ++++++++++ spec/acceptance/fqdn_rotate_spec.rb | 33 +++++++++ spec/acceptance/get_module_path_spec.rb | 41 +++++++++++ spec/acceptance/getparam_spec.rb | 25 +++++++ spec/acceptance/getvar_spec.rb | 26 +++++++ spec/acceptance/grep_spec.rb | 26 +++++++ spec/acceptance/has_interface_with_spec.rb | 44 +++++++++++ spec/acceptance/has_ip_address_spec.rb | 33 +++++++++ spec/acceptance/has_ip_network_spec.rb | 33 +++++++++ spec/acceptance/has_key_spec.rb | 41 +++++++++++ spec/acceptance/hash_spec.rb | 26 +++++++ spec/acceptance/intersection_spec.rb | 27 +++++++ spec/acceptance/is_array_spec.rb | 67 +++++++++++++++++ spec/acceptance/is_bool_spec.rb | 81 ++++++++++++++++++++ spec/acceptance/is_domain_name_spec.rb | 83 +++++++++++++++++++++ spec/acceptance/is_float_spec.rb | 86 ++++++++++++++++++++++ spec/acceptance/is_function_available_spec.rb | 58 +++++++++++++++ spec/acceptance/is_hash_spec.rb | 63 ++++++++++++++++ spec/acceptance/is_integer_spec.rb | 95 ++++++++++++++++++++++++ spec/acceptance/is_ip_address_spec.rb | 80 ++++++++++++++++++++ spec/acceptance/is_mac_address_spec.rb | 38 ++++++++++ spec/acceptance/is_numeric_spec.rb | 95 ++++++++++++++++++++++++ spec/acceptance/is_string_spec.rb | 102 ++++++++++++++++++++++++++ spec/acceptance/join_keys_to_values_spec.rb | 24 ++++++ spec/acceptance/join_spec.rb | 26 +++++++ spec/acceptance/keys_spec.rb | 23 ++++++ spec/acceptance/loadyaml_spec.rb | 31 ++++++++ spec/acceptance/lstrip_spec.rb | 34 +++++++++ spec/acceptance/max_spec.rb | 20 +++++ spec/acceptance/member_spec.rb | 26 +++++++ spec/acceptance/merge_spec.rb | 23 ++++++ spec/acceptance/min_spec.rb | 20 +++++ spec/acceptance/nodesets/centos-6-vcloud.yml | 15 ++++ 41 files changed, 1742 insertions(+) create mode 100644 spec/acceptance/delete_values_spec.rb create mode 100644 spec/acceptance/difference_spec.rb create mode 100644 spec/acceptance/dirname_spec.rb create mode 100644 spec/acceptance/downcase_spec.rb create mode 100644 spec/acceptance/empty_spec.rb create mode 100644 spec/acceptance/ensure_packages_spec.rb create mode 100755 spec/acceptance/ensure_resource_spec.rb create mode 100644 spec/acceptance/flatten_spec.rb create mode 100644 spec/acceptance/floor_spec.rb create mode 100644 spec/acceptance/fqdn_rotate_spec.rb create mode 100644 spec/acceptance/get_module_path_spec.rb create mode 100755 spec/acceptance/getparam_spec.rb create mode 100644 spec/acceptance/getvar_spec.rb create mode 100644 spec/acceptance/grep_spec.rb create mode 100644 spec/acceptance/has_interface_with_spec.rb create mode 100755 spec/acceptance/has_ip_address_spec.rb create mode 100755 spec/acceptance/has_ip_network_spec.rb create mode 100644 spec/acceptance/has_key_spec.rb create mode 100644 spec/acceptance/hash_spec.rb create mode 100644 spec/acceptance/intersection_spec.rb create mode 100644 spec/acceptance/is_array_spec.rb create mode 100644 spec/acceptance/is_bool_spec.rb create mode 100644 spec/acceptance/is_domain_name_spec.rb create mode 100644 spec/acceptance/is_float_spec.rb create mode 100644 spec/acceptance/is_function_available_spec.rb create mode 100644 spec/acceptance/is_hash_spec.rb create mode 100644 spec/acceptance/is_integer_spec.rb create mode 100644 spec/acceptance/is_ip_address_spec.rb create mode 100644 spec/acceptance/is_mac_address_spec.rb create mode 100644 spec/acceptance/is_numeric_spec.rb create mode 100644 spec/acceptance/is_string_spec.rb create mode 100644 spec/acceptance/join_keys_to_values_spec.rb create mode 100644 spec/acceptance/join_spec.rb create mode 100644 spec/acceptance/keys_spec.rb create mode 100644 spec/acceptance/loadyaml_spec.rb create mode 100644 spec/acceptance/lstrip_spec.rb create mode 100644 spec/acceptance/max_spec.rb create mode 100644 spec/acceptance/member_spec.rb create mode 100644 spec/acceptance/merge_spec.rb create mode 100644 spec/acceptance/min_spec.rb create mode 100644 spec/acceptance/nodesets/centos-6-vcloud.yml (limited to 'spec/acceptance') diff --git a/spec/acceptance/delete_values_spec.rb b/spec/acceptance/delete_values_spec.rb new file mode 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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/ -- cgit v1.2.3 From c66a2e4f49d6c9ebcbff718f3ec119049fb4c514 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Wed, 7 May 2014 10:09:32 -0700 Subject: Add mode +x to spec .rb files --- spec/acceptance/abs_spec.rb | 0 spec/acceptance/any2array_spec.rb | 0 spec/acceptance/base64_spec.rb | 0 spec/acceptance/bool2num_spec.rb | 0 spec/acceptance/build_csv.rb | 0 spec/acceptance/capitalize_spec.rb | 0 spec/acceptance/chomp_spec.rb | 0 spec/acceptance/chop_spec.rb | 0 spec/acceptance/concat_spec.rb | 0 spec/acceptance/count_spec.rb | 0 spec/acceptance/deep_merge_spec.rb | 0 spec/acceptance/defined_with_params_spec.rb | 0 spec/acceptance/delete_at_spec.rb | 0 spec/acceptance/delete_spec.rb | 0 spec/acceptance/delete_undef_values_spec.rb | 0 spec/acceptance/delete_values_spec.rb | 0 spec/acceptance/difference_spec.rb | 0 spec/acceptance/dirname_spec.rb | 0 spec/acceptance/downcase_spec.rb | 0 spec/acceptance/empty_spec.rb | 0 spec/acceptance/ensure_packages_spec.rb | 0 spec/acceptance/flatten_spec.rb | 0 spec/acceptance/floor_spec.rb | 0 spec/acceptance/fqdn_rotate_spec.rb | 0 spec/acceptance/get_module_path_spec.rb | 0 spec/acceptance/getvar_spec.rb | 0 spec/acceptance/grep_spec.rb | 0 spec/acceptance/has_interface_with_spec.rb | 0 spec/acceptance/has_key_spec.rb | 0 spec/acceptance/hash_spec.rb | 0 spec/acceptance/intersection_spec.rb | 0 spec/acceptance/is_array_spec.rb | 0 spec/acceptance/is_bool_spec.rb | 0 spec/acceptance/is_domain_name_spec.rb | 0 spec/acceptance/is_float_spec.rb | 0 spec/acceptance/is_function_available_spec.rb | 0 spec/acceptance/is_hash_spec.rb | 0 spec/acceptance/is_integer_spec.rb | 0 spec/acceptance/is_ip_address_spec.rb | 0 spec/acceptance/is_mac_address_spec.rb | 0 spec/acceptance/is_numeric_spec.rb | 0 spec/acceptance/is_string_spec.rb | 0 spec/acceptance/join_keys_to_values_spec.rb | 0 spec/acceptance/join_spec.rb | 0 spec/acceptance/keys_spec.rb | 0 spec/acceptance/lstrip_spec.rb | 0 spec/acceptance/max_spec.rb | 0 spec/acceptance/member_spec.rb | 0 spec/acceptance/merge_spec.rb | 0 spec/acceptance/min_spec.rb | 0 spec/acceptance/num2bool_spec.rb | 0 spec/acceptance/parsejson_spec.rb | 0 spec/acceptance/parseyaml_spec.rb | 0 spec/acceptance/pick_default_spec.rb | 0 spec/acceptance/pick_spec.rb | 0 spec/acceptance/prefix_spec.rb | 0 spec/acceptance/range_spec.rb | 0 spec/acceptance/reject_spec.rb | 0 spec/acceptance/reverse_spec.rb | 0 spec/acceptance/rstrip_spec.rb | 0 spec/acceptance/shuffle_spec.rb | 0 spec/acceptance/size_spec.rb | 0 spec/acceptance/sort_spec.rb | 0 spec/acceptance/squeeze_spec.rb | 0 spec/acceptance/str2bool_spec.rb | 0 spec/acceptance/str2saltedsha512_spec.rb | 0 spec/acceptance/strftime_spec.rb | 0 spec/acceptance/strip_spec.rb | 0 spec/acceptance/suffix_spec.rb | 0 spec/acceptance/swapcase_spec.rb | 0 spec/acceptance/time_spec.rb | 0 spec/acceptance/to_bytes_spec.rb | 0 spec/acceptance/type_spec.rb | 0 spec/acceptance/union_spec.rb | 0 spec/acceptance/unique_spec.rb | 0 spec/acceptance/unsupported_spec.rb | 0 spec/acceptance/upcase_spec.rb | 0 spec/acceptance/uriescape_spec.rb | 0 spec/acceptance/validate_absolute_path_spec.rb | 0 spec/acceptance/validate_array_spec.rb | 0 spec/acceptance/validate_augeas_spec.rb | 0 spec/acceptance/validate_bool_spec.rb | 0 spec/acceptance/validate_cmd_spec.rb | 0 spec/acceptance/validate_hash_spec.rb | 0 spec/acceptance/validate_ipv4_address_spec.rb | 0 spec/acceptance/validate_ipv6_address_spec.rb | 0 spec/acceptance/validate_re_spec.rb | 0 spec/acceptance/validate_slength_spec.rb | 0 spec/acceptance/validate_string_spec.rb | 0 spec/acceptance/values_at_spec.rb | 0 spec/acceptance/values_spec.rb | 0 spec/acceptance/zip_spec.rb | 0 92 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 spec/acceptance/abs_spec.rb mode change 100644 => 100755 spec/acceptance/any2array_spec.rb mode change 100644 => 100755 spec/acceptance/base64_spec.rb mode change 100644 => 100755 spec/acceptance/bool2num_spec.rb mode change 100644 => 100755 spec/acceptance/build_csv.rb mode change 100644 => 100755 spec/acceptance/capitalize_spec.rb mode change 100644 => 100755 spec/acceptance/chomp_spec.rb mode change 100644 => 100755 spec/acceptance/chop_spec.rb mode change 100644 => 100755 spec/acceptance/concat_spec.rb mode change 100644 => 100755 spec/acceptance/count_spec.rb mode change 100644 => 100755 spec/acceptance/deep_merge_spec.rb mode change 100644 => 100755 spec/acceptance/defined_with_params_spec.rb mode change 100644 => 100755 spec/acceptance/delete_at_spec.rb mode change 100644 => 100755 spec/acceptance/delete_spec.rb mode change 100644 => 100755 spec/acceptance/delete_undef_values_spec.rb mode change 100644 => 100755 spec/acceptance/delete_values_spec.rb mode change 100644 => 100755 spec/acceptance/difference_spec.rb mode change 100644 => 100755 spec/acceptance/dirname_spec.rb mode change 100644 => 100755 spec/acceptance/downcase_spec.rb mode change 100644 => 100755 spec/acceptance/empty_spec.rb mode change 100644 => 100755 spec/acceptance/ensure_packages_spec.rb mode change 100644 => 100755 spec/acceptance/flatten_spec.rb mode change 100644 => 100755 spec/acceptance/floor_spec.rb mode change 100644 => 100755 spec/acceptance/fqdn_rotate_spec.rb mode change 100644 => 100755 spec/acceptance/get_module_path_spec.rb mode change 100644 => 100755 spec/acceptance/getvar_spec.rb mode change 100644 => 100755 spec/acceptance/grep_spec.rb mode change 100644 => 100755 spec/acceptance/has_interface_with_spec.rb mode change 100644 => 100755 spec/acceptance/has_key_spec.rb mode change 100644 => 100755 spec/acceptance/hash_spec.rb mode change 100644 => 100755 spec/acceptance/intersection_spec.rb mode change 100644 => 100755 spec/acceptance/is_array_spec.rb mode change 100644 => 100755 spec/acceptance/is_bool_spec.rb mode change 100644 => 100755 spec/acceptance/is_domain_name_spec.rb mode change 100644 => 100755 spec/acceptance/is_float_spec.rb mode change 100644 => 100755 spec/acceptance/is_function_available_spec.rb mode change 100644 => 100755 spec/acceptance/is_hash_spec.rb mode change 100644 => 100755 spec/acceptance/is_integer_spec.rb mode change 100644 => 100755 spec/acceptance/is_ip_address_spec.rb mode change 100644 => 100755 spec/acceptance/is_mac_address_spec.rb mode change 100644 => 100755 spec/acceptance/is_numeric_spec.rb mode change 100644 => 100755 spec/acceptance/is_string_spec.rb mode change 100644 => 100755 spec/acceptance/join_keys_to_values_spec.rb mode change 100644 => 100755 spec/acceptance/join_spec.rb mode change 100644 => 100755 spec/acceptance/keys_spec.rb mode change 100644 => 100755 spec/acceptance/lstrip_spec.rb mode change 100644 => 100755 spec/acceptance/max_spec.rb mode change 100644 => 100755 spec/acceptance/member_spec.rb mode change 100644 => 100755 spec/acceptance/merge_spec.rb mode change 100644 => 100755 spec/acceptance/min_spec.rb mode change 100644 => 100755 spec/acceptance/num2bool_spec.rb mode change 100644 => 100755 spec/acceptance/parsejson_spec.rb mode change 100644 => 100755 spec/acceptance/parseyaml_spec.rb mode change 100644 => 100755 spec/acceptance/pick_default_spec.rb mode change 100644 => 100755 spec/acceptance/pick_spec.rb mode change 100644 => 100755 spec/acceptance/prefix_spec.rb mode change 100644 => 100755 spec/acceptance/range_spec.rb mode change 100644 => 100755 spec/acceptance/reject_spec.rb mode change 100644 => 100755 spec/acceptance/reverse_spec.rb mode change 100644 => 100755 spec/acceptance/rstrip_spec.rb mode change 100644 => 100755 spec/acceptance/shuffle_spec.rb mode change 100644 => 100755 spec/acceptance/size_spec.rb mode change 100644 => 100755 spec/acceptance/sort_spec.rb mode change 100644 => 100755 spec/acceptance/squeeze_spec.rb mode change 100644 => 100755 spec/acceptance/str2bool_spec.rb mode change 100644 => 100755 spec/acceptance/str2saltedsha512_spec.rb mode change 100644 => 100755 spec/acceptance/strftime_spec.rb mode change 100644 => 100755 spec/acceptance/strip_spec.rb mode change 100644 => 100755 spec/acceptance/suffix_spec.rb mode change 100644 => 100755 spec/acceptance/swapcase_spec.rb mode change 100644 => 100755 spec/acceptance/time_spec.rb mode change 100644 => 100755 spec/acceptance/to_bytes_spec.rb mode change 100644 => 100755 spec/acceptance/type_spec.rb mode change 100644 => 100755 spec/acceptance/union_spec.rb mode change 100644 => 100755 spec/acceptance/unique_spec.rb mode change 100644 => 100755 spec/acceptance/unsupported_spec.rb mode change 100644 => 100755 spec/acceptance/upcase_spec.rb mode change 100644 => 100755 spec/acceptance/uriescape_spec.rb mode change 100644 => 100755 spec/acceptance/validate_absolute_path_spec.rb mode change 100644 => 100755 spec/acceptance/validate_array_spec.rb mode change 100644 => 100755 spec/acceptance/validate_augeas_spec.rb mode change 100644 => 100755 spec/acceptance/validate_bool_spec.rb mode change 100644 => 100755 spec/acceptance/validate_cmd_spec.rb mode change 100644 => 100755 spec/acceptance/validate_hash_spec.rb mode change 100644 => 100755 spec/acceptance/validate_ipv4_address_spec.rb mode change 100644 => 100755 spec/acceptance/validate_ipv6_address_spec.rb mode change 100644 => 100755 spec/acceptance/validate_re_spec.rb mode change 100644 => 100755 spec/acceptance/validate_slength_spec.rb mode change 100644 => 100755 spec/acceptance/validate_string_spec.rb mode change 100644 => 100755 spec/acceptance/values_at_spec.rb mode change 100644 => 100755 spec/acceptance/values_spec.rb mode change 100644 => 100755 spec/acceptance/zip_spec.rb (limited to 'spec/acceptance') diff --git a/spec/acceptance/abs_spec.rb b/spec/acceptance/abs_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/any2array_spec.rb b/spec/acceptance/any2array_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/base64_spec.rb b/spec/acceptance/base64_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/bool2num_spec.rb b/spec/acceptance/bool2num_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/build_csv.rb b/spec/acceptance/build_csv.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/capitalize_spec.rb b/spec/acceptance/capitalize_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/chomp_spec.rb b/spec/acceptance/chomp_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/chop_spec.rb b/spec/acceptance/chop_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/count_spec.rb b/spec/acceptance/count_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/deep_merge_spec.rb b/spec/acceptance/deep_merge_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/defined_with_params_spec.rb b/spec/acceptance/defined_with_params_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/delete_at_spec.rb b/spec/acceptance/delete_at_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/delete_spec.rb b/spec/acceptance/delete_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/delete_undef_values_spec.rb b/spec/acceptance/delete_undef_values_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/delete_values_spec.rb b/spec/acceptance/delete_values_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/difference_spec.rb b/spec/acceptance/difference_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/dirname_spec.rb b/spec/acceptance/dirname_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/downcase_spec.rb b/spec/acceptance/downcase_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/empty_spec.rb b/spec/acceptance/empty_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/flatten_spec.rb b/spec/acceptance/flatten_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/floor_spec.rb b/spec/acceptance/floor_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/get_module_path_spec.rb b/spec/acceptance/get_module_path_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/getvar_spec.rb b/spec/acceptance/getvar_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/grep_spec.rb b/spec/acceptance/grep_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/has_interface_with_spec.rb b/spec/acceptance/has_interface_with_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/has_key_spec.rb b/spec/acceptance/has_key_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/hash_spec.rb b/spec/acceptance/hash_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/intersection_spec.rb b/spec/acceptance/intersection_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/is_array_spec.rb b/spec/acceptance/is_array_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/is_bool_spec.rb b/spec/acceptance/is_bool_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/is_domain_name_spec.rb b/spec/acceptance/is_domain_name_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/is_float_spec.rb b/spec/acceptance/is_float_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/is_function_available_spec.rb b/spec/acceptance/is_function_available_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/is_hash_spec.rb b/spec/acceptance/is_hash_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/is_integer_spec.rb b/spec/acceptance/is_integer_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/is_ip_address_spec.rb b/spec/acceptance/is_ip_address_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/is_mac_address_spec.rb b/spec/acceptance/is_mac_address_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/is_numeric_spec.rb b/spec/acceptance/is_numeric_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/is_string_spec.rb b/spec/acceptance/is_string_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/join_keys_to_values_spec.rb b/spec/acceptance/join_keys_to_values_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/join_spec.rb b/spec/acceptance/join_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/keys_spec.rb b/spec/acceptance/keys_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/lstrip_spec.rb b/spec/acceptance/lstrip_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/max_spec.rb b/spec/acceptance/max_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/member_spec.rb b/spec/acceptance/member_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/merge_spec.rb b/spec/acceptance/merge_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/min_spec.rb b/spec/acceptance/min_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/num2bool_spec.rb b/spec/acceptance/num2bool_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/parsejson_spec.rb b/spec/acceptance/parsejson_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/parseyaml_spec.rb b/spec/acceptance/parseyaml_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/pick_default_spec.rb b/spec/acceptance/pick_default_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/pick_spec.rb b/spec/acceptance/pick_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/prefix_spec.rb b/spec/acceptance/prefix_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/range_spec.rb b/spec/acceptance/range_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/reject_spec.rb b/spec/acceptance/reject_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/reverse_spec.rb b/spec/acceptance/reverse_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/rstrip_spec.rb b/spec/acceptance/rstrip_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/shuffle_spec.rb b/spec/acceptance/shuffle_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/size_spec.rb b/spec/acceptance/size_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/sort_spec.rb b/spec/acceptance/sort_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/squeeze_spec.rb b/spec/acceptance/squeeze_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/str2bool_spec.rb b/spec/acceptance/str2bool_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/str2saltedsha512_spec.rb b/spec/acceptance/str2saltedsha512_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/strftime_spec.rb b/spec/acceptance/strftime_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/strip_spec.rb b/spec/acceptance/strip_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/suffix_spec.rb b/spec/acceptance/suffix_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/swapcase_spec.rb b/spec/acceptance/swapcase_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/time_spec.rb b/spec/acceptance/time_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/to_bytes_spec.rb b/spec/acceptance/to_bytes_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/type_spec.rb b/spec/acceptance/type_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/union_spec.rb b/spec/acceptance/union_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/unique_spec.rb b/spec/acceptance/unique_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/unsupported_spec.rb b/spec/acceptance/unsupported_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/upcase_spec.rb b/spec/acceptance/upcase_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/uriescape_spec.rb b/spec/acceptance/uriescape_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/validate_absolute_path_spec.rb b/spec/acceptance/validate_absolute_path_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/validate_array_spec.rb b/spec/acceptance/validate_array_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/validate_augeas_spec.rb b/spec/acceptance/validate_augeas_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/validate_bool_spec.rb b/spec/acceptance/validate_bool_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/validate_cmd_spec.rb b/spec/acceptance/validate_cmd_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/validate_hash_spec.rb b/spec/acceptance/validate_hash_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/validate_ipv4_address_spec.rb b/spec/acceptance/validate_ipv4_address_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/validate_ipv6_address_spec.rb b/spec/acceptance/validate_ipv6_address_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/validate_re_spec.rb b/spec/acceptance/validate_re_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/validate_slength_spec.rb b/spec/acceptance/validate_slength_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/validate_string_spec.rb b/spec/acceptance/validate_string_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/values_at_spec.rb b/spec/acceptance/values_at_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/values_spec.rb b/spec/acceptance/values_spec.rb old mode 100644 new mode 100755 diff --git a/spec/acceptance/zip_spec.rb b/spec/acceptance/zip_spec.rb old mode 100644 new mode 100755 -- cgit v1.2.3 From 0804121719e4bde856723e19e8ff8bf6f9c2d55d Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 8 May 2014 14:43:06 -0700 Subject: Fix the stdlib functions that fail tests --- spec/acceptance/getparam_spec.rb | 2 +- spec/acceptance/is_float_spec.rb | 6 +++--- spec/acceptance/is_string_spec.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/getparam_spec.rb b/spec/acceptance/getparam_spec.rb index a84b2d1..91fc9a0 100755 --- a/spec/acceptance/getparam_spec.rb +++ b/spec/acceptance/getparam_spec.rb @@ -13,7 +13,7 @@ describe 'getparam function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('op notice(inline_template('getparam is <%= @o.inspect %>')) EOS - apply_manifest(pp, :expect_changes => true) do |r| + apply_manifest(pp, :catch_failures => true) do |r| expect(r.stdout).to match(/getparam is true/) end end diff --git a/spec/acceptance/is_float_spec.rb b/spec/acceptance/is_float_spec.rb index 79b01f0..338ba58 100755 --- a/spec/acceptance/is_float_spec.rb +++ b/spec/acceptance/is_float_spec.rb @@ -7,7 +7,7 @@ describe 'is_float function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('op pp = <<-EOS $a = ['aaa.com','bbb','ccc'] $o = is_float($a) - notice(inline_template('is_floats is <%= @o.inspect %>')) + notice(inline_template('is_float is <%= @o.inspect %>')) EOS apply_manifest(pp, :catch_failures => true) do |r| @@ -18,7 +18,7 @@ describe 'is_float function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('op pp = <<-EOS $a = true $o = is_float($a) - notice(inline_template('is_floats is <%= @o.inspect %>')) + notice(inline_template('is_float is <%= @o.inspect %>')) EOS apply_manifest(pp, :catch_failures => true) do |r| @@ -75,7 +75,7 @@ describe 'is_float function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('op EOS apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/is_floats is false/) + expect(r.stdout).to match(/is_float is false/) end end end diff --git a/spec/acceptance/is_string_spec.rb b/spec/acceptance/is_string_spec.rb index bda6cd7..94d8e96 100755 --- a/spec/acceptance/is_string_spec.rb +++ b/spec/acceptance/is_string_spec.rb @@ -50,7 +50,7 @@ describe 'is_string function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('o EOS apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/is_string is true/) + expect(r.stdout).to match(/is_string is false/) end end it 'is_strings floats' do -- cgit v1.2.3 From 14c9155745fe4b472e530da6965c0866b6f2640d Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Fri, 9 May 2014 16:57:32 +0200 Subject: Prepare a 4.2.1 release. --- spec/acceptance/nodesets/centos-65-x64.yml | 10 ---------- spec/acceptance/nodesets/default.yml | 11 ++++++++++- 2 files changed, 10 insertions(+), 11 deletions(-) delete mode 100644 spec/acceptance/nodesets/centos-65-x64.yml mode change 120000 => 100644 spec/acceptance/nodesets/default.yml (limited to 'spec/acceptance') diff --git a/spec/acceptance/nodesets/centos-65-x64.yml b/spec/acceptance/nodesets/centos-65-x64.yml deleted file mode 100644 index 4e2cb80..0000000 --- a/spec/acceptance/nodesets/centos-65-x64.yml +++ /dev/null @@ -1,10 +0,0 @@ -HOSTS: - centos-65-x64: - roles: - - master - platform: el-6-x86_64 - box : centos-65-x64-vbox436-nocm - box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box - hypervisor : vagrant -CONFIG: - type: foss diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml deleted file mode 120000 index 2719644..0000000 --- a/spec/acceptance/nodesets/default.yml +++ /dev/null @@ -1 +0,0 @@ -centos-64-x64.yml \ No newline at end of file diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml new file mode 100644 index 0000000..4e2cb80 --- /dev/null +++ b/spec/acceptance/nodesets/default.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-65-x64: + roles: + - master + platform: el-6-x86_64 + box : centos-65-x64-vbox436-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box + hypervisor : vagrant +CONFIG: + type: foss -- cgit v1.2.3 From 08f7553fb66621fb816400609a034582c44c91e4 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Tue, 3 Jun 2014 11:11:08 -0400 Subject: Fixes for PE3.3. --- spec/acceptance/fqdn_rotate_spec.rb | 1 + spec/acceptance/parseyaml_spec.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb index b7f8bf8..fc8bea2 100755 --- a/spec/acceptance/fqdn_rotate_spec.rb +++ b/spec/acceptance/fqdn_rotate_spec.rb @@ -14,6 +14,7 @@ describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact( shell("if [ -f #{facts_d}/fqdn.txt ] ; then rm #{facts_d}/fqdn.txt ; fi") end it 'fqdn_rotates floats' do + shell("mkdir -p #{facts_d}") shell("echo 'fqdn=fakehost.localdomain' > #{facts_d}/fqdn.txt") pp = <<-EOS $a = ['a','b','c','d'] diff --git a/spec/acceptance/parseyaml_spec.rb b/spec/acceptance/parseyaml_spec.rb index 4b4bf3d..5819837 100755 --- a/spec/acceptance/parseyaml_spec.rb +++ b/spec/acceptance/parseyaml_spec.rb @@ -26,7 +26,7 @@ describe 'parseyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('o EOS apply_manifest(pp, :expect_failures => true) do |r| - expect(r.stderr).to match(/syntax error/) + expect(r.stderr).to match(/(syntax error|did not find expected key)/) end end -- cgit v1.2.3 From a364605f3b71b8a0857bbc2c47388f7bb9e11f82 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Tue, 3 Jun 2014 11:13:35 -0400 Subject: Merge pull request #264 from apenney/fixes-for-tests Fixes for PE3.3. --- spec/acceptance/fqdn_rotate_spec.rb | 1 + spec/acceptance/parseyaml_spec.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb index b7f8bf8..fc8bea2 100755 --- a/spec/acceptance/fqdn_rotate_spec.rb +++ b/spec/acceptance/fqdn_rotate_spec.rb @@ -14,6 +14,7 @@ describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact( shell("if [ -f #{facts_d}/fqdn.txt ] ; then rm #{facts_d}/fqdn.txt ; fi") end it 'fqdn_rotates floats' do + shell("mkdir -p #{facts_d}") shell("echo 'fqdn=fakehost.localdomain' > #{facts_d}/fqdn.txt") pp = <<-EOS $a = ['a','b','c','d'] diff --git a/spec/acceptance/parseyaml_spec.rb b/spec/acceptance/parseyaml_spec.rb index 4b4bf3d..5819837 100755 --- a/spec/acceptance/parseyaml_spec.rb +++ b/spec/acceptance/parseyaml_spec.rb @@ -26,7 +26,7 @@ describe 'parseyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('o EOS apply_manifest(pp, :expect_failures => true) do |r| - expect(r.stderr).to match(/syntax error/) + expect(r.stderr).to match(/(syntax error|did not find expected key)/) end end -- cgit v1.2.3 From 6010e9bd932560a61ffb5f955af1e3226fb8d934 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Tue, 3 Jun 2014 14:52:10 -0400 Subject: Further fixes to tests for 14.04. --- spec/acceptance/ensure_packages_spec.rb | 2 +- spec/acceptance/shuffle_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb index 145bdc5..aa7b14c 100755 --- a/spec/acceptance/ensure_packages_spec.rb +++ b/spec/acceptance/ensure_packages_spec.rb @@ -11,7 +11,7 @@ describe 'ensure_packages function', :unless => UNSUPPORTED_PLATFORMS.include?(f EOS apply_manifest(pp, :expect_changes => true) do |r| - expect(r.stdout).to match(/Package\[zsh\]\/ensure: created/) + expect(r.stdout).to match(/Package\[zsh\]\/ensure: (created|ensure changed 'purged' to 'present')/) end end it 'ensures a package already declared' diff --git a/spec/acceptance/shuffle_spec.rb b/spec/acceptance/shuffle_spec.rb index 02d1201..b840d1f 100755 --- a/spec/acceptance/shuffle_spec.rb +++ b/spec/acceptance/shuffle_spec.rb @@ -5,14 +5,14 @@ describe 'shuffle function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('ope describe 'success' do it 'shuffles arrays' do pp = <<-EOS - $a = ["the","public","art","galleries"] + $a = ["1", "2", "3", "4", "5", "6", "7", "8", "the","public","art","galleries"] # Anagram: Large picture halls, I bet $o = shuffle($a) notice(inline_template('shuffle is <%= @o.inspect %>')) EOS apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to_not match(/shuffle is \["the", "public", "art", "galleries"\]/) + expect(r.stdout).to_not match(/shuffle is \["1", "2", "3", "4", "5", "6", "7", "8", "the", "public", "art", "galleries"\]/) end end it 'shuffles strings' do -- cgit v1.2.3 From af71faa247043e01fc31ef8248304e8e20a25d6f Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Tue, 3 Jun 2014 14:53:04 -0400 Subject: Merge pull request #265 from apenney/fix-tests Further fixes to tests for 14.04. --- spec/acceptance/ensure_packages_spec.rb | 2 +- spec/acceptance/shuffle_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb index 145bdc5..aa7b14c 100755 --- a/spec/acceptance/ensure_packages_spec.rb +++ b/spec/acceptance/ensure_packages_spec.rb @@ -11,7 +11,7 @@ describe 'ensure_packages function', :unless => UNSUPPORTED_PLATFORMS.include?(f EOS apply_manifest(pp, :expect_changes => true) do |r| - expect(r.stdout).to match(/Package\[zsh\]\/ensure: created/) + expect(r.stdout).to match(/Package\[zsh\]\/ensure: (created|ensure changed 'purged' to 'present')/) end end it 'ensures a package already declared' diff --git a/spec/acceptance/shuffle_spec.rb b/spec/acceptance/shuffle_spec.rb index 02d1201..b840d1f 100755 --- a/spec/acceptance/shuffle_spec.rb +++ b/spec/acceptance/shuffle_spec.rb @@ -5,14 +5,14 @@ describe 'shuffle function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('ope describe 'success' do it 'shuffles arrays' do pp = <<-EOS - $a = ["the","public","art","galleries"] + $a = ["1", "2", "3", "4", "5", "6", "7", "8", "the","public","art","galleries"] # Anagram: Large picture halls, I bet $o = shuffle($a) notice(inline_template('shuffle is <%= @o.inspect %>')) EOS apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to_not match(/shuffle is \["the", "public", "art", "galleries"\]/) + expect(r.stdout).to_not match(/shuffle is \["1", "2", "3", "4", "5", "6", "7", "8", "the", "public", "art", "galleries"\]/) end end it 'shuffles strings' do -- cgit v1.2.3 From 197e2d7e70d6570e82d2056d89de9e5e035b5750 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 19 Jun 2014 15:38:23 -0700 Subject: (FM-1587) Fix test issues on solaris 10 - ensure_packages fails because Error: Sun packages must specify a package source - ensure_resource fails for the same reason - get_module_path fails because the modulepath is different - has_interface_with fails because the interface is lo0 not lo --- spec/acceptance/ensure_packages_spec.rb | 4 ++-- spec/acceptance/ensure_resource_spec.rb | 4 ++-- spec/acceptance/get_module_path_spec.rb | 18 ++---------------- spec/acceptance/has_interface_with_spec.rb | 6 +++++- 4 files changed, 11 insertions(+), 21 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb index aa7b14c..f3d2256 100755 --- a/spec/acceptance/ensure_packages_spec.rb +++ b/spec/acceptance/ensure_packages_spec.rb @@ -6,8 +6,8 @@ describe 'ensure_packages function', :unless => UNSUPPORTED_PLATFORMS.include?(f it 'ensure_packages a package' do apply_manifest('package { "zsh": ensure => absent, }') pp = <<-EOS - $a = "zsh" - ensure_packages($a) + $a = "rake" + ensure_packages($a,{'provider' => 'gem'}) EOS apply_manifest(pp, :expect_changes => true) do |r| diff --git a/spec/acceptance/ensure_resource_spec.rb b/spec/acceptance/ensure_resource_spec.rb index c4d8887..725f5df 100755 --- a/spec/acceptance/ensure_resource_spec.rb +++ b/spec/acceptance/ensure_resource_spec.rb @@ -6,8 +6,8 @@ describe 'ensure_resource function', :unless => UNSUPPORTED_PLATFORMS.include?(f it 'ensure_resource a package' do apply_manifest('package { "zsh": ensure => absent, }') pp = <<-EOS - $a = "zsh" - ensure_resource('package', $a) + $a = "rake" + ensure_resource('package', $a, {'provider' => 'gem'}) EOS apply_manifest(pp, :expect_changes => true) do |r| diff --git a/spec/acceptance/get_module_path_spec.rb b/spec/acceptance/get_module_path_spec.rb index 34d91fa..6ac690c 100755 --- a/spec/acceptance/get_module_path_spec.rb +++ b/spec/acceptance/get_module_path_spec.rb @@ -3,22 +3,6 @@ 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 ? { @@ -28,6 +12,8 @@ describe 'get_module_path function', :unless => UNSUPPORTED_PLATFORMS.include?(f $o = get_module_path('dne') if $o == $a { notify { 'output correct': } + } else { + notify { "failed; module path is '$o'": } } EOS diff --git a/spec/acceptance/has_interface_with_spec.rb b/spec/acceptance/has_interface_with_spec.rb index 41ae19f..7b38c95 100755 --- a/spec/acceptance/has_interface_with_spec.rb +++ b/spec/acceptance/has_interface_with_spec.rb @@ -27,7 +27,11 @@ describe 'has_interface_with function', :unless => UNSUPPORTED_PLATFORMS.include end it 'has_interface_with existing interface' do pp = <<-EOS - $a = 'lo' + if $osfamily == 'Solaris' { + $a = 'lo0' + } else { + $a = 'lo' + } $o = has_interface_with($a) notice(inline_template('has_interface_with is <%= @o.inspect %>')) EOS -- cgit v1.2.3 From 7eda161be88e4eeca44a288cb0394f51ea9e0621 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Fri, 20 Jun 2014 10:41:43 -0700 Subject: Patch ensure_* tests --- spec/acceptance/ensure_packages_spec.rb | 6 ++---- spec/acceptance/ensure_resource_spec.rb | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb index f3d2256..12da0cd 100755 --- a/spec/acceptance/ensure_packages_spec.rb +++ b/spec/acceptance/ensure_packages_spec.rb @@ -4,15 +4,13 @@ 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, }') + apply_manifest('package { "rake": ensure => absent, provider => "gem", }') pp = <<-EOS $a = "rake" ensure_packages($a,{'provider' => 'gem'}) EOS - apply_manifest(pp, :expect_changes => true) do |r| - expect(r.stdout).to match(/Package\[zsh\]\/ensure: (created|ensure changed 'purged' to 'present')/) - end + apply_manifest(pp, :expect_changes => true) end it 'ensures a package already declared' it 'takes defaults arguments' diff --git a/spec/acceptance/ensure_resource_spec.rb b/spec/acceptance/ensure_resource_spec.rb index 725f5df..2aad243 100755 --- a/spec/acceptance/ensure_resource_spec.rb +++ b/spec/acceptance/ensure_resource_spec.rb @@ -4,15 +4,13 @@ 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, }') + apply_manifest('package { "rake": ensure => absent, provider => "gem", }') pp = <<-EOS $a = "rake" ensure_resource('package', $a, {'provider' => 'gem'}) EOS - apply_manifest(pp, :expect_changes => true) do |r| - expect(r.stdout).to match(/Package\[zsh\]\/ensure: created/) - end + apply_manifest(pp, :expect_changes => true) end it 'ensures a resource already declared' it 'takes defaults arguments' -- cgit v1.2.3 From 24a6fecc78824ae411065aaca68e5250790bd778 Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Fri, 20 Jun 2014 16:39:15 -0700 Subject: Add windows Nodesets and remove Beaker from Gemfile --- spec/acceptance/nodesets/windows-2003-i386.yml | 26 ++++++++++++++++++++++ spec/acceptance/nodesets/windows-2003-x86_64.yml | 26 ++++++++++++++++++++++ spec/acceptance/nodesets/windows-2008-x86_64.yml | 26 ++++++++++++++++++++++ spec/acceptance/nodesets/windows-2008r2-x86_64.yml | 26 ++++++++++++++++++++++ spec/acceptance/nodesets/windows-2012-x86_64.yml | 26 ++++++++++++++++++++++ spec/acceptance/nodesets/windows-2012r2-x86_64.yml | 26 ++++++++++++++++++++++ 6 files changed, 156 insertions(+) create mode 100644 spec/acceptance/nodesets/windows-2003-i386.yml create mode 100644 spec/acceptance/nodesets/windows-2003-x86_64.yml create mode 100644 spec/acceptance/nodesets/windows-2008-x86_64.yml create mode 100644 spec/acceptance/nodesets/windows-2008r2-x86_64.yml create mode 100644 spec/acceptance/nodesets/windows-2012-x86_64.yml create mode 100644 spec/acceptance/nodesets/windows-2012r2-x86_64.yml (limited to 'spec/acceptance') diff --git a/spec/acceptance/nodesets/windows-2003-i386.yml b/spec/acceptance/nodesets/windows-2003-i386.yml new file mode 100644 index 0000000..47dadbd --- /dev/null +++ b/spec/acceptance/nodesets/windows-2003-i386.yml @@ -0,0 +1,26 @@ +HOSTS: + ubuntu1204: + roles: + - master + - database + - dashboard + platform: ubuntu-12.04-amd64 + template: ubuntu-1204-x86_64 + hypervisor: vcloud + win2003_i386: + roles: + - agent + - default + platform: windows-2003-i386 + template: win-2003-i386 + hypervisor: vcloud +CONFIG: + nfs_server: none + ssh: + keys: "~/.ssh/id_rsa-acceptance" + consoleport: 443 + datastore: instance0 + folder: Delivery/Quality Assurance/Enterprise/Dynamic + resourcepool: delivery/Quality Assurance/Enterprise/Dynamic + pooling_api: http://vcloud.delivery.puppetlabs.net/ + pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ diff --git a/spec/acceptance/nodesets/windows-2003-x86_64.yml b/spec/acceptance/nodesets/windows-2003-x86_64.yml new file mode 100644 index 0000000..6a884bc --- /dev/null +++ b/spec/acceptance/nodesets/windows-2003-x86_64.yml @@ -0,0 +1,26 @@ +HOSTS: + ubuntu1204: + roles: + - master + - database + - dashboard + platform: ubuntu-12.04-amd64 + template: ubuntu-1204-x86_64 + hypervisor: vcloud + win2003_x86_64: + roles: + - agent + - default + platform: windows-2003-x86_64 + template: win-2003-x86_64 + hypervisor: vcloud +CONFIG: + nfs_server: none + ssh: + keys: "~/.ssh/id_rsa-acceptance" + consoleport: 443 + datastore: instance0 + folder: Delivery/Quality Assurance/Enterprise/Dynamic + resourcepool: delivery/Quality Assurance/Enterprise/Dynamic + pooling_api: http://vcloud.delivery.puppetlabs.net/ + pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ diff --git a/spec/acceptance/nodesets/windows-2008-x86_64.yml b/spec/acceptance/nodesets/windows-2008-x86_64.yml new file mode 100644 index 0000000..ae3c11d --- /dev/null +++ b/spec/acceptance/nodesets/windows-2008-x86_64.yml @@ -0,0 +1,26 @@ +HOSTS: + ubuntu1204: + roles: + - master + - database + - dashboard + platform: ubuntu-12.04-amd64 + template: ubuntu-1204-x86_64 + hypervisor: vcloud + win2008_x86_64: + roles: + - agent + - default + platform: windows-2008-x86_64 + template: win-2008-x86_64 + hypervisor: vcloud +CONFIG: + nfs_server: none + ssh: + keys: "~/.ssh/id_rsa-acceptance" + consoleport: 443 + datastore: instance0 + folder: Delivery/Quality Assurance/Enterprise/Dynamic + resourcepool: delivery/Quality Assurance/Enterprise/Dynamic + pooling_api: http://vcloud.delivery.puppetlabs.net/ + pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ diff --git a/spec/acceptance/nodesets/windows-2008r2-x86_64.yml b/spec/acceptance/nodesets/windows-2008r2-x86_64.yml new file mode 100644 index 0000000..63923ac --- /dev/null +++ b/spec/acceptance/nodesets/windows-2008r2-x86_64.yml @@ -0,0 +1,26 @@ +HOSTS: + ubuntu1204: + roles: + - master + - database + - dashboard + platform: ubuntu-12.04-amd64 + template: ubuntu-1204-x86_64 + hypervisor: vcloud + win2008r2: + roles: + - agent + - default + platform: windows-2008r2-x86_64 + template: win-2008r2-x86_64 + hypervisor: vcloud +CONFIG: + nfs_server: none + ssh: + keys: "~/.ssh/id_rsa-acceptance" + consoleport: 443 + datastore: instance0 + folder: Delivery/Quality Assurance/Enterprise/Dynamic + resourcepool: delivery/Quality Assurance/Enterprise/Dynamic + pooling_api: http://vcloud.delivery.puppetlabs.net/ + pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ diff --git a/spec/acceptance/nodesets/windows-2012-x86_64.yml b/spec/acceptance/nodesets/windows-2012-x86_64.yml new file mode 100644 index 0000000..eaa4eca --- /dev/null +++ b/spec/acceptance/nodesets/windows-2012-x86_64.yml @@ -0,0 +1,26 @@ +HOSTS: + ubuntu1204: + roles: + - master + - database + - dashboard + platform: ubuntu-12.04-amd64 + template: ubuntu-1204-x86_64 + hypervisor: vcloud + win2012: + roles: + - agent + - default + platform: windows-2012-x86_64 + template: win-2012-x86_64 + hypervisor: vcloud +CONFIG: + nfs_server: none + ssh: + keys: "~/.ssh/id_rsa-acceptance" + consoleport: 443 + datastore: instance0 + folder: Delivery/Quality Assurance/Enterprise/Dynamic + resourcepool: delivery/Quality Assurance/Enterprise/Dynamic + pooling_api: http://vcloud.delivery.puppetlabs.net/ + pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ diff --git a/spec/acceptance/nodesets/windows-2012r2-x86_64.yml b/spec/acceptance/nodesets/windows-2012r2-x86_64.yml new file mode 100644 index 0000000..1f0ea97 --- /dev/null +++ b/spec/acceptance/nodesets/windows-2012r2-x86_64.yml @@ -0,0 +1,26 @@ +HOSTS: + ubuntu1204: + roles: + - master + - database + - dashboard + platform: ubuntu-12.04-amd64 + template: ubuntu-1204-x86_64 + hypervisor: vcloud + win2012r2: + roles: + - agent + - default + platform: windows-2012r2-x86_64 + template: win-2012r2-x86_64 + hypervisor: vcloud +CONFIG: + nfs_server: none + ssh: + keys: "~/.ssh/id_rsa-acceptance" + consoleport: 443 + datastore: instance0 + folder: Delivery/Quality Assurance/Enterprise/Dynamic + resourcepool: delivery/Quality Assurance/Enterprise/Dynamic + pooling_api: http://vcloud.delivery.puppetlabs.net/ + pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ -- cgit v1.2.3 From 4b7162896a0a4ec5dc5166c8846eb5968a3c5329 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 23 Jun 2014 13:45:06 -0700 Subject: OS X also has lo0 and can't manage user homedirs --- spec/acceptance/getparam_spec.rb | 12 ++++++------ spec/acceptance/has_interface_with_spec.rb | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/getparam_spec.rb b/spec/acceptance/getparam_spec.rb index 91fc9a0..e3e442f 100755 --- a/spec/acceptance/getparam_spec.rb +++ b/spec/acceptance/getparam_spec.rb @@ -3,18 +3,18 @@ require 'spec_helper_acceptance' describe 'getparam function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do describe 'success' do - it 'getparam a package' do + it 'getparam a notify' do pp = <<-EOS - user { "rspec": - ensure => present, - managehome => true, + notify { 'rspec': + ensure => present, + message => 'custom rspec message', } - $o = getparam(User['rspec'], 'managehome') + $o = getparam(Notify['rspec'], 'message') notice(inline_template('getparam is <%= @o.inspect %>')) EOS apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/getparam is true/) + expect(r.stdout).to match(/getparam is "custom rspec message"/) end end end diff --git a/spec/acceptance/has_interface_with_spec.rb b/spec/acceptance/has_interface_with_spec.rb index 7b38c95..99b7681 100755 --- a/spec/acceptance/has_interface_with_spec.rb +++ b/spec/acceptance/has_interface_with_spec.rb @@ -27,7 +27,7 @@ describe 'has_interface_with function', :unless => UNSUPPORTED_PLATFORMS.include end it 'has_interface_with existing interface' do pp = <<-EOS - if $osfamily == 'Solaris' { + if $osfamily == 'Solaris' or $osfamily == 'Darwin' { $a = 'lo0' } else { $a = 'lo' -- cgit v1.2.3 From 280d808eb4284daa32b81d4ac90da96a5609a625 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 23 Jun 2014 13:47:34 -0700 Subject: Augeas isn't present on windows --- spec/acceptance/validate_augeas_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/validate_augeas_spec.rb b/spec/acceptance/validate_augeas_spec.rb index aeec67a..71a4c84 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')) do +describe 'validate_augeas function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows')) do describe 'prep' do it 'installs augeas for tests' end -- cgit v1.2.3 From f7b7c4a6ece9d9e5d551ea77867289eee4cfe8e8 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 23 Jun 2014 15:13:29 -0700 Subject: Windows needs a tmpdir path --- spec/acceptance/loadyaml_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/loadyaml_spec.rb b/spec/acceptance/loadyaml_spec.rb index 944a727..1e910a9 100644 --- a/spec/acceptance/loadyaml_spec.rb +++ b/spec/acceptance/loadyaml_spec.rb @@ -1,16 +1,18 @@ #! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' +tmpdir = default.tmpdir('stdlib') + describe 'loadyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do describe 'success' do it 'loadyamls array of values' do - shell('echo "--- + shell("echo '--- aaa: 1 bbb: 2 ccc: 3 - ddd: 4" > /testyaml.yaml') + ddd: 4' > #{tmpdir}/testyaml.yaml") pp = <<-EOS - $o = loadyaml('/testyaml.yaml') + $o = loadyaml('#{tmpdir}/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 %>')) -- cgit v1.2.3 From eb507c9a5486d269ec6a36f169eb68695910bfbf Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Mon, 23 Jun 2014 23:27:59 -0700 Subject: Fixed fqdn,getparam and has_interface_with spec tests --- spec/acceptance/fqdn_rotate_spec.rb | 19 ++++++++++++++++--- spec/acceptance/getparam_spec.rb | 1 - spec/acceptance/has_interface_with_spec.rb | 10 ++++++++-- 3 files changed, 24 insertions(+), 6 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb index fc8bea2..2527c28 100755 --- a/spec/acceptance/fqdn_rotate_spec.rb +++ b/spec/acceptance/fqdn_rotate_spec.rb @@ -5,7 +5,15 @@ describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact( describe 'success' do let(:facts_d) do if fact('is_pe') == "true" - '/etc/puppetlabs/facter/facts.d' + if fact('osfamily') =~ /windows/i + if fact('kernelmajversion').to_f < 6.0 + 'C:\Documents and Settings\All Users\Application Data\PuppetLabs\facter\facts.d' + else + 'C:\ProgramData\PuppetLabs\facter\facts.d' + end + else + '/etc/puppetlabs/facter/facts.d' + end else '/etc/facter/facts.d' end @@ -13,9 +21,14 @@ describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact( after :each do shell("if [ -f #{facts_d}/fqdn.txt ] ; then rm #{facts_d}/fqdn.txt ; fi") end + before :all do + #No need to create on windows, PE creates by default + if fact('osfamily') !~ /windows/i + shell("mkdir -p #{facts_d}") + end + end it 'fqdn_rotates floats' do - shell("mkdir -p #{facts_d}") - shell("echo 'fqdn=fakehost.localdomain' > #{facts_d}/fqdn.txt") + shell("echo fqdn=fakehost.localdomain > #{facts_d}/fqdn.txt") pp = <<-EOS $a = ['a','b','c','d'] $o = fqdn_rotate($a) diff --git a/spec/acceptance/getparam_spec.rb b/spec/acceptance/getparam_spec.rb index e3e442f..b1a677e 100755 --- a/spec/acceptance/getparam_spec.rb +++ b/spec/acceptance/getparam_spec.rb @@ -6,7 +6,6 @@ describe 'getparam function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('op it 'getparam a notify' do pp = <<-EOS notify { 'rspec': - ensure => present, message => 'custom rspec message', } $o = getparam(Notify['rspec'], 'message') diff --git a/spec/acceptance/has_interface_with_spec.rb b/spec/acceptance/has_interface_with_spec.rb index 99b7681..c9decdf 100755 --- a/spec/acceptance/has_interface_with_spec.rb +++ b/spec/acceptance/has_interface_with_spec.rb @@ -5,7 +5,7 @@ describe 'has_interface_with function', :unless => UNSUPPORTED_PLATFORMS.include describe 'success' do it 'has_interface_with existing ipaddress' do pp = <<-EOS - $a = '127.0.0.1' + $a = $::ipaddress $o = has_interface_with('ipaddress', $a) notice(inline_template('has_interface_with is <%= @o.inspect %>')) EOS @@ -29,7 +29,13 @@ describe 'has_interface_with function', :unless => UNSUPPORTED_PLATFORMS.include pp = <<-EOS if $osfamily == 'Solaris' or $osfamily == 'Darwin' { $a = 'lo0' - } else { + }elsif $osfamily == 'windows' { + $a = $::kernelmajversion ? { + /6\.(2|3|4)/ => 'Ethernet0', + /6\.(0|1)/ => 'Local_Area_Connection', + /5\.(1|2)/ => undef, #Broken current in facter + } + }else { $a = 'lo' } $o = has_interface_with($a) -- cgit v1.2.3 From ca35be6480a5935a4b0e0721bdb726934269e433 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Tue, 24 Jun 2014 11:37:34 -0700 Subject: Fix pe facts and slashes --- spec/acceptance/fqdn_rotate_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb index 2527c28..bc02eb6 100755 --- a/spec/acceptance/fqdn_rotate_spec.rb +++ b/spec/acceptance/fqdn_rotate_spec.rb @@ -4,12 +4,12 @@ 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" + if fact('is_pe', '--puppet') == "true" if fact('osfamily') =~ /windows/i if fact('kernelmajversion').to_f < 6.0 - 'C:\Documents and Settings\All Users\Application Data\PuppetLabs\facter\facts.d' + 'C:\\Documents and Settings\\All Users\\Application Data\\PuppetLabs\\facter\\facts.d' else - 'C:\ProgramData\PuppetLabs\facter\facts.d' + 'C:\\ProgramData\\PuppetLabs\\facter\\facts.d' end else '/etc/puppetlabs/facter/facts.d' -- cgit v1.2.3 From 0cac9fd0489180d7b6ae59ce67334dc34ddcc961 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Tue, 24 Jun 2014 15:03:58 -0700 Subject: Not enough escape velocity --- spec/acceptance/fqdn_rotate_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb index bc02eb6..d56c2b1 100755 --- a/spec/acceptance/fqdn_rotate_spec.rb +++ b/spec/acceptance/fqdn_rotate_spec.rb @@ -7,9 +7,9 @@ describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact( if fact('is_pe', '--puppet') == "true" if fact('osfamily') =~ /windows/i if fact('kernelmajversion').to_f < 6.0 - 'C:\\Documents and Settings\\All Users\\Application Data\\PuppetLabs\\facter\\facts.d' + 'C:/Documents and Settings/All Users/Application Data/PuppetLabs/facter/facts.d' else - 'C:\\ProgramData\\PuppetLabs\\facter\\facts.d' + 'C:/ProgramData/PuppetLabs/facter/facts.d' end else '/etc/puppetlabs/facter/facts.d' -- cgit v1.2.3 From 05b79dcabbdb67aab322fa6e12e77532ab044749 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Wed, 25 Jun 2014 10:16:06 -0700 Subject: Disable windows network stuff and quote path --- spec/acceptance/fqdn_rotate_spec.rb | 2 +- spec/acceptance/has_interface_with_spec.rb | 2 +- spec/acceptance/has_ip_address_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb index d56c2b1..ee2afb5 100755 --- a/spec/acceptance/fqdn_rotate_spec.rb +++ b/spec/acceptance/fqdn_rotate_spec.rb @@ -28,7 +28,7 @@ describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact( end end it 'fqdn_rotates floats' do - shell("echo fqdn=fakehost.localdomain > #{facts_d}/fqdn.txt") + shell("echo fqdn=fakehost.localdomain > '#{facts_d}/fqdn.txt'") pp = <<-EOS $a = ['a','b','c','d'] $o = fqdn_rotate($a) diff --git a/spec/acceptance/has_interface_with_spec.rb b/spec/acceptance/has_interface_with_spec.rb index c9decdf..b09199a 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')) do +describe 'has_interface_with function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows')) 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 7d5fd87..50eb8f5 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')) do +describe 'has_ip_address function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows')) do describe 'success' do it 'has_ip_address existing ipaddress' do pp = <<-EOS -- cgit v1.2.3 From 2fefd9c1e0249daebd327ca6e1ee3d791257e663 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Wed, 25 Jun 2014 18:00:57 -0700 Subject: Sync files --- spec/acceptance/nodesets/centos-59-x64.yml | 10 ++++++++++ spec/acceptance/nodesets/centos-65-x64.yml | 10 ++++++++++ spec/acceptance/nodesets/ubuntu-server-1404-x64.yml | 11 +++++++++++ 3 files changed, 31 insertions(+) create mode 100644 spec/acceptance/nodesets/centos-59-x64.yml create mode 100644 spec/acceptance/nodesets/centos-65-x64.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-1404-x64.yml (limited to 'spec/acceptance') diff --git a/spec/acceptance/nodesets/centos-59-x64.yml b/spec/acceptance/nodesets/centos-59-x64.yml new file mode 100644 index 0000000..2ad90b8 --- /dev/null +++ b/spec/acceptance/nodesets/centos-59-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-59-x64: + roles: + - master + platform: el-5-x86_64 + box : centos-59-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: git diff --git a/spec/acceptance/nodesets/centos-65-x64.yml b/spec/acceptance/nodesets/centos-65-x64.yml new file mode 100644 index 0000000..4e2cb80 --- /dev/null +++ b/spec/acceptance/nodesets/centos-65-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-65-x64: + roles: + - master + platform: el-6-x86_64 + box : centos-65-x64-vbox436-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box + hypervisor : vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 0000000..cba1cd0 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-1404-x64: + roles: + - master + platform: ubuntu-14.04-amd64 + box : puppetlabs/ubuntu-14.04-64-nocm + box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor : vagrant +CONFIG: + log_level : debug + type: git -- cgit v1.2.3 From b93f71f0ced2cb87e4817e2eb4858fb1e47f3901 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 26 Jun 2014 13:12:39 -0700 Subject: has_ip_network doesn't work on windows either --- spec/acceptance/has_ip_network_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/has_ip_network_spec.rb b/spec/acceptance/has_ip_network_spec.rb index 692eaf9..1628746 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')) do +describe 'has_ip_network function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows')) do describe 'success' do it 'has_ip_network existing ipaddress' do pp = <<-EOS -- cgit v1.2.3 From 1b893ff653d64ca8a923ab37a0c222fc35c0eb5f Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 26 Jun 2014 13:17:07 -0700 Subject: Need quotes for spaces in path --- spec/acceptance/fqdn_rotate_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb index ee2afb5..c37b35a 100755 --- a/spec/acceptance/fqdn_rotate_spec.rb +++ b/spec/acceptance/fqdn_rotate_spec.rb @@ -19,12 +19,12 @@ describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact( end end after :each do - shell("if [ -f #{facts_d}/fqdn.txt ] ; then rm #{facts_d}/fqdn.txt ; fi") + shell("if [ -f '#{facts_d}/fqdn.txt' ] ; then rm '#{facts_d}/fqdn.txt' ; fi") end before :all do #No need to create on windows, PE creates by default if fact('osfamily') !~ /windows/i - shell("mkdir -p #{facts_d}") + shell("mkdir -p '#{facts_d}'") end end it 'fqdn_rotates floats' do -- cgit v1.2.3 From ec607827ad659431341383b92cee20cfd0603203 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 26 Jun 2014 13:55:57 -0700 Subject: Gotta single quote yer typewriter buttons --- spec/acceptance/chop_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/chop_spec.rb b/spec/acceptance/chop_spec.rb index dbc28da..a16a710 100755 --- a/spec/acceptance/chop_spec.rb +++ b/spec/acceptance/chop_spec.rb @@ -19,7 +19,7 @@ describe 'chop function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operat end it 'should eat the last two characters of \r\n' do - pp = <<-EOS + pp = <<-'EOS' $input = "test\r\n" if size($input) != 6 { fail("Size of ${input} is not 6.") -- cgit v1.2.3 From 07462f2c3619e4d6589b364f11b01ea9ca37ac61 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Tue, 8 Jul 2014 13:45:36 -0700 Subject: AIX has no facter network support These functions take advantage of IP fact information and AIX does not appear to support dynamic interface detection in facter. --- spec/acceptance/has_interface_with_spec.rb | 2 +- spec/acceptance/has_ip_address_spec.rb | 2 +- spec/acceptance/has_ip_network_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/has_interface_with_spec.rb b/spec/acceptance/has_interface_with_spec.rb index b09199a..9590193 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')) do +describe 'has_interface_with function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (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 50eb8f5..149a10d 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')) do +describe 'has_ip_address function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (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 1628746..7d2f34e 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')) do +describe 'has_ip_network function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do describe 'success' do it 'has_ip_network existing ipaddress' do pp = <<-EOS -- cgit v1.2.3 From 51f1d574d92cf686ac79e57e69d8aff31caf2925 Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Tue, 28 Oct 2014 15:27:24 -0700 Subject: Fix testcases for Future Parser and resolve issue with values_at in assuming that it was dealing with a string --- spec/acceptance/abs_spec.rb | 4 ++-- spec/acceptance/any2array_spec.rb | 4 ++-- spec/acceptance/bool2num_spec.rb | 12 ++++++------ spec/acceptance/count_spec.rb | 4 ++-- spec/acceptance/ensure_packages_spec.rb | 2 +- spec/acceptance/merge_spec.rb | 4 ++-- spec/acceptance/type_spec.rb | 2 +- spec/acceptance/validate_cmd_spec.rb | 2 +- spec/acceptance/values_spec.rb | 6 +++++- spec/acceptance/zip_spec.rb | 28 ++++++++++++++++++++-------- 10 files changed, 42 insertions(+), 26 deletions(-) (limited to 'spec/acceptance') 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..53c1035 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('operatingsystem') != 'windows') do describe 'success' do it 'ensure_packages 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..a899a1d 100755 --- a/spec/acceptance/validate_cmd_spec.rb +++ b/spec/acceptance/validate_cmd_spec.rb @@ -37,7 +37,7 @@ 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/) 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 -- cgit v1.2.3 From 5497f83507fcaf24accff26d08ae61d9e7e36673 Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Tue, 28 Oct 2014 15:35:56 -0700 Subject: Fix logic issue with not including windows for testing ensure_packages as ruby and gem are not on the install path --- spec/acceptance/ensure_packages_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb index 53c1035..9d39220 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')) || fact('operatingsystem') != 'windows') do +describe 'ensure_packages function', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) && fact('operatingsystem') != 'windows') do describe 'success' do it 'ensure_packages a package' do apply_manifest('package { "rake": ensure => absent, provider => "gem", }') -- cgit v1.2.3 From 2b1cc82d2423c815f5aee8807e266c5e16495c36 Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Tue, 28 Oct 2014 16:43:15 -0700 Subject: Add windows test exclusion to ensure_resource --- spec/acceptance/ensure_resource_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/ensure_resource_spec.rb b/spec/acceptance/ensure_resource_spec.rb index 2aad243..c3d72fc 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", }') -- cgit v1.2.3 From 6c7da72c0fa6b5e0ed3e5e2d5c80ff27f1e99dee Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Wed, 29 Oct 2014 20:03:07 -0700 Subject: Fix validate_cmd, previous addition of SystemCallError only works for Puppet 3.7, previous version throw different exception. Wrapping in generic Exception catch all --- spec/acceptance/validate_cmd_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/validate_cmd_spec.rb b/spec/acceptance/validate_cmd_spec.rb index a899a1d..5ac66fd 100755 --- a/spec/acceptance/validate_cmd_spec.rb +++ b/spec/acceptance/validate_cmd_spec.rb @@ -40,7 +40,9 @@ describe 'validate_cmd function', :unless => UNSUPPORTED_PLATFORMS.include?(fact 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 -- cgit v1.2.3 From 26e864f22457de1291f06b0086db7afc8d6dcfeb Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Tue, 4 Nov 2014 10:42:34 -0800 Subject: Fix the unless for test cases on ensure_package and ensure_resource Conflicts: spec/acceptance/ensure_packages_spec.rb spec/acceptance/ensure_resource_spec.rb --- spec/acceptance/ensure_packages_spec.rb | 2 +- spec/acceptance/ensure_resource_spec.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb index 53c1035..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')) || fact('operatingsystem') != 'windows') 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..26409fe 100755 --- a/spec/acceptance/ensure_resource_spec.rb +++ b/spec/acceptance/ensure_resource_spec.rb @@ -1,7 +1,8 @@ #! /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", }') -- cgit v1.2.3 From f19aea5a75998da95617fadce7a50aee65022d3b Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Wed, 29 Oct 2014 22:02:13 -0700 Subject: MODULES-1413 Ability to for future parser to use member with FixNum types --- spec/acceptance/member_spec.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'spec/acceptance') diff --git a/spec/acceptance/member_spec.rb b/spec/acceptance/member_spec.rb index b467dbb..fe75a07 100755 --- a/spec/acceptance/member_spec.rb +++ b/spec/acceptance/member_spec.rb @@ -2,6 +2,13 @@ require 'spec_helper_acceptance' describe 'member function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + shared_examples 'item found' do + it 'should output correctly' do + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + end describe 'success' do it 'members arrays' do pp = <<-EOS @@ -18,8 +25,29 @@ describe 'member function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('oper expect(r.stdout).to match(/Notice: output correct/) end end + describe 'members array of integers' do + it_should_behave_like 'item found' do + let(:pp) { <<-EOS + if member( [1,2,3,4], 4 ){ + notify { 'output correct': } + } + EOS + } + end + end + describe 'members of mixed array' do + it_should_behave_like 'item found' do + let(:pp) { <<-EOS + if member( ['a','4',3], 'a' ){ + notify { 'output correct': } +} + EOS + } + end + end it 'members arrays without members' end + describe 'failure' do it 'handles improper argument counts' end -- cgit v1.2.3 From 992ed8ffa8a716463be6a3520eb908cd12ca2048 Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Mon, 3 Nov 2014 09:30:34 -0800 Subject: Remove windows from ensure_package and ensure_resource testing --- spec/acceptance/ensure_packages_spec.rb | 2 +- spec/acceptance/ensure_resource_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb index 3651f29..ca4b249 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')) || fact('osfamily') == 'windows') 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 f1bfa54..c3d72fc 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')) || fact('osfamily') == 'windows') 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", }') -- cgit v1.2.3 From 970141e36aa454bc557d44c1962129afef39d4f2 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Tue, 11 Nov 2014 10:46:01 -0800 Subject: Correct type() logic It should NOT run if the future parser is enabled --- spec/acceptance/type_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/type_spec.rb b/spec/acceptance/type_spec.rb index 15fa217..67e3248 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')) || !(is_future_parser_enabled?)) do +describe 'type function', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) || is_future_parser_enabled?) do describe 'success' do it 'types arrays' do pp = <<-EOS -- cgit v1.2.3 From 3584485902c83bbfbc7417b122fe73f80bcd1630 Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Tue, 11 Nov 2014 15:33:43 -0800 Subject: Fix exclude windows test on ensure_package Update to fix ensure_resource as well --- spec/acceptance/ensure_packages_spec.rb | 2 +- spec/acceptance/ensure_resource_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb index ca4b249..aedcfb5 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')) && fact('osfamily') != 'windows') do +describe 'ensure_packages function', :unless => fact('osfamily') =~ /windows/i 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 c3d72fc..1cee53d 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')) && fact('osfamily') != 'windows') do +describe 'ensure_resource function', :unless => fact('osfamily') =~ /windows/i do describe 'success' do it 'ensure_resource a package' do apply_manifest('package { "rake": ensure => absent, provider => "gem", }') -- cgit v1.2.3 From 7c570f75a5b88b1eb057bce3f7c4cad9cac83496 Mon Sep 17 00:00:00 2001 From: Peter Souter Date: Thu, 4 Dec 2014 14:15:03 +0000 Subject: (MODULES-444) Acceptance test for primitives `concat` should be able to concat arrays and primitives --- spec/acceptance/concat_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'spec/acceptance') diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index 7bda365..0d5e831 100755 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb @@ -12,6 +12,17 @@ describe 'concat function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('oper } EOS + apply_manifest(pp, :catch_failures => true) + end + it 'should concat arrays and primitives to array' do + pp = <<-EOS + $output = concat(['1','2','3'],'4','5','6',['7','8','9']) + validate_array($output) + if size($output) != 9 { + fail("${output} should have 9 elements.") + } + EOS + apply_manifest(pp, :catch_failures => true) end end -- cgit v1.2.3 From 5e49c504580bf06353c841c51f1319a5bda893a8 Mon Sep 17 00:00:00 2001 From: Peter Souter Date: Thu, 4 Dec 2014 14:15:33 +0000 Subject: (MODULES-444) Acceptance for multiple arrays Acceptance test to take multiple arrays for concatenation --- spec/acceptance/concat_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'spec/acceptance') diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index 0d5e831..caf2f7d 100755 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb @@ -23,6 +23,17 @@ describe 'concat function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('oper } EOS + apply_manifest(pp, :catch_failures => true) + end + it 'should concat multiple arrays to one' do + pp = <<-EOS + $output = concat(['1','2','3'],['4','5','6'],['7','8','9']) + validate_array($output) + if size($output) != 6 { + fail("${output} should have 9 elements.") + } + EOS + apply_manifest(pp, :catch_failures => true) end end -- cgit v1.2.3 From 31a6d894107f8f2ef4e0aec081f505d153e6297c Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Thu, 18 Dec 2014 16:20:02 -0800 Subject: Fix bad check in test --- spec/acceptance/concat_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index caf2f7d..06b649f 100755 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb @@ -29,7 +29,7 @@ describe 'concat function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('oper pp = <<-EOS $output = concat(['1','2','3'],['4','5','6'],['7','8','9']) validate_array($output) - if size($output) != 6 { + if size($output) != 9 { fail("${output} should have 9 elements.") } EOS -- cgit v1.2.3 From bfb526899f215f3fde98ff00cf5f63aa51e657db Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Tue, 13 Jan 2015 17:21:28 -0800 Subject: Change all to each The existence of this directory is behavior for each test, but will also stop rspec 3 from complaining. --- spec/acceptance/fqdn_rotate_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb index c37b35a..753068b 100755 --- a/spec/acceptance/fqdn_rotate_spec.rb +++ b/spec/acceptance/fqdn_rotate_spec.rb @@ -21,7 +21,7 @@ describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact( after :each do shell("if [ -f '#{facts_d}/fqdn.txt' ] ; then rm '#{facts_d}/fqdn.txt' ; fi") end - before :all do + before :each do #No need to create on windows, PE creates by default if fact('osfamily') !~ /windows/i shell("mkdir -p '#{facts_d}'") -- cgit v1.2.3