aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2005-10-09 18:51:30 +0000
committerMarcel Molina <marcel@vernix.org>2005-10-09 18:51:30 +0000
commitc8e364a93f6c2de80fb56ddf2f6a46b6e96f4a9d (patch)
treec951660f1eee0891fccd6f765ae78e6919859cff /activerecord/test
parent5ef931a4b879ed2f380b393000edbdb4c50f8150 (diff)
downloadrails-c8e364a93f6c2de80fb56ddf2f6a46b6e96f4a9d.tar.gz
rails-c8e364a93f6c2de80fb56ddf2f6a46b6e96f4a9d.tar.bz2
rails-c8e364a93f6c2de80fb56ddf2f6a46b6e96f4a9d.zip
Add ability to get all siblings, including the current child, with acts_as_tree. Recloses #2140.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2507 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/mixin_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/mixin_test.rb b/activerecord/test/mixin_test.rb
index 4fcc6b6fba..b551fb4402 100644
--- a/activerecord/test/mixin_test.rb
+++ b/activerecord/test/mixin_test.rb
@@ -280,6 +280,15 @@ class TreeTest < Test::Unit::TestCase
assert_equal [mixins(:tree_1), mixins(:tree3_1)], mixins(:tree2_1).siblings
assert_equal [mixins(:tree_1), mixins(:tree2_1)], mixins(:tree3_1).siblings
end
+
+ def test_self_and_siblings
+ assert_equal [mixins(:tree_1), mixins(:tree2_1), mixins(:tree3_1)], mixins(:tree_1).self_and_siblings
+ assert_equal [mixins(:tree_2), mixins(:tree_4)], mixins(:tree_2).self_and_siblings
+ assert_equal [mixins(:tree_3)], mixins(:tree_3).self_and_siblings
+ assert_equal [mixins(:tree_2), mixins(:tree_4)], mixins(:tree_4).self_and_siblings
+ assert_equal [mixins(:tree_1), mixins(:tree2_1), mixins(:tree3_1)], mixins(:tree2_1).self_and_siblings
+ assert_equal [mixins(:tree_1), mixins(:tree2_1), mixins(:tree3_1)], mixins(:tree3_1).self_and_siblings
+ end
end
class TouchTest < Test::Unit::TestCase