diff options
Diffstat (limited to 'test/controllers/nodes_controller_test.rb')
| -rw-r--r-- | test/controllers/nodes_controller_test.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/test/controllers/nodes_controller_test.rb b/test/controllers/nodes_controller_test.rb index 81e3f45..9da9514 100644 --- a/test/controllers/nodes_controller_test.rb +++ b/test/controllers/nodes_controller_test.rb | |||
| @@ -89,7 +89,7 @@ class NodesControllerTest < ActionController::TestCase | |||
| 89 | 89 | ||
| 90 | assert_equal 1, node.pages.length | 90 | assert_equal 1, node.pages.length |
| 91 | 91 | ||
| 92 | draft = node.find_or_create_draft( User.first ) | 92 | draft = find_or_create_draft(node, User.first) |
| 93 | draft.title = "Hello" | 93 | draft.title = "Hello" |
| 94 | draft.body = "World" | 94 | draft.body = "World" |
| 95 | draft.save | 95 | draft.save |
| @@ -102,8 +102,8 @@ class NodesControllerTest < ActionController::TestCase | |||
| 102 | 102 | ||
| 103 | node.reload | 103 | node.reload |
| 104 | assert_equal 1, node.pages.length | 104 | assert_equal 1, node.pages.length |
| 105 | assert_equal "Hello", node.find_or_create_draft( User.first ).title | 105 | assert_equal "Hello", find_or_create_draft(node, User.first).title |
| 106 | assert_equal "World", node.find_or_create_draft( User.first ).body | 106 | assert_equal "World", find_or_create_draft(node, User.first).body |
| 107 | end | 107 | end |
| 108 | 108 | ||
| 109 | test "editing a locked node raises LockedByAnotherUser Exception" do | 109 | test "editing a locked node raises LockedByAnotherUser Exception" do |
| @@ -228,7 +228,7 @@ class NodesControllerTest < ActionController::TestCase | |||
| 228 | test "unlocking a locked node" do | 228 | test "unlocking a locked node" do |
| 229 | login_as :quentin | 229 | login_as :quentin |
| 230 | node = create_node_with_published_page | 230 | node = create_node_with_published_page |
| 231 | node.find_or_create_draft User.first | 231 | find_or_create_draft(node, User.first) |
| 232 | 232 | ||
| 233 | assert node.locked? | 233 | assert node.locked? |
| 234 | 234 | ||
| @@ -250,7 +250,7 @@ class NodesControllerTest < ActionController::TestCase | |||
| 250 | Node.root.descendants.destroy_all | 250 | Node.root.descendants.destroy_all |
| 251 | login_as :quentin | 251 | login_as :quentin |
| 252 | node = create_node_with_published_page | 252 | node = create_node_with_published_page |
| 253 | node.find_or_create_draft User.first | 253 | find_or_create_draft(node, User.first) |
| 254 | 254 | ||
| 255 | other_node = Node.root.children.create( :slug => "other" ) | 255 | other_node = Node.root.children.create( :slug => "other" ) |
| 256 | 256 | ||
| @@ -274,7 +274,7 @@ class NodesControllerTest < ActionController::TestCase | |||
| 274 | Node.root.descendants.destroy_all | 274 | Node.root.descendants.destroy_all |
| 275 | node = create_node_with_published_page | 275 | node = create_node_with_published_page |
| 276 | assert_equal "quentin", node.head.user.login | 276 | assert_equal "quentin", node.head.user.login |
| 277 | node.find_or_create_draft users(:quentin) | 277 | find_or_create_draft(node, users(:quentin)) |
| 278 | assert node.draft.valid? | 278 | assert node.draft.valid? |
| 279 | assert node.valid? | 279 | assert node.valid? |
| 280 | 280 | ||
| @@ -336,7 +336,7 @@ class NodesControllerTest < ActionController::TestCase | |||
| 336 | 336 | ||
| 337 | test "unlocking and relocking changes editor if done by another user" do | 337 | test "unlocking and relocking changes editor if done by another user" do |
| 338 | node = create_node_with_published_page | 338 | node = create_node_with_published_page |
| 339 | draft = node.find_or_create_draft users(:quentin) | 339 | draft = find_or_create_draft(node, users(:quentin)) |
| 340 | assert_equal draft.user.login, draft.editor.login | 340 | assert_equal draft.user.login, draft.editor.login |
| 341 | assert node.locked? | 341 | assert node.locked? |
| 342 | node.unlock! | 342 | node.unlock! |
| @@ -481,13 +481,13 @@ class NodesControllerTest < ActionController::TestCase | |||
| 481 | 481 | ||
| 482 | test "chapters filters by kind, matching head or draft, and shows both by default" do | 482 | test "chapters filters by kind, matching head or draft, and shows both by default" do |
| 483 | erfa_node = Node.root.children.create!(:slug => "chapters_erfa_test") | 483 | erfa_node = Node.root.children.create!(:slug => "chapters_erfa_test") |
| 484 | erfa_node.find_or_create_draft(@user1) | 484 | find_or_create_draft(erfa_node, @user1) |
| 485 | erfa_node.draft.tag_list = "erfa-detail" | 485 | erfa_node.draft.tag_list = "erfa-detail" |
| 486 | erfa_node.draft.save! | 486 | erfa_node.draft.save! |
| 487 | erfa_node.publish_draft! | 487 | erfa_node.publish_draft! |
| 488 | 488 | ||
| 489 | chaostreff_node = Node.root.children.create!(:slug => "chapters_chaostreff_test") | 489 | chaostreff_node = Node.root.children.create!(:slug => "chapters_chaostreff_test") |
| 490 | chaostreff_node.find_or_create_draft(@user1) | 490 | find_or_create_draft(chaostreff_node, @user1) |
| 491 | chaostreff_node.draft.tag_list = "chaostreff-detail" | 491 | chaostreff_node.draft.tag_list = "chaostreff-detail" |
| 492 | chaostreff_node.draft.save! | 492 | chaostreff_node.draft.save! |
| 493 | chaostreff_node.publish_draft! | 493 | chaostreff_node.publish_draft! |
| @@ -549,13 +549,13 @@ class NodesControllerTest < ActionController::TestCase | |||
| 549 | 549 | ||
| 550 | test "tags path filters by an arbitrary raw tag, generalizing chapters" do | 550 | test "tags path filters by an arbitrary raw tag, generalizing chapters" do |
| 551 | presse_node = Node.root.children.create!(:slug => "tags_path_presse_test") | 551 | presse_node = Node.root.children.create!(:slug => "tags_path_presse_test") |
| 552 | presse_node.find_or_create_draft(@user1) | 552 | find_or_create_draft(presse_node, @user1) |
| 553 | presse_node.draft.tag_list = "pressemitteilung" | 553 | presse_node.draft.tag_list = "pressemitteilung" |
| 554 | presse_node.draft.save! | 554 | presse_node.draft.save! |
| 555 | presse_node.publish_draft! | 555 | presse_node.publish_draft! |
| 556 | 556 | ||
| 557 | erfa_node = Node.root.children.create!(:slug => "tags_path_erfa_test") | 557 | erfa_node = Node.root.children.create!(:slug => "tags_path_erfa_test") |
| 558 | erfa_node.find_or_create_draft(@user1) | 558 | find_or_create_draft(erfa_node, @user1) |
| 559 | erfa_node.draft.tag_list = "erfa-detail" | 559 | erfa_node.draft.tag_list = "erfa-detail" |
| 560 | erfa_node.draft.save! | 560 | erfa_node.draft.save! |
| 561 | erfa_node.publish_draft! | 561 | erfa_node.publish_draft! |
| @@ -572,13 +572,13 @@ class NodesControllerTest < ActionController::TestCase | |||
| 572 | 572 | ||
| 573 | test "tags path with multiple tags matches any of them, not all" do | 573 | test "tags path with multiple tags matches any of them, not all" do |
| 574 | erfa_node = Node.root.children.create!(:slug => "tags_path_multi_erfa_test") | 574 | erfa_node = Node.root.children.create!(:slug => "tags_path_multi_erfa_test") |
| 575 | erfa_node.find_or_create_draft(@user1) | 575 | find_or_create_draft(erfa_node, @user1) |
| 576 | erfa_node.draft.tag_list = "erfa-detail" | 576 | erfa_node.draft.tag_list = "erfa-detail" |
| 577 | erfa_node.draft.save! | 577 | erfa_node.draft.save! |
| 578 | erfa_node.publish_draft! | 578 | erfa_node.publish_draft! |
| 579 | 579 | ||
| 580 | chaostreff_node = Node.root.children.create!(:slug => "tags_path_multi_chaostreff_test") | 580 | chaostreff_node = Node.root.children.create!(:slug => "tags_path_multi_chaostreff_test") |
| 581 | chaostreff_node.find_or_create_draft(@user1) | 581 | find_or_create_draft(chaostreff_node, @user1) |
| 582 | chaostreff_node.draft.tag_list = "chaostreff-detail" | 582 | chaostreff_node.draft.tag_list = "chaostreff-detail" |
| 583 | chaostreff_node.draft.save! | 583 | chaostreff_node.draft.save! |
| 584 | chaostreff_node.publish_draft! | 584 | chaostreff_node.publish_draft! |
