summaryrefslogtreecommitdiff
path: root/test/unit/node_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/node_test.rb')
-rw-r--r--test/unit/node_test.rb47
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 @@
1require 'test_helper' 1require 'test_helper'
2 2
3class NodeTest < ActiveSupport::TestCase 3class 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
8end 49end