Mercurial > repos > other > Puppet
comparison modules/stdlib/spec/functions/squeeze_spec.rb @ 37:addb0ea390a1 puppet-3.6
Update Puppet "stdlib" module
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 14 Mar 2015 20:09:45 +0000 |
parents | |
children | c42fb28cff86 |
comparison
equal
deleted
inserted
replaced
36:37675581a273 | 37:addb0ea390a1 |
---|---|
1 #! /usr/bin/env ruby -S rspec | |
2 require 'spec_helper' | |
3 | |
4 describe "the squeeze function" do | |
5 let(:scope) { PuppetlabsSpec::PuppetInternals.scope } | |
6 | |
7 it "should exist" do | |
8 expect(Puppet::Parser::Functions.function("squeeze")).to eq("function_squeeze") | |
9 end | |
10 | |
11 it "should raise a ParseError if there is less than 2 arguments" do | |
12 expect { scope.function_squeeze([]) }.to( raise_error(Puppet::ParseError)) | |
13 end | |
14 | |
15 it "should squeeze a string" do | |
16 result = scope.function_squeeze(["aaabbbbcccc"]) | |
17 expect(result).to(eq('abc')) | |
18 end | |
19 | |
20 it "should squeeze all elements in an array" do | |
21 result = scope.function_squeeze([["aaabbbbcccc","dddfff"]]) | |
22 expect(result).to(eq(['abc','df'])) | |
23 end | |
24 end |