Sha256: 63d2019ac2d0898e8d990c2789d459637788ada3f747334d25a026664865515c

Contents?: true

Size: 1.05 KB

Versions: 11

Compression:

Stored size: 1.05 KB

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

      if jruby? or ruby18?

        expect(true).to be(true)

      else

        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
  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

11 entries across 11 versions & 1 rubygems

Version Path
rufus-scheduler-3.1.9 spec/basics_spec.rb
rufus-scheduler-3.1.8 spec/basics_spec.rb
rufus-scheduler-3.1.7 spec/basics_spec.rb
rufus-scheduler-3.1.6 spec/basics_spec.rb
rufus-scheduler-3.1.5 spec/basics_spec.rb
rufus-scheduler-3.1.4 spec/basics_spec.rb
rufus-scheduler-3.1.3 spec/basics_spec.rb
rufus-scheduler-3.1.2 spec/basics_spec.rb
rufus-scheduler-3.1.1 spec/basics_spec.rb
rufus-scheduler-3.1.0 spec/basics_spec.rb
rufus-scheduler-3.0.9 spec/basics_spec.rb