Simplifies Principal.active scope (status defaults to 1 for groups).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8746 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-02-01 19:35:49 +00:00
parent 5dd08133ef
commit 0154d7477b
2 changed files with 9 additions and 1 deletions
+8
View File
@@ -19,6 +19,14 @@ require File.expand_path('../../test_helper', __FILE__)
class PrincipalTest < ActiveSupport::TestCase
def test_active_scope_should_return_groups_and_active_users
result = Principal.active.all
assert_include Group.first, result
assert_not_nil result.detect {|p| p.is_a?(User)}
assert_nil result.detect {|p| p.is_a?(User) && !p.active?}
assert_nil result.detect {|p| p.is_a?(AnonymousUser)}
end
context "#like" do
setup do
Principal.generate!(:login => 'login')