1 #! /usr/bin/env ruby -S rspec
4 describe "the strip function" do
5 let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
7 expect(Puppet::Parser::Functions.function("strip")).to eq("function_strip")
10 it "should raise a ParseError if there is less than 1 arguments" do
11 expect { scope.function_strip([]) }.to( raise_error(Puppet::ParseError))
14 it "should strip a string" do
15 result = scope.function_strip([" ab cd "])
16 expect(result).to(eq('ab cd'))
19 it "should accept objects which extend String" do
20 class AlsoString < String
23 value = AlsoString.new(' as df ')
24 result = scope.function_strip([value])
25 result.should(eq('as df'))