diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-10 18:10:57 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-10 18:10:57 +0200 |
| commit | 48eed5f35ea798c91f1e0a77c13e751145acfc48 (patch) | |
| tree | 83fa8ebf52313eedfd4b22bf4af74bf0b1a0f703 | |
| parent | c9401e45433ea45b46f9a8faf1e7e537e4683244 (diff) | |
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.
| -rw-r--r-- | test/controllers/nodes_controller_test.rb | 1 | ||||
| -rw-r--r-- | 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 | |||
| 355 | 355 | ||
| 356 | login_as :quentin | 356 | login_as :quentin |
| 357 | get :index | 357 | get :index |
| 358 | assert_response :success | ||
| 358 | end | 359 | end |
| 359 | 360 | ||
| 360 | test "no dangling pages remain after node removal" do | 361 | 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 | |||
| 111 | node.publish_draft! | 111 | node.publish_draft! |
| 112 | assert_not_nil node.find_or_create_draft( @user1 ) | 112 | assert_not_nil node.find_or_create_draft( @user1 ) |
| 113 | end | 113 | end |
| 114 | 114 | ||
| 115 | def test_find_or_create_draft_if_draft_exists_and_is_owned_by_user | 115 | def test_find_or_create_draft_if_draft_exists_and_is_owned_by_user |
| 116 | node = Node.root.children.create :slug => "xyz" | 116 | node = Node.root.children.create :slug => "xyz" |
| 117 | node.publish_draft! | 117 | node.publish_draft! |
| 118 | 118 | ||
| 119 | node.find_or_create_draft @user1 | 119 | first_call = node.find_or_create_draft @user1 |
| 120 | node.find_or_create_draft @user1 | 120 | second_call = node.find_or_create_draft @user1 |
| 121 | |||
| 122 | assert_equal first_call, second_call | ||
| 123 | assert_equal 2, node.pages.count | ||
| 124 | assert_equal @user1, node.lock_owner | ||
| 121 | end | 125 | end |
| 122 | 126 | ||
| 123 | def test_exception_if_draft_exists_but_locked_by_another_user | 127 | def test_exception_if_draft_exists_but_locked_by_another_user |
| 124 | node = Node.root.children.create :slug => "xyz" | 128 | node = Node.root.children.create :slug => "xyz" |
| 125 | node.publish_draft! | 129 | node.publish_draft! |
