1 #! /usr/bin/env ruby -S rspec
4 describe "the lstrip function" do
5 let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
8 expect(Puppet::Parser::Functions.function("lstrip")).to eq("function_lstrip")
11 it "should raise a ParseError if there is less than 1 arguments" do
12 expect { scope.function_lstrip([]) }.to( raise_error(Puppet::ParseError))
15 it "should lstrip a string" do
16 result = scope.function_lstrip([" asdf"])
17 expect(result).to(eq('asdf'))
20 it "should accept objects which extend String" do
21 class AlsoString < String
24 value = AlsoString.new(" asdf")
25 result = scope.function_lstrip([value])
26 result.should(eq("asdf"))