]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/stdlib/spec/functions/strip_spec.rb
upgrade to stdlib 4.6.1
[dsa-puppet.git] / 3rdparty / modules / stdlib / spec / functions / strip_spec.rb
1 #! /usr/bin/env ruby -S rspec
2 require 'spec_helper'
3
4 describe "the strip function" do
5   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6   it "should exist" do
7     expect(Puppet::Parser::Functions.function("strip")).to eq("function_strip")
8   end
9
10   it "should raise a ParseError if there is less than 1 arguments" do
11     expect { scope.function_strip([]) }.to( raise_error(Puppet::ParseError))
12   end
13
14   it "should strip a string" do
15     result = scope.function_strip([" ab cd "])
16     expect(result).to(eq('ab cd'))
17   end
18
19   it "should accept objects which extend String" do
20     class AlsoString < String
21     end
22
23     value = AlsoString.new(' as df ')
24     result = scope.function_strip([value])
25     result.should(eq('as df'))
26   end
27 end