summaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-10-20 23:30:39 +0200
committerhukl <contact@smyck.org>2009-10-20 23:30:39 +0200
commit20056a0e9b4f96680ca0c643166885f65dcd0be7 (patch)
treea52396b8781ceacfbc33715d6b360a9bb32a77a7 /test/unit
parent8d8b530e2c9f5e2debb2d6abb421187c31733c34 (diff)
allow to overwrite the original user in edit view
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/node_test.rb25
1 files changed, 25 insertions, 0 deletions
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
230 assert_equal 4, test_node.draft.revision 230 assert_equal 4, test_node.draft.revision
231 end 231 end
232 232
233 test "a new revision keeps the initial user" do
234 Node.root.descendants.destroy_all
235 node = create_node_with_draft
236 draft = node.draft
237 draft.user = users(:aaron)
238 draft.save
239 node.publish_draft!
240 new_draft = node.find_or_create_draft( users(:quentin) )
241 assert_equal "aaron", new_draft.user.login
242 end
243
244 test "a new revision can overwrite the initial author" do
245 Node.root.descendants.destroy_all
246 node = create_node_with_draft
247 draft = node.draft
248 draft.user = users(:aaron)
249 draft.save
250 node.publish_draft!
251 new_draft = node.find_or_create_draft( users(:quentin) )
252 new_draft.user_id = users(:quentin).id
253 new_draft.save
254 node.publish_draft!
255 assert_equal "quentin", node.head.user.login
256 end
257
233 def create_revisions node, count 258 def create_revisions node, count
234 count.times do 259 count.times do
235 node.find_or_create_draft @user1 260 node.find_or_create_draft @user1