summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-08-15 00:40:49 +0200
committererdgeist <erdgeist@erdgeist.org>2026-08-15 00:40:49 +0200
commit96cf1945a256c8ef825f9b1af81ca8bee751a0b5 (patch)
treea6911581c845bccf2ac6ac63dcbeb7f9b46cfeab /test
parentd15dc3f1d2c9421c44d2c82c08b44d84459fcaaf (diff)
Add test for trashed rows offering restore and refusing restore without live parents
Diffstat (limited to 'test')
-rw-r--r--test/controllers/nodes_controller_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/controllers/nodes_controller_test.rb b/test/controllers/nodes_controller_test.rb
index c7caeed1..9cedc52d 100644
--- a/test/controllers/nodes_controller_test.rb
+++ b/test/controllers/nodes_controller_test.rb
@@ -700,6 +700,22 @@ class NodesControllerTest < ActionController::TestCase
700 assert node.reload.in_trash? 700 assert node.reload.in_trash?
701 end 701 end
702 702
703 test "a trashed row offers a restore, and refuses when the parent is gone" do
704 login_as :quentin
705 parent = Node.root.children.create!(:slug => "restore_parent")
706 node = parent.children.create!(:slug => "restorable")
707 node.trash!(users(:quentin))
708
709 get :trashed
710 assert_select "form[action=?]", restore_from_trash_node_path(node), count: 1
711 assert_select ".disabled_action", count: 0
712
713 parent.destroy
714 get :trashed
715 assert_select "form[action=?]", restore_from_trash_node_path(node), count: 0
716 assert_select ".disabled_action", count: 1
717 end
718
703 test "trashing the Trash node itself is refused" do 719 test "trashing the Trash node itself is refused" do
704 login_as :quentin 720 login_as :quentin
705 721