From 674d040cd4d0bd7919a02363411aef7550c74f12 Mon Sep 17 00:00:00 2001 From: maebeale Date: Wed, 15 Jul 2026 07:35:24 -0400 Subject: [PATCH] Add tests for art_supplies content built-in + callout-row page copy Salvaged from the closed #1984 (superseded by #1996), ported to current builtin_key vocabulary. #1996 landed the structural cleanup but left these two behavioral assertions uncovered at their respective layers: - Model: art_supplies is a *content* built-in (behavioral_builtin? == false), unlike a behavioral built-in like certificate. - Request: the CE and scholarship pages render the intro copy from their materialized callout row's description (FAQ already covered; handouts has no description intro). Co-Authored-By: Claude Opus 4.8 (1M context) --- .../registration_ticket_callout_spec.rb | 9 ++++++ spec/requests/events/callouts_spec.rb | 29 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/spec/models/registration_ticket_callout_spec.rb b/spec/models/registration_ticket_callout_spec.rb index 24cad46d8..e017eabd1 100644 --- a/spec/models/registration_ticket_callout_spec.rb +++ b/spec/models/registration_ticket_callout_spec.rb @@ -80,6 +80,15 @@ expect(other.payment?).to be(false) expect(custom.payment?).to be(false) end + + it "treats art_supplies as a content built-in (renders its own page), not behavioral" do + event = create(:event) + art_supplies = create(:registration_ticket_callout, event:, builtin_key: "art_supplies") + certificate = create(:registration_ticket_callout, event:, builtin_key: "certificate") + + expect(art_supplies.behavioral_builtin?).to be(false) + expect(certificate.behavioral_builtin?).to be(true) + end end describe "#published (inverse of hidden)" do diff --git a/spec/requests/events/callouts_spec.rb b/spec/requests/events/callouts_spec.rb index 359afa6f7..188267536 100644 --- a/spec/requests/events/callouts_spec.rb +++ b/spec/requests/events/callouts_spec.rb @@ -35,6 +35,35 @@ end end + # The intro copy an admin types into a built-in's materialized callout row (its + # "Callout page text" / description) renders on that built-in's public page. CE + # and scholarship previously had no request-layer coverage of this; the FAQ case + # is covered above, and handouts has no description intro (resource cards only). + describe "built-in page copy from the callout row description" do + it "renders the CE callout's description on the CE page" do + BuiltinCallouts.seed(event) + event.registration_ticket_callouts.find_by(builtin_key: "ce_hours") + .update!(description: "

Bring your license number.

", hidden: false) + + get registration_ce_path(registration.slug) + + expect(response).to have_http_status(:success) + expect(response.body).to include("Bring your license number.") + end + + it "renders the scholarship callout's description on the scholarship page" do + registration.update!(scholarship_requested: true) + BuiltinCallouts.seed(event) + event.registration_ticket_callouts.find_by(builtin_key: "scholarship") + .update!(description: "

About your scholarship.

", hidden: false) + + get registration_scholarship_path(registration.slug) + + expect(response).to have_http_status(:success) + expect(response.body).to include("About your scholarship.") + end + end + describe "GET /registration/:slug/handouts" do it "renders the handouts page when its callout is published" do create(:registration_ticket_callout, event:, builtin_key: "handouts", hidden: false)