-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New
self_and_ancestors_ids
method to get self id with ancestor_ids
- Loading branch information
Showing
2 changed files
with
6 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,8 +84,10 @@ def assert_mid_and_leaf_remain | |
u = User.find_or_create_by_path(%w([email protected] [email protected] [email protected])) | ||
u.descendant_ids.should == [] | ||
u.ancestor_ids.should == [u.parent.id, u.root.id] | ||
u.self_and_ancestor_ids.should == [u.parent.id, u.root.id] + [u.id] | ||
u.root.descendant_ids.should == [u.parent.id, u.id] | ||
u.root.ancestor_ids.should == [] | ||
u.root.self_and_ancestor_ids.should == [u.root.id] | ||
c1 = u.contracts.create! | ||
c2 = u.parent.contracts.create! | ||
u.root.indirect_contracts.to_a.should =~ [c1, c2] | ||
|
51b63ca
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 Thanks for this! Just used it today to cleanup some messy code.