]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/stdlib/spec/functions/min_spec.rb
upgrade to stdlib 4.6.1
[dsa-puppet.git] / 3rdparty / modules / stdlib / spec / functions / min_spec.rb
1 #! /usr/bin/env ruby -S rspec
2
3 require 'spec_helper'
4
5 describe "the min function" do
6   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
7
8   it "should exist" do
9     expect(Puppet::Parser::Functions.function("min")).to eq("function_min")
10   end
11
12   it "should raise a ParseError if there is less than 1 arguments" do
13     expect { scope.function_min([]) }.to( raise_error(Puppet::ParseError))
14   end
15
16   it "should be able to compare strings" do
17     expect(scope.function_min(["albatross","dog","horse"])).to(eq("albatross"))
18   end
19
20   it "should be able to compare numbers" do
21     expect(scope.function_min([6,8,4])).to(eq(4))
22   end
23
24   it "should be able to compare a number with a stringified number" do
25     expect(scope.function_min([1,"2"])).to(eq(1))
26   end
27 end