diff options
| author | hukl <contact@smyck.org> | 2009-11-15 14:31:52 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-11-15 14:31:52 +0100 |
| commit | 1de97a5ac6f4621f8013d6f73c6c9edfae445b70 (patch) | |
| tree | ee500916af41898ff2ecaf5c8567acf7cfd0f867 /test | |
| parent | 713f8f76e2ae1635bb938de6d8c74587d842790f (diff) | |
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/<year>/<slug>
Added tests and convenient method
Diffstat (limited to 'test')
| -rw-r--r-- | test/unit/node_test.rb | 13 | ||||
| -rw-r--r-- | test/unit/page_test.rb | 9 |
2 files changed, 22 insertions, 0 deletions
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 | |||
| 263 | assert_equal "quentin", node.head.user.login | 263 | assert_equal "quentin", node.head.user.login |
| 264 | end | 264 | end |
| 265 | 265 | ||
| 266 | |||
| 267 | test "update?" do | ||
| 268 | Node.root.descendants.delete_all | ||
| 269 | updates = Node.root.children.create!( :slug => "updates" ) | ||
| 270 | assert !updates.update? | ||
| 271 | |||
| 272 | updates2009 = updates.children.create!( :slug => "2009" ) | ||
| 273 | assert !updates2009.update? | ||
| 274 | |||
| 275 | update = updates2009.children.create!( :slug => "my-first-update" ) | ||
| 276 | assert update.update? | ||
| 277 | end | ||
| 278 | |||
| 266 | def create_revisions node, count | 279 | def create_revisions node, count |
| 267 | count.times do | 280 | count.times do |
| 268 | node.find_or_create_draft @user1 | 281 | 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 | |||
| 134 | assert_equal 1, Page.find_with_outdated_translations(:delta_time => 23.minutes).count | 134 | assert_equal 1, Page.find_with_outdated_translations(:delta_time => 23.minutes).count |
| 135 | assert_equal 2, Page.count | 135 | assert_equal 2, Page.count |
| 136 | end | 136 | end |
| 137 | |||
| 138 | test "pages under /updates node get the update template assigned" do | ||
| 139 | Node.root.descendants.delete_all | ||
| 140 | updates = Node.root.children.create!( :slug => "updates" ) | ||
| 141 | updates2009 = updates.children.create!( :slug => "2009" ) | ||
| 142 | update = updates2009.children.create!( :slug => "my-first-update" ) | ||
| 143 | assert_equal "update", update.draft.template_name | ||
| 144 | end | ||
| 145 | |||
| 137 | end | 146 | end |
