From 20056a0e9b4f96680ca0c643166885f65dcd0be7 Mon Sep 17 00:00:00 2001 From: hukl Date: Tue, 20 Oct 2009 23:30:39 +0200 Subject: allow to overwrite the original user in edit view --- test/unit/node_test.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/unit/node_test.rb') diff --git a/test/unit/node_test.rb b/test/unit/node_test.rb index 92870aa..77e9cad 100644 --- a/test/unit/node_test.rb +++ b/test/unit/node_test.rb @@ -230,6 +230,31 @@ class NodeTest < ActiveSupport::TestCase assert_equal 4, test_node.draft.revision end + test "a new revision keeps the initial user" do + Node.root.descendants.destroy_all + node = create_node_with_draft + draft = node.draft + draft.user = users(:aaron) + draft.save + node.publish_draft! + new_draft = node.find_or_create_draft( users(:quentin) ) + assert_equal "aaron", new_draft.user.login + end + + test "a new revision can overwrite the initial author" do + Node.root.descendants.destroy_all + node = create_node_with_draft + draft = node.draft + draft.user = users(:aaron) + draft.save + node.publish_draft! + new_draft = node.find_or_create_draft( users(:quentin) ) + new_draft.user_id = users(:quentin).id + new_draft.save + node.publish_draft! + assert_equal "quentin", node.head.user.login + end + def create_revisions node, count count.times do node.find_or_create_draft @user1 -- cgit v1.3