summaryrefslogtreecommitdiff
path: root/spec/unit/puppet/parser
diff options
context:
space:
mode:
authorRichard Soderberg <rsoderberg@mozilla.com>2013-03-26 15:45:40 -0700
committerRichard Soderberg <rsoderberg@mozilla.com>2013-03-26 15:46:55 -0700
commit88a93ac6cdf38045e1cf29325a70e5e4143016b3 (patch)
tree528c93aaa1c89dbdf1205fe4a69965de2d3d0874 /spec/unit/puppet/parser
parent05273419e1c8b34115ede15b1d8a8739f6a0db00 (diff)
add suffix function to accompany the prefix function
Diffstat (limited to 'spec/unit/puppet/parser')
-rw-r--r--spec/unit/puppet/parser/functions/suffix_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/unit/puppet/parser/functions/suffix_spec.rb b/spec/unit/puppet/parser/functions/suffix_spec.rb
new file mode 100644
index 0000000..c28f719
--- /dev/null
+++ b/spec/unit/puppet/parser/functions/suffix_spec.rb
@@ -0,0 +1,19 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the suffix function" do
+ let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+ it "should exist" do
+ Puppet::Parser::Functions.function("suffix").should == "function_suffix"
+ end
+
+ it "should raise a ParseError if there is less than 1 arguments" do
+ lambda { scope.function_suffix([]) }.should( raise_error(Puppet::ParseError))
+ end
+
+ it "should return a suffixed array" do
+ result = scope.function_suffix([['a','b','c'], 'p'])
+ result.should(eq(['ap','bp','cp']))
+ end
+end