From 38fa36d23bd5432a2a2700659f29c00a47ab9ab4 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sun, 26 Jan 2014 09:05:59 +0000 Subject: [PATCH] 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 --- test/unit/issue_test.rb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index c71da6e44..d52fb3940 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -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 -- 2.39.5