Skip to content

refactor: move WorkshopCalendar from models to serializers layer#2698

Merged
mroderick merged 3 commits into
masterfrom
feature/move-workshop-calendar
Jul 10, 2026
Merged

refactor: move WorkshopCalendar from models to serializers layer#2698
mroderick merged 3 commits into
masterfrom
feature/move-workshop-calendar

Conversation

@mroderick

Copy link
Copy Markdown
Collaborator

What

Move WorkshopCalendar from app/models/ (domain layer) to app/serializers/ (infrastructure layer), where serializers belong in layered architecture.

Why

As identified in the layered-architecture analysis, WorkshopCalendar is a pure serialization class — it builds iCalendar output from a workshop model using the icalendar gem. It has no domain identity, no persistence, and no business invariants. Two mailers already use it as WorkshopCalendar.new(...).ical, which is a serializer call pattern.

Changes

Commit 1 — b67db371 — Pure rename, zero code changes:

  • app/models/workshop_calendar.rbapp/serializers/workshop_calendar.rb
  • spec/models/workshop_calendar_spec.rbspec/serializers/workshop_calendar_spec.rb

Rails 8 autoloads all app/ subdirectories, so no require path updates needed. Both mailers resolve the class automatically.

Commit 2 — 4c4146af — Strengthen test coverage:

  • Callers use the public #ical method, but tests only checked the internal .calendar accessor. Added tests for #ical asserting on raw iCalendar output format.
  • Added explicit test confirming setup runs during initialization.
  • No existing test was removed or weakened.

Verification

  • All unit tests pass (6 examples)
  • Both mailer specs pass (30 examples total)
  • Tree identity verified — end state is byte-identical to the source

WorkshopCalendar is a serialization class that builds iCalendar output
from a workshop model. It has no domain identity, no persistence, and
no business invariants. Place it in the correct architectural layer.

Rails 8 autoloads all app/ subdirectories, so no require path updates
are needed.
The existing tests verified calendar event structure through the internal
.calendar accessor. Add tests for the public #ical method (the actual
interface used by mailers) that assert on the raw iCalendar output format
and verify the invitation URL appears in the event description.

Also add an explicit setup test that confirms #setup runs during
initialization, making that side effect visible.
@mroderick mroderick marked this pull request as ready for review July 10, 2026 06:42
@mroderick mroderick requested a review from olleolleolle July 10, 2026 06:44
@mroderick mroderick enabled auto-merge July 10, 2026 09:16
@mroderick mroderick merged commit 3b043bb into master Jul 10, 2026
8 checks passed
@mroderick mroderick deleted the feature/move-workshop-calendar branch July 10, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants