From 91d294f4a09f9bbe37f9548959bfcb43645678fb Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Wed, 23 Sep 2026 07:45:57 -0400 Subject: [PATCH] Mint the tampered attachable sgid without extending a Room The companion to #279: the same per-instance `extend` appeared in test/lib/rails_ext/action_text_attachables_test.rb. `attachable_sgid` is `to_sgid(expires_in: nil, for: ActionText::Attachable::LOCATOR_NAME).to_s`, so mint that directly; the minted bytes and the assertion are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) --- test/lib/rails_ext/action_text_attachables_test.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/lib/rails_ext/action_text_attachables_test.rb b/test/lib/rails_ext/action_text_attachables_test.rb index 203e323..8e82a13 100644 --- a/test/lib/rails_ext/action_text_attachables_test.rb +++ b/test/lib/rails_ext/action_text_attachables_test.rb @@ -28,9 +28,11 @@ class ActionText::AttachmentTest < ActiveSupport::TestCase end test "from_node with an invalid SGID" do - room = rooms(:pets).tap { |r| r.extend ActionText::Attachable } + # A Room is not attachable; mint the sgid an attachable would carry + # (`ActionText::Attachable#attachable_sgid` is exactly this call). + sgid = rooms(:pets).to_sgid(expires_in: nil, for: ActionText::Attachable::LOCATOR_NAME).to_s - html = %Q() + html = %Q() node = ActionText::Fragment.wrap(html).find_all(ActionText::Attachment.tag_name).first attachment = ActionText::Attachment.from_node(node)