From: Jean-Philippe Lang Date: Thu, 19 Apr 2012 08:01:28 +0000 (+0000) Subject: Additional tests for Principal scopes. X-Git-Tag: 2.0.0~169 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c88fbfbdadfa104fbd0859cc7a82cdf8394c81fa;p=redmine.git Additional tests for Principal scopes. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9446 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- 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')