From 6d4ce84772e150fd9950819ca2b0e84614e06763 Mon Sep 17 00:00:00 2001 From: hukl Date: Wed, 11 Nov 2009 14:57:26 +0100 Subject: implemented that pages now have an author and an editor --- test/functional/nodes_controller_test.rb | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'test/functional') diff --git a/test/functional/nodes_controller_test.rb b/test/functional/nodes_controller_test.rb index 4088986..113697a 100644 --- a/test/functional/nodes_controller_test.rb +++ b/test/functional/nodes_controller_test.rb @@ -310,4 +310,41 @@ class NodesControllerTest < ActionController::TestCase node.reload assert_equal node.pages[0].user, node.pages[1].user end + + test "editor and author are the same on a new node" do + login_as :quentin + node = create_node_with_draft + get :edit, :id => node.id + + node.reload + assert_equal "quentin", node.draft.user.login + assert_equal "quentin", node.draft.editor.login + end + + test "creating new draft alters the editor but keeps the author" do + node = create_node_with_published_page + assert_equal "quentin", node.head.user.login + + login_as :aaron + get :edit, :id => node.id + + node.reload + assert_equal "quentin", node.head.user.login + assert_equal "aaron", node.draft.editor.login + end + + test "unlocking and relocking changes editor if done by another user" do + node = create_node_with_published_page + draft = node.find_or_create_draft users(:quentin) + assert_equal draft.user.login, draft.editor.login + assert node.locked? + node.unlock! + + login_as :aaron + get :edit, :id => node.id + + node.reload + assert_equal "quentin", node.draft.user.login + assert_equal "aaron", node.draft.editor.login + end end -- cgit v1.3