mirror of
https://github.com/redmine/redmine.git
synced 2025-11-15 09:46:02 +01:00
Principal.not_member_of scope does not accept ActiveRecord::Relation (#28243).
git-svn-id: https://svn.redmine.org/redmine/trunk@22697 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -76,6 +76,12 @@ class PrincipalTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
def test_not_member_of_scope_should_accept_active_record_relation
|
||||
projects = Project.where(id: [1, 2])
|
||||
expected = (Principal.all - projects.map(&:memberships).flatten.map(&:principal)).sort
|
||||
assert_equal expected, Principal.not_member_of(projects).sort
|
||||
end
|
||||
|
||||
def test_not_member_of_scope_should_be_empty_for_no_projects
|
||||
assert_equal [], Principal.not_member_of([]).sort
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user