Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

CalendarWrapper -> IcalendarBuilder

Klaus Zanders3fdc0286e5e0
diff --git a/modules/meeting/app/services/all_meetings/ical_service.rb b/modules/meeting/app/services/all_meetings/ical_service.rb
index 677b70bd719..91e6b8b511c 100644
--- a/modules/meeting/app/services/all_meetings/ical_service.rb
+++ b/modules/meeting/app/services/all_meetings/ical_service.rb
@@ -40,7 +40,7 @@ module AllMeetings
def call # rubocop:disable Metrics/AbcSize
User.execute_as(user) do
- calendar = Meetings::CalendarWrapper.new(timezone: Time.zone || Time.zone_default)
+ calendar = Meetings::IcalendarBuilder.new(timezone: Time.zone || Time.zone_default)
single_meetings.each do |meeting|
calendar.add_single_meeting_event(meeting:, cancelled: false)
diff --git a/modules/meeting/spec/services/all_meetings/ical_service_spec.rb b/modules/meeting/spec/services/all_meetings/ical_service_spec.rb
index 03018429fc9..46850939919 100644
--- a/modules/meeting/spec/services/all_meetings/ical_service_spec.rb
+++ b/modules/meeting/spec/services/all_meetings/ical_service_spec.rb
@@ -59,7 +59,7 @@ RSpec.describe AllMeetings::ICalService, type: :model do # rubocop:disable RSpec
subject { service.call }
before do
- allow(Meetings::CalendarWrapper).to receive(:new).and_raise StandardError.new("Oh noes")
+ allow(Meetings::IcalendarBuilder).to receive(:new).and_raise StandardError.new("Oh noes")
end
it "returns a failure" do
@@ -120,7 +120,7 @@ RSpec.describe AllMeetings::ICalService, type: :model do # rubocop:disable RSpec
expect(entry.uid).to eq(meeting.uid)
expect(entry.organizer.to_s).to eq("mailto:#{Setting.mail_from}")
- expect(entry.attendee.map(&:to_s)).to contain_exactly("mailto:[email protected]", "mailto:[email protected]")
+ expect(entry.attendee.map(&:to_s)).to match_array([user, user2].map { |u| "mailto:#{u.mail}" })
expect(entry.dtstart.utc).to eq meeting.start_time
expect(entry.dtend.utc).to eq meeting.start_time + 1.hour
expect(entry.summary).to eq "[My Project] Important meeting"
@@ -149,8 +149,14 @@ RSpec.describe AllMeetings::ICalService, type: :model do # rubocop:disable RSpec
let!(:recurring_meeting) do
create(:recurring_meeting,
author: user,
+ title: "Recurring meeting",
project:,
- time_zone: user.time_zone)
+ time_zone: user.time_zone).tap do |rm|
+ rm.template.participants = [
+ MeetingParticipant.new(user:),
+ MeetingParticipant.new(user: user2)
+ ]
+ end
end
context "with a recurring meeting that has no derived meetings yet" do
@@ -163,7 +169,7 @@ RSpec.describe AllMeetings::ICalService, type: :model do # rubocop:disable RSpec
expect(entry.uid).to eq(recurring_meeting.uid)
expect(entry.organizer.to_s).to eq("mailto:#{Setting.mail_from}")
- # expect(entry.attendee.map(&:to_s)).to contain_exactly("mailto:[email protected]", "mailto:[email protected]")
+ expect(entry.attendee.map(&:to_s)).to match_array([user, user2].map { |u| "mailto:#{u.mail}" })
# expect(entry.dtstart.utc).to eq meeting.start_time
# expect(entry.dtend.utc).to eq meeting.start_time + 1.hour
# expect(entry.summary).to eq "[My Project] Important meeting"