File tree Expand file tree Collapse file tree
spec/unit/puppet/parser/functions Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env ruby -S rspec
2+ require 'spec_helper'
3+
4+ describe "the bool2str function" do
5+ let ( :scope ) { PuppetlabsSpec ::PuppetInternals . scope }
6+
7+ it "should exist" do
8+ Puppet ::Parser ::Functions . function ( "bool2str" ) . should == "function_bool2str"
9+ end
10+
11+ it "should raise a ParseError if there is less than 1 arguments" do
12+ lambda { scope . function_bool2str ( [ ] ) } . should ( raise_error ( Puppet ::ParseError ) )
13+ end
14+
15+ it "should convert true to 'true'" do
16+ result = scope . function_bool2str ( [ true ] )
17+ result . should ( eq ( 'true' ) )
18+ end
19+
20+ it "should convert true to a string" do
21+ result = scope . function_bool2str ( [ true ] )
22+ result . class . should ( eq ( String ) )
23+ end
24+
25+ it "should convert false to 'false'" do
26+ result = scope . function_bool2str ( [ false ] )
27+ result . should ( eq ( 'false' ) )
28+ end
29+
30+ it "should convert false to a string" do
31+ result = scope . function_bool2str ( [ false ] )
32+ result . class . should ( eq ( String ) )
33+ end
34+ end
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env ruby -S rspec
2+ require 'spec_helper'
3+
4+ describe "the camelcase function" do
5+ let ( :scope ) { PuppetlabsSpec ::PuppetInternals . scope }
6+
7+ it "should exist" do
8+ Puppet ::Parser ::Functions . function ( "camelcase" ) . should == "function_camelcase"
9+ end
10+
11+ it "should raise a ParseError if there is less than 1 arguments" do
12+ lambda { scope . function_camelcase ( [ ] ) } . should ( raise_error ( Puppet ::ParseError ) )
13+ end
14+
15+ it "should capitalize the beginning of a normal string" do
16+ result = scope . function_camelcase ( [ "abc" ] )
17+ result . should ( eq ( "Abc" ) )
18+ end
19+
20+ it "should camelcase an underscore-delimited string" do
21+ result = scope . function_camelcase ( [ "aa_bb_cc" ] )
22+ result . should ( eq ( "AaBbCc" ) )
23+ end
24+ end
You can’t perform that action at this time.
0 commit comments