summaryrefslogtreecommitdiff
path: root/test/functional/nodes_controller_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/nodes_controller_test.rb')
-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