Class: AccessPolicy::RspecMatchers::PositivePolicyMatcher
- Inherits:
-
Object
- Object
- AccessPolicy::RspecMatchers::PositivePolicyMatcher
- Defined in:
- lib/access_policy/rspec_matchers.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#object_to_guard ⇒ Object
Returns the value of attribute object_to_guard.
-
#permission ⇒ Object
Returns the value of attribute permission.
-
#policy_class ⇒ Object
Returns the value of attribute policy_class.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #eval_match ⇒ Object
- #failure_message ⇒ Object
- #failure_message_part ⇒ Object
-
#initialize(permission) ⇒ PositivePolicyMatcher
constructor
A new instance of PositivePolicyMatcher.
- #matches?(policy_class) ⇒ Boolean
- #negative_failure_message ⇒ Object
- #negative_failure_message_part ⇒ Object
- #on(object_to_guard) ⇒ Object (also: #with)
- #to(user) ⇒ Object (also: #for, #for_user, #to_user)
Constructor Details
#initialize(permission) ⇒ PositivePolicyMatcher
Returns a new instance of PositivePolicyMatcher.
13 14 15 |
# File 'lib/access_policy/rspec_matchers.rb', line 13 def initialize() self. = end |
Instance Attribute Details
#object_to_guard ⇒ Object
Returns the value of attribute object_to_guard.
11 12 13 |
# File 'lib/access_policy/rspec_matchers.rb', line 11 def object_to_guard @object_to_guard end |
#permission ⇒ Object
Returns the value of attribute permission.
11 12 13 |
# File 'lib/access_policy/rspec_matchers.rb', line 11 def @permission end |
#policy_class ⇒ Object
Returns the value of attribute policy_class.
11 12 13 |
# File 'lib/access_policy/rspec_matchers.rb', line 11 def policy_class @policy_class end |
#user ⇒ Object
Returns the value of attribute user.
11 12 13 |
# File 'lib/access_policy/rspec_matchers.rb', line 11 def user @user end |
Instance Method Details
#eval_match ⇒ Object
22 23 24 |
# File 'lib/access_policy/rspec_matchers.rb', line 22 def eval_match end |
#failure_message ⇒ Object
26 27 28 |
# File 'lib/access_policy/rspec_matchers.rb', line 26 def "#{policy_class} #{} '#{}'#{object_as_text}#{user_as_text}." end |
#failure_message_part ⇒ Object
35 36 37 |
# File 'lib/access_policy/rspec_matchers.rb', line 35 def 'does not permit' end |
#matches?(policy_class) ⇒ Boolean
17 18 19 20 |
# File 'lib/access_policy/rspec_matchers.rb', line 17 def matches?(policy_class) self.policy_class = policy_class eval_match end |
#negative_failure_message ⇒ Object
30 31 32 |
# File 'lib/access_policy/rspec_matchers.rb', line 30 def "#{policy_class} #{} '#{}'#{object_as_text}#{user_as_text}." end |
#negative_failure_message_part ⇒ Object
39 40 41 |
# File 'lib/access_policy/rspec_matchers.rb', line 39 def 'does not forbid' end |
#on(object_to_guard) ⇒ Object Also known as: with
51 52 53 54 |
# File 'lib/access_policy/rspec_matchers.rb', line 51 def on(object_to_guard) self.object_to_guard = object_to_guard self end |
#to(user) ⇒ Object Also known as: for, for_user, to_user
43 44 45 46 |
# File 'lib/access_policy/rspec_matchers.rb', line 43 def to(user) self.user = user self end |