mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-09-26 02:04:55 +09:00
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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(<action-text-attachment sgid="#{room.attachable_sgid}invalid"></action-text-attachment>)
|
||||
html = %Q(<action-text-attachment sgid="#{sgid}invalid"></action-text-attachment>)
|
||||
node = ActionText::Fragment.wrap(html).find_all(ActionText::Attachment.tag_name).first
|
||||
|
||||
attachment = ActionText::Attachment.from_node(node)
|
||||
|
||||
Reference in New Issue
Block a user