1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
#
# Specifying fugit
#
# Sat Jun 10 07:44:42 JST 2017 圓さんの家
#
require 'spec_helper'
describe Fugit do
describe '.parse_at' do
it 'parses time points' do
t = Fugit.parse_at('2017-01-03 11:21:17')
expect(t.class).to eq(::EtOrbi::EoTime)
expect(Fugit.time_to_plain_s(t, false)).to eq('2017-01-03 11:21:17')
end
it 'returns an EoTime instance as is' do
eot = ::EtOrbi::EoTime.new('2017-01-03 11:21:17', 'America/Los_Angeles')
t = Fugit.parse_at(eot)
expect(t.class).to eq(::EtOrbi::EoTime)
expect(t.object_id).to eq(eot.object_id)
end
context 'with timezones' do
[
[ '2018-09-04 06:41:34 +11', '2018-09-04 06:41:34 +11 +1100' ],
[ '2018-09-04 06:41:34 +1100', '2018-09-04 06:41:34 +1100 +1100' ],
[ '2018-09-04 06:41:34 +11:00', '2018-09-04 06:41:34 +11:00 +1100' ],
[ '2018-09-04 06:41:34 Etc/GMT-11', '2018-09-04 06:41:34 +11 +1100' ],
#[ '2018-09-04 06:41:34 UTC+11', nil ],
].each do |string, plain|
it "parses #{string}" do
t = Fugit.parse_at(string)
expect(t.class).to eq(::EtOrbi::EoTime)
expect(Fugit.time_to_zone_s(t)).to eq(plain)
end
end
end
end
end
|