Browse Source

remove Rails4 deprecated Relation#all from IssueTest#test_visible_and_nested_set_scopes and add awesome_nested_set regression test

git-svn-id: http://svn.redmine.org/redmine/trunk@12708 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/2.5.0
Toshi MARUYAMA 10 years ago
parent
commit
38fa36d23b
1 changed files with 17 additions and 1 deletions
  1. 17
    1
      test/unit/issue_test.rb

+ 17
- 1
test/unit/issue_test.rb View File

@@ -330,7 +330,23 @@ class IssueTest < ActiveSupport::TestCase
end

def test_visible_and_nested_set_scopes
assert_equal 0, Issue.find(1).descendants.visible.all.size
user = User.generate!
parent = Issue.generate!(:assigned_to => user)
assert parent.visible?(user)
child1 = Issue.generate!(:parent_issue_id => parent.id, :assigned_to => user)
child2 = Issue.generate!(:parent_issue_id => parent.id, :assigned_to => user)
parent.reload
child1.reload
child2.reload
assert child1.visible?(user)
assert child2.visible?(user)
assert_equal 2, parent.descendants.count
assert_equal 2, parent.descendants.visible(user).count
# awesome_nested_set 2-1-stable has regression.
# https://github.com/collectiveidea/awesome_nested_set/commit/3d5ac746542b564f6586c2316180254b088bebb6
# ActiveRecord::StatementInvalid: SQLite3::SQLException: ambiguous column name: lft:
assert_equal 2, parent.descendants.collect{|i| i}.size
assert_equal 2, parent.descendants.visible(user).collect{|i| i}.size
end

def test_open_scope

Loading…
Cancel
Save