puppetlabs-stdlib/spec/functions/upcase_spec.rb

25 lines
664 B
Ruby
Raw Normal View History

#! /usr/bin/env ruby -S rspec
require 'spec_helper'
describe "the upcase function" do
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
it "should exist" do
Puppet::Parser::Functions.function("upcase").should == "function_upcase"
end
it "should raise a ParseError if there is less than 1 arguments" do
lambda { scope.function_upcase([]) }.should( raise_error(Puppet::ParseError))
end
2011-07-24 01:39:17 +02:00
it "should upcase a string" do
result = scope.function_upcase(["abc"])
2011-07-24 01:39:17 +02:00
result.should(eq('ABC'))
end
2011-07-28 16:44:26 +02:00
it "should do nothing if a string is already upcase" do
result = scope.function_upcase(["ABC"])
2011-07-28 16:44:26 +02:00
result.should(eq('ABC'))
end
end