test/test/googlecalendar.rb in when_exe-0.3.3 vs test/test/googlecalendar.rb in when_exe-0.3.4

- old
+ new

@@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- =begin - Copyright (C) 2012-2013 Takashi SUGA + Copyright (C) 2012-2014 Takashi SUGA You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive. =end @@ -49,26 +49,32 @@ END:STANDARD END:VTIMEZONE RECURRENCE HOLIDAYS = [ - ["元日", "2012-01-01T00:00:00.00+09:00", "2012-01-02T00:00:00.00+09:00"], - ["成人の日", "2012-01-09T00:00:00.00+09:00", "2012-01-10T00:00:00.00+09:00"], - ["建国記念の日", "2012-02-11T00:00:00.00+09:00", "2012-02-12T00:00:00.00+09:00"], - ["昭和の日", "2012-04-29T00:00:00.00+09:00", "2012-04-30T00:00:00.00+09:00"], - # ["振替休日", "2012-04-30T00:00:00.00+09:00", "2012-05-01T00:00:00.00+09:00"], - ["憲法記念日", "2012-05-03T00:00:00.00+09:00", "2012-05-04T00:00:00.00+09:00"], - ["みどりの日", "2012-05-04T00:00:00.00+09:00", "2012-05-05T00:00:00.00+09:00"], - ["こどもの日", "2012-05-05T00:00:00.00+09:00", "2012-05-06T00:00:00.00+09:00"], - ["海の日", "2012-07-16T00:00:00.00+09:00", "2012-07-17T00:00:00.00+09:00"], - ["敬老の日", "2012-09-17T00:00:00.00+09:00", "2012-09-18T00:00:00.00+09:00"], - # ["秋分の日", "2012-09-22T00:00:00.00+09:00", "2012-09-23T00:00:00.00+09:00"], - ["体育の日", "2012-10-08T00:00:00.00+09:00", "2012-10-09T00:00:00.00+09:00"], - ["文化の日", "2012-11-03T00:00:00.00+09:00", "2012-11-04T00:00:00.00+09:00"], - ["勤労感謝の日", "2012-11-23T00:00:00.00+09:00", "2012-11-24T00:00:00.00+09:00"], - ["天皇誕生日", "2012-12-23T00:00:00.00+09:00", "2012-12-24T00:00:00.00+09:00"], - # ["振替休日", "2012-12-24T00:00:00.00+09:00", "2012-12-25T00:00:00.00+09:00"] + ["元日", "2012-01-01T00:00:00.00+09:00", "2012-01-02T00:00:00.00+09:00"], + ["元日 振替休日", "2012-01-02T00:00:00.00+09:00", "2012-01-03T00:00:00.00+09:00"], + ["銀行休業日", "2012-01-02T00:00:00.00+09:00", "2012-01-03T00:00:00.00+09:00"], + ["銀行休業日", "2012-01-03T00:00:00.00+09:00", "2012-01-04T00:00:00.00+09:00"], + ["成人の日", "2012-01-09T00:00:00.00+09:00", "2012-01-10T00:00:00.00+09:00"], + ["建国記念の日", "2012-02-11T00:00:00.00+09:00", "2012-02-12T00:00:00.00+09:00"], + ["春分の日", "2012-03-20T00:00:00.00+09:00", "2012-03-21T00:00:00.00+09:00"], + ["昭和の日", "2012-04-29T00:00:00.00+09:00", "2012-04-30T00:00:00.00+09:00"], + ["昭和の日 振替休日", "2012-04-30T00:00:00.00+09:00", "2012-05-01T00:00:00.00+09:00"], + ["憲法記念日", "2012-05-03T00:00:00.00+09:00", "2012-05-04T00:00:00.00+09:00"], + ["みどりの日", "2012-05-04T00:00:00.00+09:00", "2012-05-05T00:00:00.00+09:00"], + ["こどもの日", "2012-05-05T00:00:00.00+09:00", "2012-05-06T00:00:00.00+09:00"], + ["海の日", "2012-07-16T00:00:00.00+09:00", "2012-07-17T00:00:00.00+09:00"], + ["敬老の日", "2012-09-17T00:00:00.00+09:00", "2012-09-18T00:00:00.00+09:00"], + ["秋分の日", "2012-09-22T00:00:00.00+09:00", "2012-09-23T00:00:00.00+09:00"], + ["体育の日", "2012-10-08T00:00:00.00+09:00", "2012-10-09T00:00:00.00+09:00"], + ["文化の日", "2012-11-03T00:00:00.00+09:00", "2012-11-04T00:00:00.00+09:00"], + ["勤労感謝の日", "2012-11-23T00:00:00.00+09:00", "2012-11-24T00:00:00.00+09:00"], + ["天皇誕生日", "2012-12-23T00:00:00.00+09:00", "2012-12-24T00:00:00.00+09:00"], + ["天皇誕生日 振替休日", "2012-12-24T00:00:00.00+09:00", "2012-12-25T00:00:00.00+09:00"], + ["クリスマス", "2012-12-25T00:00:00.00+09:00", "2012-12-26T00:00:00.00+09:00"], + ["大晦日", "2012-12-31T00:00:00.00+09:00", "2013-01-01T00:00:00.00+09:00"] ] WEEKLY_EVENTS = [ "2012-03-08T08:30:00+09:00...2012-03-08T09:30:00+09:00", "2012-03-15T08:30:00+09:00...2012-03-15T09:30:00+09:00", @@ -82,10 +88,11 @@ def test_nothing end if const_defined?(:PASSWORD) && Object.const_defined?(:GoogleCalendar) + def test__to_vevent holidays = HOLIDAYS.dup gcal = get_cal(PUBLIC_FEED % ['japanese', 'ja']) gcal.events({'start-min'=>'2012-01-01', 'start-max'=>'2013-01-01', 'orderby'=>'starttime', 'sortorder'=>'a' # a:asend, d:desend @@ -103,22 +110,24 @@ gcal.events(period).each do |event| event.destroy end event = When.Resource("examples/JapanHolidays.ics::Ganjitsu").to_gcalevent(gcal) event.save! - holidays = [RULE0] + holidays = [RULE0] * 2 gcal.events(period).each do |event| assert_equal(holidays.shift, event.recurrence) end - assert_equal(0, holidays.size) + pp 'WARN: event is duplicated.' if holidays.size == 0 + assert_equal(true, (0..1).include?(holidays.size)) end def test__enum_for holidays = HOLIDAYS.dup + holidays.delete_at(2) gcal = get_cal(PUBLIC_FEED % ['japanese', 'ja']) gcal.enum_for({'start-min'=>'2012-01-01', 'start-max'=>'2013-01-01'}).each do |date| - sample = holidays.shift - assert_equal(sample[1] + '...' + sample[2], date.to_s) + sample = holidays.shift + assert_equal(sample[1] + '...' + sample[2], date.to_s) end assert_equal(0, holidays.size) end =begin