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/suffix_spec.rb | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 spec/acceptance/suffix_spec.rb (limited to 'spec/acceptance/suffix_spec.rb') 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 -- cgit v1.2.3