From 295981868813b6b7d104d100d45c0e2320cd52b5 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Fri, 27 Dec 2013 03:25:49 +0000 Subject: [PATCH] fix find_all_by_id(n1, n2) parameter at test_not_member_of_scope_should_return_users_that_have_no_memberships of PrincipalTest find_all_by_id(n1, n2) returns only n1 result. git-svn-id: http://svn.redmine.org/redmine/trunk@12468 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/principal_test.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/unit/principal_test.rb b/test/unit/principal_test.rb index 02742b0f3..bbf871050 100644 --- a/test/unit/principal_test.rb +++ b/test/unit/principal_test.rb @@ -40,9 +40,12 @@ class PrincipalTest < ActiveSupport::TestCase end def test_not_member_of_scope_should_return_users_that_have_no_memberships - projects = Project.find_all_by_id(1, 2) - expected = (Principal.all - projects.map(&:memberships).flatten.map(&:principal)).sort - assert_equal expected, Principal.not_member_of(projects).sort + [[1], [1, 2]].each do |ids| + projects = Project.find(ids) + assert_equal ids.size, projects.count + expected = (Principal.all - projects.map(&:memberships).flatten.map(&:principal)).sort + assert_equal expected, Principal.not_member_of(projects).sort + end end def test_not_member_of_scope_should_be_empty_for_no_projects