From 69a37065f9f523c25bc4edb9c70a9b21578d46f6 Mon Sep 17 00:00:00 2001 From: hukl Date: Fri, 27 Feb 2009 16:53:11 +0100 Subject: more tests and fixes. always write tests - they are so good! --- test/functional/content_controller_test.rb | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'test/functional/content_controller_test.rb') diff --git a/test/functional/content_controller_test.rb b/test/functional/content_controller_test.rb index d64de60..2e0ee0e 100644 --- a/test/functional/content_controller_test.rb +++ b/test/functional/content_controller_test.rb @@ -2,6 +2,15 @@ require 'test_helper' class ContentControllerTest < ActionController::TestCase + def setup + @root = Node.find(1) + @first_child = Node.find(2) + @second_child = Node.find(3) + + @user1 = User.create :login => 'demo', :email => "f@b.com", :password => 'foobar', :password_confirmation => 'foobar' + @user2 = User.create :login => 'show', :email => "f@b.com", :password => 'foobar', :password_confirmation => 'foobar' + end + def test_custom_page_route assert_recognizes({ :controller => 'content', :action => 'render_page', :locale => 'de', :page_path => ['foo', 'bar'] }, '/de/foo/bar') assert_recognizes({ :controller => 'content', :action => 'render_page', :locale => 'en', :page_path => ['home'] }, '/en/home') @@ -23,4 +32,35 @@ class ContentControllerTest < ActionController::TestCase assert_response :success assert_equal "layouts/application", @response.layout end + + 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! + + d2 = @second_child.find_or_create_draft @user1 + d2.title = "two" + d2.tag_list = "update" + d2.save + @second_child.publish_draft! + + get :render_page, :locale => 'de', :page_path => ["first_child"] + assert_response :success + + assert_select("h2", "one") + assert_select("h2", "two") + end + + + + protected + + def create_update + + end end -- cgit v1.3