ad4ca4cc34
The time() function takes an argument of a timezone, and always returns time in epoch format. The epoch format is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds. This means that it is universally the same regardless of timezones. I don't know what the timezone argument is supposed to do, and it is not documented. So lets just make 1.8.7 work like > 1.8.7
21 lines
937 B
Ruby
Executable file
21 lines
937 B
Ruby
Executable file
require 'spec_helper'
|
|
|
|
describe 'time' do
|
|
it { is_expected.not_to eq(nil) }
|
|
it { is_expected.to run.with_params('a', '').and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
|
|
|
|
context 'when running at a specific time' do
|
|
before(:each) {
|
|
# get a value before stubbing the function
|
|
test_time = Time.utc(2006, 10, 13, 8, 15, 11)
|
|
Time.expects(:new).with().returns(test_time).once
|
|
}
|
|
it { is_expected.to run.with_params().and_return(1160727311) }
|
|
it { is_expected.to run.with_params('').and_return(1160727311) }
|
|
it { is_expected.to run.with_params([]).and_return(1160727311) }
|
|
it { is_expected.to run.with_params({}).and_return(1160727311) }
|
|
it { is_expected.to run.with_params('foo').and_return(1160727311) }
|
|
it { is_expected.to run.with_params('UTC').and_return(1160727311) }
|
|
it { is_expected.to run.with_params('America/New_York').and_return(1160727311) }
|
|
end
|
|
end
|