From 1de97a5ac6f4621f8013d6f73c6c9edfae445b70 Mon Sep 17 00:00:00 2001 From: hukl Date: Sun, 15 Nov 2009 14:31:52 +0100 Subject: removed date and author from the standard template and introduced a dedicated update template which will get auto assigned if a node is created under updates// Added tests and convenient method --- test/unit/node_test.rb | 13 +++++++++++++ test/unit/page_test.rb | 9 +++++++++ 2 files changed, 22 insertions(+) (limited to 'test') diff --git a/test/unit/node_test.rb b/test/unit/node_test.rb index dd010cd..a106856 100644 --- a/test/unit/node_test.rb +++ b/test/unit/node_test.rb @@ -263,6 +263,19 @@ class NodeTest < ActiveSupport::TestCase assert_equal "quentin", node.head.user.login end + + test "update?" do + Node.root.descendants.delete_all + updates = Node.root.children.create!( :slug => "updates" ) + assert !updates.update? + + updates2009 = updates.children.create!( :slug => "2009" ) + assert !updates2009.update? + + update = updates2009.children.create!( :slug => "my-first-update" ) + assert update.update? + end + def create_revisions node, count count.times do node.find_or_create_draft @user1 diff --git a/test/unit/page_test.rb b/test/unit/page_test.rb index c2599e3..bb82da0 100644 --- a/test/unit/page_test.rb +++ b/test/unit/page_test.rb @@ -134,4 +134,13 @@ class PageTest < ActiveSupport::TestCase assert_equal 1, Page.find_with_outdated_translations(:delta_time => 23.minutes).count assert_equal 2, Page.count end + + test "pages under /updates node get the update template assigned" do + Node.root.descendants.delete_all + updates = Node.root.children.create!( :slug => "updates" ) + updates2009 = updates.children.create!( :slug => "2009" ) + update = updates2009.children.create!( :slug => "my-first-update" ) + assert_equal "update", update.draft.template_name + end + end -- cgit v1.3