summaryrefslogtreecommitdiff
path: root/test/controllers/shared_previews_controller_test.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-14 14:31:18 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-14 14:31:18 +0200
commitcca0e57b21d506cd341b927984bcb68f0e461783 (patch)
tree2d49cf1b678a3f5cf0fd20cd214b20524027ec50 /test/controllers/shared_previews_controller_test.rb
parent6b302d263ac66b521a743f1e8e1cc82997b54b5d (diff)
Retire wipe_draft! and find_or_create_draft from production code
Both had already lost their reason to exist as production API: wipe_draft!'s one remaining callsite (nodes#show) was removed two sessions ago, and find_or_create_draft had zero production callers left at all -- confirmed by a fresh grep, not assumed -- every one of its ~65 call sites was test setup, unrelated to what those tests actually cover. wipe_draft! is deleted outright, along with its two tests -- the lock/draft/autosave cleanup it silently performed already has explicit, always-visible manual equivalents (Unlock, Discard Autosave, Destroy Draft), so nothing real is lost. find_or_create_draft moves to test_helper.rb as a plain method on ActiveSupport::TestCase, alongside the create_node_with_draft/ create_node_with_published_page helpers already living there -- extending the framework's own designated test-extension point rather than reopening the Node model from test code. Its three tests of real dispatch behavior (idempotency on repeat calls, and raising when a second user contends for the lock) are kept, since ~65 other tests depend on this helper actually working correctly; only the call syntax changed, from node.find_or_create_draft(user) to find_or_create_draft(node, user).
Diffstat (limited to 'test/controllers/shared_previews_controller_test.rb')
-rw-r--r--test/controllers/shared_previews_controller_test.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/controllers/shared_previews_controller_test.rb b/test/controllers/shared_previews_controller_test.rb
index 5f2d20d..4ebc785 100644
--- a/test/controllers/shared_previews_controller_test.rb
+++ b/test/controllers/shared_previews_controller_test.rb
@@ -13,7 +13,7 @@ class SharedPreviewsControllerTest < ActionController::TestCase
13 test "renders the preview for a brand-new draft on an already-published node" do 13 test "renders the preview for a brand-new draft on an already-published node" do
14 node = Node.root.children.create!(:slug => "shared_preview_published_node_test") 14 node = Node.root.children.create!(:slug => "shared_preview_published_node_test")
15 node.publish_draft! 15 node.publish_draft!
16 node.find_or_create_draft(User.first) 16 find_or_create_draft(node, User.first)
17 node.draft.ensure_preview_token! 17 node.draft.ensure_preview_token!
18 18
19 get :show, params: { :token => node.draft.preview_token } 19 get :show, params: { :token => node.draft.preview_token }