lib/action_policy/testing.rb in action_policy-0.4.0 vs lib/action_policy/testing.rb in action_policy-0.4.1

- old
+ new

@@ -1,9 +1,20 @@ # frozen_string_literal: true module ActionPolicy # Testing utils module Testing + # Hack to match both classes and composed matchers: + # be_authorized_to(:create?, User) + # be_authorized_to(:maanage?, an_instance_of(User)) + using(Module.new do + refine Module do + def ===(other) + self == other + end + end + end) + # Collects all Authorizer calls module AuthorizeTracker class Call # :nodoc: attr_reader :policy, :rule