Sha256: 25fbad9c373a5a3ceb0b7413fd6ecc83d91de4fc80290b6de2e883bca52fb7bb

Contents?: true

Size: 1006 Bytes

Versions: 1

Compression:

Stored size: 1006 Bytes

Contents

#
# Specifying rufus-scheduler
#
# Sun Jun  1 05:52:24 JST 2014
#

require 'spec_helper'


describe 'basics' do

  def tts(time)

    time.strftime('%Y-%m-%d %H:%M:%S %z') + (time.dst? ? ' dst' : '')
  end

  describe 'Time.new' do

    it 'accepts a timezone final argument' do

      pending if jruby? or ruby18?

      expect(
        tts(Time.new(2014, 1, 1, 1, 0, 0, '+01:00'))
      ).to eq('2014-01-01 01:00:00 +0100')
      expect(
        tts(Time.new(2014, 8, 1, 1, 0, 0, '+01:00'))
      ).to eq('2014-08-01 01:00:00 +0100')
      expect(
        tts(Time.new(2014, 8, 1, 1, 0, 0, '+01:00'))
      ).to eq('2014-08-01 01:00:00 +0100')
    end
  end

  describe 'Time.local' do

    it 'works as expected' do

      expect(
        tts(in_zone('Europe/Berlin') { Time.local(2014, 1, 1, 1, 0, 0) })
      ).to eq('2014-01-01 01:00:00 +0100')
      expect(
        tts(in_zone('Europe/Berlin') { Time.local(2014, 8, 1, 1, 0, 0) })
      ).to eq('2014-08-01 01:00:00 +0200 dst')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rufus-scheduler-3.0.8 spec/basics_spec.rb