Skip to content

Commit

Permalink
Merge pull request #23 from jon-sully/populate-parent-references
Browse files Browse the repository at this point in the history
Make 'er quack like an Icalendar Component!
  • Loading branch information
rahearn authored Oct 29, 2023
2 parents 7c897f2 + 0607d95 commit 5358066
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/icalendar/recurrence/schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions spec/lib/schedule_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5358066

Please sign in to comment.