summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-11-11 14:57:26 +0100
committerhukl <contact@smyck.org>2009-11-11 14:57:26 +0100
commit6d4ce84772e150fd9950819ca2b0e84614e06763 (patch)
tree391ad79e8c07b6f9c2b3909c99e1940e1f52db3e /test
parent357efd4a89ef5c39ec81aa75d7bc46d94a5fa257 (diff)
implemented that pages now have an author and an editor
Diffstat (limited to 'test')
-rw-r--r--test/functional/nodes_controller_test.rb37
1 files changed, 37 insertions, 0 deletions
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
310 node.reload 310 node.reload
311 assert_equal node.pages[0].user, node.pages[1].user 311 assert_equal node.pages[0].user, node.pages[1].user
312 end 312 end
313
314 test "editor and author are the same on a new node" do
315 login_as :quentin
316 node = create_node_with_draft
317 get :edit, :id => node.id
318
319 node.reload
320 assert_equal "quentin", node.draft.user.login
321 assert_equal "quentin", node.draft.editor.login
322 end
323
324 test "creating new draft alters the editor but keeps the author" do
325 node = create_node_with_published_page
326 assert_equal "quentin", node.head.user.login
327
328 login_as :aaron
329 get :edit, :id => node.id
330
331 node.reload
332 assert_equal "quentin", node.head.user.login
333 assert_equal "aaron", node.draft.editor.login
334 end
335
336 test "unlocking and relocking changes editor if done by another user" do
337 node = create_node_with_published_page
338 draft = node.find_or_create_draft users(:quentin)
339 assert_equal draft.user.login, draft.editor.login
340 assert node.locked?
341 node.unlock!
342
343 login_as :aaron
344 get :edit, :id => node.id
345
346 node.reload
347 assert_equal "quentin", node.draft.user.login
348 assert_equal "aaron", node.draft.editor.login
349 end
313end 350end