pundit-matchers 1.2.3 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pundit/matchers.rb +12 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57370d1383a4f4ae8bda97736537fc8fa39ad896
4
- data.tar.gz: 397aebb87f9d1a2b3c31944fff1982f4b22ce7c7
3
+ metadata.gz: 9c6d515893a90543a9818a800398de7a5c03abbd
4
+ data.tar.gz: 97f2989074096be5df9b6875cf42d071296fd302
5
5
  SHA512:
6
- metadata.gz: ea4681e33c44a1f372c37c3f18995277cd0c2808c8d6458024e364cf285fb30d833702b4d9aad496166458072dd3225716fb16b1a3e7579cb76dd306abc964a7
7
- data.tar.gz: 2e77a4a17c8dfbb546d81f4ed2b5f01aa4b207f9fa3e549deebeb1eca81cbe6a19c9f9898df777516e68fa7dd00a55454ef701f24ebba856c2eced6f3f80eb53
6
+ metadata.gz: 5c19a0dff1eaf4efcb1f6f8bd0e081dd8439344d27872c120df7aed9290addfb91bd685497a7a7d37432c0344bd5282b5b751b41e5d76583114937b8f3d4dbf1
7
+ data.tar.gz: b954d73c45e45b4c97242e91971940933d7cc5203fcc651affa8a10e9b4a1dd2e436c919818622b9ca4f5a9543f094a68d83285181ce337ecde705248ac15fa0
@@ -2,9 +2,13 @@ require 'rspec/core'
2
2
 
3
3
  module Pundit
4
4
  module Matchers
5
- RSpec::Matchers.define :forbid_action do |action|
5
+ RSpec::Matchers.define :forbid_action do |action, *args|
6
6
  match do |policy|
7
- !policy.public_send("#{action}?")
7
+ if args.any?
8
+ !policy.public_send("#{action}?", *args)
9
+ else
10
+ !policy.public_send("#{action}?")
11
+ end
8
12
  end
9
13
 
10
14
  failure_message do |policy|
@@ -128,9 +132,13 @@ module Pundit
128
132
  end
129
133
  end
130
134
 
131
- RSpec::Matchers.define :permit_action do |action|
135
+ RSpec::Matchers.define :permit_action do |action, *args|
132
136
  match do |policy|
133
- policy.public_send("#{action}?")
137
+ if args.any?
138
+ policy.public_send("#{action}?", *args)
139
+ else
140
+ policy.public_send("#{action}?")
141
+ end
134
142
  end
135
143
 
136
144
  failure_message do |policy|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pundit-matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Alley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-13 00:00:00.000000000 Z
11
+ date: 2017-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pundit