diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-03-06 18:37:30 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-03-06 18:37:30 +0000 |
commit | 6aad82e524c1b2cc8afc3299e129b239f834105b (patch) | |
tree | 44f8b8999729f2bc21ad28fc2991ac780623b7cc /test/unit/principal_test.rb | |
parent | b7555bd1ff6b738590679ca7c3fd00d2297a1c74 (diff) | |
download | redmine-6aad82e524c1b2cc8afc3299e129b239f834105b.tar.gz redmine-6aad82e524c1b2cc8afc3299e129b239f834105b.zip |
Fixed that the proposed users list may be empty when adding a project member (#10374).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9128 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/principal_test.rb')
-rw-r--r-- | test/unit/principal_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/unit/principal_test.rb b/test/unit/principal_test.rb index c33286208..f51527b0a 100644 --- a/test/unit/principal_test.rb +++ b/test/unit/principal_test.rb @@ -18,6 +18,7 @@ require File.expand_path('../../test_helper', __FILE__) class PrincipalTest < ActiveSupport::TestCase + fixtures :users, :projects, :members, :member_roles def test_active_scope_should_return_groups_and_active_users result = Principal.active.all @@ -32,6 +33,12 @@ class PrincipalTest < ActiveSupport::TestCase assert_equal projects.map(&:principals).flatten.sort, Principal.member_of(projects).sort 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 + end + context "#like" do setup do Principal.generate!(:login => 'login') |