lib/pundit/matchers.rb in pundit-matchers-1.9.0 vs lib/pundit/matchers.rb in pundit-matchers-2.0.0

- old
+ new

@@ -24,16 +24,16 @@ def configuration @configuration ||= Pundit::Matchers::Configuration.new end end - RSpec::Matchers.define :forbid_action do |action, *args| + RSpec::Matchers.define :forbid_action do |action, *args, **kwargs| match do |policy| if args.any? - !policy.public_send("#{action}?", *args) + !policy.public_send("#{action}?", *args, **kwargs) else - !policy.public_send("#{action}?") + !policy.public_send("#{action}?", **kwargs) end end failure_message do |policy| "#{policy.class} does not forbid #{action} for " + @@ -187,15 +187,15 @@ policy.public_send(Pundit::Matchers.configuration.user_alias) .inspect + '.' end end - RSpec::Matchers.define :permit_action do |action, *args| + RSpec::Matchers.define :permit_action do |action, *args, **kwargs| match do |policy| if args.any? - policy.public_send("#{action}?", *args) + policy.public_send("#{action}?", *args, **kwargs) else - policy.public_send("#{action}?") + policy.public_send("#{action}?", **kwargs) end end failure_message do |policy| "#{policy.class} does not permit #{action} for " +