]> source.dussan.org Git - redmine.git/commitdiff
Additional tests for Principal scopes.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 19 Apr 2012 08:01:28 +0000 (08:01 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 19 Apr 2012 08:01:28 +0000 (08:01 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9446 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/principal_test.rb

index f51527b0aedb61a1f112844dc0781d19b921fd72..bc7e9605b416dd74d3f5df0a16edf4296d369110 100644 (file)
@@ -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')