Class: Pundit::Matchers::PermitAllActionsMatcher
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- Pundit::Matchers::PermitAllActionsMatcher
- Defined in:
- lib/pundit/matchers/permit_all_actions_matcher.rb
Overview
This matcher tests whether a policy permits all actions.
Constant Summary
Constants inherited from BaseMatcher
BaseMatcher::AMBIGUOUS_NEGATED_MATCHER_ERROR
Instance Method Summary collapse
-
#description ⇒ String
A description of the matcher.
-
#does_not_match?(_policy) ⇒ void
Raises a NotImplementedError.
-
#failure_message ⇒ String
Returns a failure message when the policy does not permit all actions.
-
#matches?(policy) ⇒ Boolean
Checks if the given policy permits all actions.
Instance Method Details
#description ⇒ String
A description of the matcher.
12 13 14 |
# File 'lib/pundit/matchers/permit_all_actions_matcher.rb', line 12 def description 'permit all actions' end |
#does_not_match?(_policy) ⇒ void
This method returns an undefined value.
Raises a NotImplementedError
29 30 31 |
# File 'lib/pundit/matchers/permit_all_actions_matcher.rb', line 29 def does_not_match?(_policy) raise NotImplementedError, format(AMBIGUOUS_NEGATED_MATCHER_ERROR, name: 'permit_all_actions') end |
#failure_message ⇒ String
Returns a failure message when the policy does not permit all actions.
36 37 38 39 40 |
# File 'lib/pundit/matchers/permit_all_actions_matcher.rb', line 36 def = "expected '#{policy_info}' to permit all actions," << " but forbade #{policy_info.forbidden_actions}" << end |
#matches?(policy) ⇒ Boolean
Checks if the given policy permits all actions.
20 21 22 23 24 |
# File 'lib/pundit/matchers/permit_all_actions_matcher.rb', line 20 def matches?(policy) setup_policy_info! policy policy_info.forbidden_actions.empty? end |