From 3ec77d6fffe14a96cf002db4cc7a05d37ab94d74 Mon Sep 17 00:00:00 2001 From: Jon Sullivan Date: Thu, 17 Jan 2019 08:49:07 -0500 Subject: [PATCH 1/3] Added parent reference to mimic Icalendar Components --- lib/icalendar/recurrence/schedule.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/icalendar/recurrence/schedule.rb b/lib/icalendar/recurrence/schedule.rb index 6acdce4..c8c6817 100644 --- a/lib/icalendar/recurrence/schedule.rb +++ b/lib/icalendar/recurrence/schedule.rb @@ -2,7 +2,7 @@ module Icalendar module Recurrence - class Occurrence < Struct.new(:start_time, :end_time) + class Occurrence < Struct.new(:start_time, :end_time, :parent) end class Schedule @@ -62,7 +62,7 @@ def convert_ice_cube_occurrence(ice_cube_occurrence) start_time ||= ice_cube_occurrence.start_time end_time ||= ice_cube_occurrence.end_time - Icalendar::Recurrence::Occurrence.new(start_time, end_time) + Icalendar::Recurrence::Occurrence.new(start_time, end_time, @event) end def ice_cube_schedule @@ -82,7 +82,7 @@ def ice_cube_schedule schedule end - + def convert_duration_to_seconds(ical_duration) return 0 unless ical_duration From a339e6a8ef9df9ac9f8525d975de2ecf9f6ad115 Mon Sep 17 00:00:00 2001 From: Jon Sullivan Date: Thu, 17 Jan 2019 09:08:18 -0500 Subject: [PATCH 2/3] Added spec --- spec/lib/schedule_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/lib/schedule_spec.rb b/spec/lib/schedule_spec.rb index 76bffa8..fd101fe 100644 --- a/spec/lib/schedule_spec.rb +++ b/spec/lib/schedule_spec.rb @@ -21,6 +21,12 @@ expect(occurrences.count).to eq(7) end + it 'returns object whose event method matches the origin event' do + # Simple test to make sure the event carried over; different __id__ + expect(example_occurrence.event.custom_properties).to eq example_event(:daily).custom_properties + expect(example_occurrence.event.name).to eq example_event(:daily).name + end + context "timezoned event" do let(:example_occurrence) do timezoned_event = example_event :first_saturday_of_month From 0607d95548a83d2e6ce39ad94deffadcb57f7b4c Mon Sep 17 00:00:00 2001 From: Jon Sullivan Date: Thu, 17 Jan 2019 12:55:21 -0500 Subject: [PATCH 3/3] Update method name --- spec/lib/schedule_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/lib/schedule_spec.rb b/spec/lib/schedule_spec.rb index fd101fe..02daf54 100644 --- a/spec/lib/schedule_spec.rb +++ b/spec/lib/schedule_spec.rb @@ -23,8 +23,8 @@ it 'returns object whose event method matches the origin event' do # Simple test to make sure the event carried over; different __id__ - expect(example_occurrence.event.custom_properties).to eq example_event(:daily).custom_properties - expect(example_occurrence.event.name).to eq example_event(:daily).name + expect(example_occurrence.parent.custom_properties).to eq example_event(:daily).custom_properties + expect(example_occurrence.parent.name).to eq example_event(:daily).name end context "timezoned event" do