From cc74db30d930b0eaaf0ac29b19ddd452ea0c1462 Mon Sep 17 00:00:00 2001 From: hukl Date: Sat, 28 Feb 2009 12:48:42 +0100 Subject: a little test refactoring as preparation for aggregator tests with different partials --- test/functional/content_controller_test.rb | 39 +++++++++++++++++++----------- 1 file changed, 25 insertions(+), 14 deletions(-) (limited to 'test/functional') diff --git a/test/functional/content_controller_test.rb b/test/functional/content_controller_test.rb index 2e0ee0e..cb6ad04 100644 --- a/test/functional/content_controller_test.rb +++ b/test/functional/content_controller_test.rb @@ -36,20 +36,15 @@ class ContentControllerTest < ActionController::TestCase def test_page_containing_aggregator assert_not_nil Node.root - d1 = @first_child.find_or_create_draft @user1 - d1.title = "one" - d1.tag_list = "update" - d1.body = '' - d1.save - @first_child.publish_draft! + fill_pages_with_content - d2 = @second_child.find_or_create_draft @user1 - d2.title = "two" - d2.tag_list = "update" - d2.save - @second_child.publish_draft! + new_node = create_node_under_root "fnord" + draft = new_node.find_or_create_draft @user1 + draft.body = '' + draft.save + new_node.publish_draft! - get :render_page, :locale => 'de', :page_path => ["first_child"] + get :render_page, :locale => 'de', :page_path => ["fnord"] assert_response :success assert_select("h2", "one") @@ -60,7 +55,23 @@ class ContentControllerTest < ActionController::TestCase protected - def create_update - + def create_node_under_root slug + node = Node.create! :slug => slug + node.move_to_child_of Node.root + node + end + + def fill_pages_with_content + d1 = @first_child.find_or_create_draft @user1 + d1.title = "one" + d1.tag_list = "update" + d1.save + @first_child.publish_draft! + + d2 = @second_child.find_or_create_draft @user1 + d2.title = "two" + d2.tag_list = "update" + d2.save + @second_child.publish_draft! end end -- cgit v1.3