-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove self and decendants from the parent feed selector, closing #89.
The self link is the only one that is really problematic, but intuitively we don't want users to hang the tree from the tree without doing some thinking beforehand.
- Loading branch information
Showing
3 changed files
with
35 additions
and
6 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
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 |
---|---|---|
@@ -1,4 +1,29 @@ | ||
require 'test_helper' | ||
|
||
class FeedsHelperTest < ActionView::TestCase | ||
|
||
test 'default dfs tree' do | ||
tree = dfs_tree() | ||
assert_equal tree.length, Feed.all.length | ||
|
||
i = tree.index(feeds(:announcements)) | ||
j = tree.index(feeds(:boring_announcements)) | ||
assert_equal tree[j+1], feeds(:sleepy_announcements) | ||
|
||
if j-i == 1 | ||
offset = j+2 | ||
else | ||
offset = i+1 | ||
end | ||
assert_equal tree[offset], feeds(:important_announcements) | ||
end | ||
|
||
test 'excluding dfs tree' do | ||
feed = feeds(:boring_announcements) | ||
tree = dfs_tree(Feed.roots, feed) | ||
assert_equal tree.length, Feed.all.length-2 | ||
|
||
assert !tree.include?(feeds(:boring_announcements)) | ||
assert !tree.include?(feeds(:sleepy_announcements)) | ||
end | ||
end |