time_spec.rb 853 B

1234567891011121314151617181920212223242526272829303132
  1. require 'spec_helper_acceptance'
  2. describe 'time function' do
  3. describe 'success' do
  4. pp1 = <<-DOC
  5. $o = time()
  6. notice(inline_template('time is <%= @o.inspect %>'))
  7. DOC
  8. it 'gives the time' do
  9. apply_manifest(pp1, :catch_failures => true) do |r|
  10. m = r.stdout.match(%r{time is (\d+)\D})
  11. # When I wrote this test
  12. expect(Integer(m[1])).to be > 1_398_894_170
  13. end
  14. end
  15. pp2 = <<-DOC
  16. $o = time('UTC')
  17. notice(inline_template('time is <%= @o.inspect %>'))
  18. DOC
  19. it 'takes a timezone argument' do
  20. apply_manifest(pp2, :catch_failures => true) do |r|
  21. m = r.stdout.match(%r{time is (\d+)\D})
  22. expect(Integer(m[1])).to be > 1_398_894_170
  23. end
  24. end
  25. end
  26. describe 'failure' do
  27. it 'handles more arguments'
  28. it 'handles invalid timezones'
  29. end
  30. end