summaryrefslogtreecommitdiffstats
path: root/test/unit/principal_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-19 08:01:28 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-19 08:01:28 +0000
commitc88fbfbdadfa104fbd0859cc7a82cdf8394c81fa (patch)
treeeaea65568c69f368c740d1cf3a2f3187dba40bfc /test/unit/principal_test.rb
parent424a70978ed71bb7ef6fbf6093d66ac67772651b (diff)
downloadredmine-c88fbfbdadfa104fbd0859cc7a82cdf8394c81fa.tar.gz
redmine-c88fbfbdadfa104fbd0859cc7a82cdf8394c81fa.zip
Additional tests for Principal scopes.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9446 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/principal_test.rb')
-rw-r--r--test/unit/principal_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/unit/principal_test.rb b/test/unit/principal_test.rb
index f51527b0a..bc7e9605b 100644
--- a/test/unit/principal_test.rb
+++ b/test/unit/principal_test.rb
@@ -33,12 +33,20 @@ class PrincipalTest < ActiveSupport::TestCase
assert_equal projects.map(&:principals).flatten.sort, Principal.member_of(projects).sort
end
+ def test_member_of_scope_should_be_empty_for_no_projects
+ assert_equal [], Principal.member_of([]).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
+ def test_not_member_of_scope_should_be_empty_for_no_projects
+ assert_equal [], Principal.not_member_of([]).sort
+ end
+
context "#like" do
setup do
Principal.generate!(:login => 'login')