From f7ce8c245fde3f6202103ae614b181c0ba44ed93 Mon Sep 17 00:00:00 2001 From: hukl Date: Wed, 9 Sep 2009 15:19:33 +0200 Subject: added editing of slugs and moving of nodes. to edit a slug or move a node you edit that node, make your changes and save. the slug and parent node changes get staged and are applied once that revision is published --- test/functional/nodes_controller_test.rb | 70 ++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'test/functional') diff --git a/test/functional/nodes_controller_test.rb b/test/functional/nodes_controller_test.rb index 7559869..08e50fd 100644 --- a/test/functional/nodes_controller_test.rb +++ b/test/functional/nodes_controller_test.rb @@ -127,4 +127,74 @@ class NodesControllerTest < ActionController::TestCase assert_equal "There", test_node.draft.body assert_equal "Foobar", test_node.draft.template_name end + + + test "publish draft with staged_slug unqueal slug" do + login_as :quentin + + test_node = Node.create! :slug => "test_node", :staged_slug => "peter_pan" + test_node.move_to_child_of Node.root + + put :publish, :id => test_node.id + + test_node.reload + assert_equal "peter_pan", test_node.slug + assert_equal "peter_pan", test_node.unique_name + end + + test "publish draft with staged_slug with more levels of nodes" do + login_as :quentin + + test_node = Node.create! :slug => "test_node", :staged_slug => "peter_pan" + test_node.move_to_child_of Node.root + test_node2 = Node.create! :slug => "test_node2" + test_node2.move_to_child_of test_node + + put :publish, :id => test_node.id + + test_node.reload; test_node2.reload + assert_equal "peter_pan/test_node2", test_node2.unique_name + assert_equal "peter_pan", test_node.unique_name + end + + test "publish draft with staged_parent_id" do + login_as :quentin + + parent = Node.create! :slug => "parent" + parent.move_to_child_of Node.root + test_node = Node.create! :slug => "test_node", :staged_parent_id => parent.id + test_node.move_to_child_of Node.root + test_node2 = Node.create! :slug => "test_node2" + test_node2.move_to_child_of test_node + + put :publish, :id => test_node.id + + test_node.reload; test_node2.reload + assert_equal "parent/test_node", test_node.unique_name + assert_equal "parent/test_node/test_node2", test_node2.unique_name + end + + test "publish draft with staged_parent_id and staged_slug" do + login_as :quentin + + parent = Node.create! :slug => "parent" + parent.move_to_child_of Node.root + + test_node = Node.create!( + :slug => "test_node", + :staged_parent_id => parent.id, + :staged_slug => "peter_pan" + ) + test_node.move_to_child_of Node.root + + test_node2 = Node.create! :slug => "test_node2" + test_node2.move_to_child_of test_node + + put :publish, :id => test_node.id + + test_node.reload; test_node2.reload + assert_equal "parent/peter_pan", test_node.unique_name + assert_equal "parent/peter_pan/test_node2", test_node2.unique_name + end + end -- cgit v1.3