diff --git a/lib/icalendar/recurrence/schedule.rb b/lib/icalendar/recurrence/schedule.rb index 2c24a1d..d049b0e 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 @@ -52,7 +52,7 @@ def convert_ice_cube_occurrence(ice_cube_occurrence) start_time = ice_cube_occurrence.start_time.utc end_time = ice_cube_occurrence.end_time.utc - Icalendar::Recurrence::Occurrence.new(start_time, end_time) + Icalendar::Recurrence::Occurrence.new(start_time, end_time, @event) end def ice_cube_schedule diff --git a/spec/lib/schedule_spec.rb b/spec/lib/schedule_spec.rb index 76bffa8..02daf54 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.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 let(:example_occurrence) do timezoned_event = example_event :first_saturday_of_month