From 48eed5f35ea798c91f1e0a77c13e751145acfc48 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 10 Jul 2026 18:10:57 +0200 Subject: Add the missing assertions two tests were silently running without Both ran real code and checked nothing -- Minitest's "missing assertions" warning has been firing on every run this session. test_find_or_create_draft_if_draft_exists_and_is_owned_by_user called the method twice but never checked what came back; now confirms the second call returns the same draft rather than creating a new one, and leaves the lock and page count untouched. test_destroy_a_published_node destroyed a node and loaded the admin index but never checked the response, unlike its two neighbors covering the same destroy path (dangling pages, orphaned occurrences). Added the assert_response :success its own shape already implied. No behavior changed -- both were passing before for the same reason they're passing now, they just weren't proving anything. --- test/controllers/nodes_controller_test.rb | 1 + test/models/node_test.rb | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/test/controllers/nodes_controller_test.rb b/test/controllers/nodes_controller_test.rb index ce3419c..37091d5 100644 --- a/test/controllers/nodes_controller_test.rb +++ b/test/controllers/nodes_controller_test.rb @@ -355,6 +355,7 @@ class NodesControllerTest < ActionController::TestCase login_as :quentin get :index + assert_response :success end test "no dangling pages remain after node removal" do diff --git a/test/models/node_test.rb b/test/models/node_test.rb index 9e71dec..280614e 100644 --- a/test/models/node_test.rb +++ b/test/models/node_test.rb @@ -111,15 +111,19 @@ class NodeTest < ActiveSupport::TestCase node.publish_draft! assert_not_nil node.find_or_create_draft( @user1 ) end - + def test_find_or_create_draft_if_draft_exists_and_is_owned_by_user node = Node.root.children.create :slug => "xyz" node.publish_draft! - - node.find_or_create_draft @user1 - node.find_or_create_draft @user1 + + first_call = node.find_or_create_draft @user1 + second_call = node.find_or_create_draft @user1 + + assert_equal first_call, second_call + assert_equal 2, node.pages.count + assert_equal @user1, node.lock_owner end - + def test_exception_if_draft_exists_but_locked_by_another_user node = Node.root.children.create :slug => "xyz" node.publish_draft! -- cgit v1.3