]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/stdlib/spec/functions/strftime_spec.rb
upgrade to stdlib 4.6.1
[dsa-puppet.git] / 3rdparty / modules / stdlib / spec / functions / strftime_spec.rb
1 #! /usr/bin/env ruby -S rspec
2 require 'spec_helper'
3
4 describe "the strftime function" do
5   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6
7   it "should exist" do
8     expect(Puppet::Parser::Functions.function("strftime")).to eq("function_strftime")
9   end
10
11   it "should raise a ParseError if there is less than 1 arguments" do
12     expect { scope.function_strftime([]) }.to( raise_error(Puppet::ParseError))
13   end
14
15   it "using %s should be higher then when I wrote this test" do
16     result = scope.function_strftime(["%s"])
17     expect(result.to_i).to(be > 1311953157)
18   end
19
20   it "using %s should be lower then 1.5 trillion" do
21     result = scope.function_strftime(["%s"])
22     expect(result.to_i).to(be < 1500000000)
23   end
24
25   it "should return a date when given %Y-%m-%d" do
26     result = scope.function_strftime(["%Y-%m-%d"])
27     expect(result).to match(/^\d{4}-\d{2}-\d{2}$/)
28   end
29 end