Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

preload_over typo

  • Loading branch information...
commit 0c698e275f626d9fce7719d346c00add744fe75e 1 parent 81f56a3
@matthewvermaak authored
Showing with 15 additions and 1 deletion.
  1. +1 −1  lib/sanction/principal/over.rb
  2. +14 −0 test/unit/sanction_test.rb
View
2  lib/sanction/principal/over.rb
@@ -25,7 +25,7 @@ def over?(*args)
private
def preload_over(*args)
if args.include? Sanction::Role::Definition::ANY_TOKEN
- self.principal_roles.self {|r| r.permissionable_type != nil}
+ self.principal_roles.select {|r| r.permissionable_type != nil}
else
p_roles = []
args.each do |a|
View
14 test/unit/sanction_test.rb
@@ -599,4 +599,18 @@ def test_preload_roles_with_multiples
assert !person.has(:editor).over?(Magazine.first)
assert !person.has(:writer).over?(Magazine.last)
end
+
+ def test_preload_roles_with_any
+ Person.first.grant(:reader, Magazine.first)
+
+ person = Person.first :preload_roles => true
+ magazine = Magazine.first :preload_roles => true
+
+ Person.first.revoke(:reader, Magazine.first)
+
+ assert person.has?(:any)
+ assert magazine.with?(:any)
+ assert person.has(:any).over?(:any)
+ assert magazine.for(:any).with?(:any)
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.