2011-06-29 22:21:55 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-06-01 13:21:59 +02:00
|
|
|
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) }
|
2011-06-29 22:21:55 +02:00
|
|
|
|
2015-06-01 13:21:59 +02:00
|
|
|
context 'when running at a specific time' do
|
|
|
|
before(:each) {
|
|
|
|
# get a value before stubbing the function
|
2015-06-04 18:40:52 +02:00
|
|
|
test_time = Time.utc(2006, 10, 13, 8, 15, 11)
|
2015-06-01 13:21:59 +02:00
|
|
|
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) }
|
2015-06-04 18:40:52 +02:00
|
|
|
it { is_expected.to run.with_params('America/New_York').and_return(1160727311) }
|
2011-07-29 21:57:10 +02:00
|
|
|
end
|
2011-06-29 22:21:55 +02:00
|
|
|
end
|