From 113449eacba67625004b14081f4cc0cc3b984553 Mon Sep 17 00:00:00 2001 From: hukl Date: Mon, 2 Mar 2009 17:22:48 +0100 Subject: added unlock functionality. not yet hooked up with permissions though. anybody can unlock. put a confirmation in front of it. destroy has to be confirmed as well --- test/fixtures/nodes.yml | 13 +++++++++++-- test/fixtures/pages.yml | 7 ++++++- test/functional/nodes_controller_test.rb | 22 ++++++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/fixtures/nodes.yml b/test/fixtures/nodes.yml index 8574c1b..a0e185b 100644 --- a/test/fixtures/nodes.yml +++ b/test/fixtures/nodes.yml @@ -3,7 +3,7 @@ root: id: 1 lft: 1 - rgt: 8 + rgt: 10 parent_id: slug: unique_name: @@ -34,4 +34,13 @@ third_child: parent_id: 1 draft_id: 102 slug: third_child - unique_name: third_child \ No newline at end of file + unique_name: third_child + +fourth_child: + id: 5 + lft: 8 + rgt: 9 + parent_id: 1 + draft_id: 103 + slug: fourth_child + unique_name: fourth_child \ No newline at end of file diff --git a/test/fixtures/pages.yml b/test/fixtures/pages.yml index 8171b38..271c494 100644 --- a/test/fixtures/pages.yml +++ b/test/fixtures/pages.yml @@ -23,4 +23,9 @@ draft2: draft3: id: 102 revision: 1 - node_id: 4 \ No newline at end of file + node_id: 4 + +draft4: + id: 103 + revision: 1 + node_id: 5 \ No newline at end of file diff --git a/test/functional/nodes_controller_test.rb b/test/functional/nodes_controller_test.rb index ed8afd8..afe7576 100644 --- a/test/functional/nodes_controller_test.rb +++ b/test/functional/nodes_controller_test.rb @@ -22,6 +22,28 @@ class NodesControllerTest < ActionController::TestCase assert_redirected_to node_path(Node.last) end + def test_editing_a_node + login_as :quentin + + node = Node.find_by_unique_name("fourth_child") + + assert_equal 1, node.pages.length + + draft = node.find_or_create_draft( User.first ) + draft.title = "Hello" + draft.body = "World" + draft.save + node.publish_draft! + + get :edit, :id => node.id + assert_response :success + + node.reload + assert_equal 2, node.pages.length + assert_equal "Hello", node.find_or_create_draft( User.first ).title + assert_equal "World", node.find_or_create_draft( User.first ).body + end + def test_update_a_draft test_node = Node.create! :slug => "test_node" test_node.move_to_child_of Node.root -- cgit v1.3