Skip to content

Commit

Permalink
Add a test case for timezone transition
Browse files Browse the repository at this point in the history
  • Loading branch information
nurse committed Dec 2, 2015
1 parent a0e0323 commit f7832c9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions spec/perfect_sched_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,20 @@
it do
expect{PerfectSched.next_time('0 * * * *', 0, 'JST-9')}.to raise_error(ArgumentError)
end

context 'DST 2015' do
it 'can go through America/Los_Angeles transition' do
t0 = Time.new(2015, 3, 8, 1, 59, 59, -8*3600)
t1 = Time.new(2015, 3, 9, 2, 0, 0, -7*3600) # 2015-03-08T02:00:00 doesn't exist
ts = PerfectSched.next_time('* 2 * * *', t0.to_i, 'America/Los_Angeles')
expect(ts).to eq(t1.to_i)
end
it 'can go through America/Los_Angeles transition' do
t0 = Time.new(2015, 11, 1, 1, 0, 0, -7*3600)
t1 = Time.new(2015, 11, 1, 1, 0, 0, -8*3600) # 2015-11-01T01:00:00 exists twice
ts = PerfectSched.next_time('0 1 * * *', t0.to_i, 'America/Los_Angeles')
expect(ts).to eq(t1.to_i)
end
end
end
end

0 comments on commit f7832c9

Please sign in to comment.