diff options
| author | hukl <hukl@eight.local> | 2009-01-31 13:05:48 +0100 |
|---|---|---|
| committer | hukl <hukl@eight.local> | 2009-01-31 13:05:48 +0100 |
| commit | 5b06d137fc6143ff679d1ce6048c4149ca23f4e2 (patch) | |
| tree | c2945a13eb3376aabb0d610804bf7a8f972793e7 /test/unit/node_test.rb | |
| parent | be83d467b5b6f92b0a6a175ee365d043f250d631 (diff) | |
connected page and node model + some minor tweaks
Diffstat (limited to 'test/unit/node_test.rb')
| -rw-r--r-- | test/unit/node_test.rb | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/test/unit/node_test.rb b/test/unit/node_test.rb index a311b84..14fdad0 100644 --- a/test/unit/node_test.rb +++ b/test/unit/node_test.rb | |||
| @@ -1,8 +1,49 @@ | |||
| 1 | require 'test_helper' | 1 | require 'test_helper' |
| 2 | 2 | ||
| 3 | class NodeTest < ActiveSupport::TestCase | 3 | class NodeTest < ActiveSupport::TestCase |
| 4 | # Replace this with your real tests. | 4 | |
| 5 | test "the truth" do | 5 | def setup |
| 6 | assert true | 6 | @root = Node.find(1) |
| 7 | @first_child = Node.find(2) | ||
| 8 | end | ||
| 9 | |||
| 10 | def test_creation_of_unique_name | ||
| 11 | node = Node.create :slug => 'child' | ||
| 12 | node.move_to_child_of @root | ||
| 13 | node.reload | ||
| 14 | assert_equal 'child', node.unique_name | ||
| 15 | |||
| 16 | node = Node.create :slug => 'deep_child' | ||
| 17 | node.move_to_child_of @first_child | ||
| 18 | node.reload | ||
| 19 | assert_equal 'my_first_page/deep_child', node.unique_name | ||
| 20 | end | ||
| 21 | |||
| 22 | def test_retrieving_page_current | ||
| 23 | |||
| 24 | end | ||
| 25 | |||
| 26 | def test_retrieving_page_by_revision | ||
| 27 | |||
| 28 | end | ||
| 29 | |||
| 30 | def test_behavior_of_acts_as_list | ||
| 31 | one = @first_child.pages.create :title => "one" | ||
| 32 | two = @first_child.pages.create :title => "two" | ||
| 33 | three = @first_child.pages.create :title => "three" | ||
| 34 | |||
| 35 | assert_equal 1, one.revision | ||
| 36 | assert_equal 2, two.revision | ||
| 37 | assert_equal 3, three.revision | ||
| 38 | |||
| 39 | assert_equal three, @first_child.pages.last | ||
| 40 | |||
| 41 | assert one.move_to_bottom | ||
| 42 | |||
| 43 | one.reload; two.reload; three.reload; | ||
| 44 | |||
| 45 | assert_equal 3, one.revision | ||
| 46 | assert_equal 1, two.revision | ||
| 47 | assert_equal 2, three.revision | ||
| 7 | end | 48 | end |
| 8 | end | 49 | end |
