aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/mixin_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/mixin_test.rb')
-rw-r--r--activerecord/test/mixin_test.rb35
1 files changed, 16 insertions, 19 deletions
diff --git a/activerecord/test/mixin_test.rb b/activerecord/test/mixin_test.rb
index 69789a0cec..4fcc6b6fba 100644
--- a/activerecord/test/mixin_test.rb
+++ b/activerecord/test/mixin_test.rb
@@ -249,9 +249,24 @@ class TreeTest < Test::Unit::TestCase
assert mixins(:tree_1).children.include?(mixins(:tree_4))
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
- end
+ 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
def test_roots
assert_equal [mixins(:tree_1), mixins(:tree2_1), mixins(:tree3_1)], TreeMixin.roots
@@ -316,22 +331,4 @@ class TouchTest < Test::Unit::TestCase
Mixin.record_timestamps = true
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