time_spec.rb 959 B

123456789101112131415161718192021
  1. require 'spec_helper'
  2. describe 'time' do
  3. it { is_expected.not_to eq(nil) }
  4. it { is_expected.to run.with_params('a', '').and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
  5. context 'when running at a specific time' do
  6. before(:each) do
  7. # get a value before stubbing the function
  8. test_time = Time.utc(2006, 10, 13, 8, 15, 11)
  9. Time.expects(:new).with.returns(test_time).once
  10. end
  11. it { is_expected.to run.with_params.and_return(1_160_727_311) }
  12. it { is_expected.to run.with_params('').and_return(1_160_727_311) }
  13. it { is_expected.to run.with_params([]).and_return(1_160_727_311) }
  14. it { is_expected.to run.with_params({}).and_return(1_160_727_311) }
  15. it { is_expected.to run.with_params('foo').and_return(1_160_727_311) }
  16. it { is_expected.to run.with_params('UTC').and_return(1_160_727_311) }
  17. it { is_expected.to run.with_params('America/New_York').and_return(1_160_727_311) }
  18. end
  19. end