1 #! /usr/bin/env ruby -S rspec
4 describe "the squeeze function" do
5 let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
8 expect(Puppet::Parser::Functions.function("squeeze")).to eq("function_squeeze")
11 it "should raise a ParseError if there is less than 2 arguments" do
12 expect { scope.function_squeeze([]) }.to( raise_error(Puppet::ParseError))
15 it "should squeeze a string" do
16 result = scope.function_squeeze(["aaabbbbcccc"])
17 expect(result).to(eq('abc'))
20 it "should squeeze all elements in an array" do
21 result = scope.function_squeeze([["aaabbbbcccc","dddfff"]])
22 expect(result).to(eq(['abc','df']))