Class: Aegis::Spec::Matchers::BeAllowedTo
- Inherits:
-
Object
- Object
- Aegis::Spec::Matchers::BeAllowedTo
- Defined in:
- lib/aegis/spec/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(expected_action, *expected_args) ⇒ BeAllowedTo
constructor
A new instance of BeAllowedTo.
- #matches?(user) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(expected_action, *expected_args) ⇒ BeAllowedTo
Returns a new instance of BeAllowedTo.
49 50 51 52 |
# File 'lib/aegis/spec/matchers.rb', line 49 def initialize(expected_action, *expected_args) @expected_action = expected_action @expected_args = expected_args end |
Instance Method Details
#description ⇒ Object
59 60 61 |
# File 'lib/aegis/spec/matchers.rb', line 59 def description "be allowed to #{action_as_prose}" end |
#failure_message ⇒ Object
63 64 65 |
# File 'lib/aegis/spec/matchers.rb', line 63 def "expected #{@actual_user.inspect} to be allowed to #{action_as_prose}" end |
#matches?(user) ⇒ Boolean
54 55 56 57 |
# File 'lib/aegis/spec/matchers.rb', line 54 def matches?(user) @actual_user = user @actual_user.send("may_#{@expected_action}?", *@expected_args) end |
#negative_failure_message ⇒ Object
67 68 69 |
# File 'lib/aegis/spec/matchers.rb', line 67 def "expected #{@actual_user.inspect} to be denied to #{action_as_prose}" end |