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