1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix tests

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2187 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2005-09-11 06:25:17 +00:00
parent 3e00e1a297
commit 1472bf273d

View file

@ -249,8 +249,23 @@ class TreeTest < Test::Unit::TestCase
assert mixins(:tree_1).children.include?(mixins(:tree_4)) assert mixins(:tree_1).children.include?(mixins(:tree_4))
end end
def test_ancestors
assert_equal [], mixins(:tree_1).ancestors
assert_equal [mixins(:tree_1)], mixins(:tree_2).ancestors
assert_equal [mixins(:tree_2), mixins(:tree_1)], mixins(:tree_3).ancestors
assert_equal [mixins(:tree_1)], mixins(:tree_4).ancestors
assert_equal [], mixins(:tree2_1).ancestors
assert_equal [], mixins(:tree3_1).ancestors
end
def test_root def test_root
assert_equal mixins(:tree_1), TreeMixin.root assert_equal mixins(:tree_1), TreeMixin.root
assert_equal mixins(:tree_1), mixins(:tree_1).root
assert_equal mixins(:tree_1), mixins(:tree_2).root
assert_equal mixins(:tree_1), mixins(:tree_3).root
assert_equal mixins(:tree_1), mixins(:tree_4).root
assert_equal mixins(:tree2_1), mixins(:tree2_1).root
assert_equal mixins(:tree3_1), mixins(:tree3_1).root
end end
def test_roots def test_roots
@ -316,22 +331,4 @@ class TouchTest < Test::Unit::TestCase
Mixin.record_timestamps = true Mixin.record_timestamps = true
end end
def test_ancestors
assert_equal [], mixins(:tree_1).ancestors
assert_equal [mixins(:tree_1)], mixins(:tree_2).ancestors
assert_equal [mixins(:tree_2), mixins(:tree_1)], mixins(:tree_3).ancestors
assert_equal [mixins(:tree_1)], mixins(:tree_4).ancestors
assert_equal [], mixins(:tree2_1).ancestors
assert_equal [], mixins(:tree3_1).ancestors
end
def test_root
assert_equal mixins(:tree_1), TreeMixin.root
assert_equal mixins(:tree_1), mixins(:tree_1).root
assert_equal mixins(:tree_1), mixins(:tree_2).root
assert_equal mixins(:tree_1), mixins(:tree_3).root
assert_equal mixins(:tree_1), mixins(:tree_4).root
assert_equal mixins(:tree2_1), mixins(:tree2_1).root
assert_equal mixins(:tree3_1), mixins(:tree3_1).root
end
end end