4 describe "the strftime function" do
6 Puppet::Parser::Functions.autoloader.loadall
10 @scope = Puppet::Parser::Scope.new
14 Puppet::Parser::Functions.function("strftime").should == "function_strftime"
17 it "should raise a ParseError if there is less than 1 arguments" do
18 lambda { @scope.function_strftime([]) }.should( raise_error(Puppet::ParseError))
21 it "using %s should be higher then when I wrote this test" do
22 result = @scope.function_strftime(["%s"])
23 result.to_i.should(be > 1311953157)
26 it "using %s should be lower then 1.5 trillion" do
27 result = @scope.function_strftime(["%s"])
28 result.to_i.should(be < 1500000000)
31 it "should return a date when given %Y-%m-%d" do
32 result = @scope.function_strftime(["%Y-%m-%d"])
33 result.should =~ /^\d{4}-\d{2}-\d{2}$/