@@ -330,7 +330,23 class IssueTest < ActiveSupport::TestCase | |||
|
330 | 330 | end |
|
331 | 331 | |
|
332 | 332 | def test_visible_and_nested_set_scopes |
|
333 | assert_equal 0, Issue.find(1).descendants.visible.all.size | |
|
333 | user = User.generate! | |
|
334 | parent = Issue.generate!(:assigned_to => user) | |
|
335 | assert parent.visible?(user) | |
|
336 | child1 = Issue.generate!(:parent_issue_id => parent.id, :assigned_to => user) | |
|
337 | child2 = Issue.generate!(:parent_issue_id => parent.id, :assigned_to => user) | |
|
338 | parent.reload | |
|
339 | child1.reload | |
|
340 | child2.reload | |
|
341 | assert child1.visible?(user) | |
|
342 | assert child2.visible?(user) | |
|
343 | assert_equal 2, parent.descendants.count | |
|
344 | assert_equal 2, parent.descendants.visible(user).count | |
|
345 | # awesome_nested_set 2-1-stable has regression. | |
|
346 | # https://github.com/collectiveidea/awesome_nested_set/commit/3d5ac746542b564f6586c2316180254b088bebb6 | |
|
347 | # ActiveRecord::StatementInvalid: SQLite3::SQLException: ambiguous column name: lft: | |
|
348 | assert_equal 2, parent.descendants.collect{|i| i}.size | |
|
349 | assert_equal 2, parent.descendants.visible(user).collect{|i| i}.size | |
|
334 | 350 | end |
|
335 | 351 | |
|
336 | 352 | def test_open_scope |
General Comments 0
You need to be logged in to leave comments.
Login now