diff options
Diffstat (limited to 'test/controllers/nodes_controller_test.rb')
| -rw-r--r-- | test/controllers/nodes_controller_test.rb | 16 |
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 | ||
