test/ical_serializable_test.rb in hiccup-0.2.1 vs test/ical_serializable_test.rb in hiccup-0.3.0

- old
+ new

@@ -15,15 +15,40 @@ assert_roundtrip ics, recurrence end end + def test_parsing_empty_recurrence + schedule = Schedule.from_ical("") + assert_equal :never, schedule.kind + end + + test_roundtrip( + "No recurrence", + "DTSTART;VALUE=DATE-TIME:20090101T000000Z\n", + { :kind => :never, + :start_date => DateTime.new(2009, 1, 1) + }) + + + test_roundtrip( "Simple weekly recurrence", "DTSTART;VALUE=DATE-TIME:20090101T000000Z\nRRULE:FREQ=WEEKLY;BYDAY=SU\n", { :kind => :weekly, :weekly_pattern => %w{Sunday}, :start_date => DateTime.new(2009, 1, 1) + }) + + + test_roundtrip( + "Simple weekly recurrence (with an end date)", + "DTSTART;VALUE=DATE-TIME:20090101T000000Z\nRRULE:FREQ=WEEKLY;UNTIL=20091231T000000Z;BYDAY=SU\n", + { :kind => :weekly, + :weekly_pattern => %w{Sunday}, + :start_date => DateTime.new(2009, 1, 1), + :end_date => DateTime.new(2009, 12, 31), + :ends => true }) test_roundtrip( "Complex weekly recurrence (with an interval)",