Class: Shoulda::Matchers::ActionController::CallbackMatcher
- Inherits:
-
Object
- Object
- Shoulda::Matchers::ActionController::CallbackMatcher
- Defined in:
- lib/shoulda/matchers/action_controller/callback_matcher.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(method_name, kind, callback_type) ⇒ CallbackMatcher
constructor
A new instance of CallbackMatcher.
- #matches?(controller) ⇒ Boolean
Constructor Details
#initialize(method_name, kind, callback_type) ⇒ CallbackMatcher
Returns a new instance of CallbackMatcher.
81 82 83 84 85 |
# File 'lib/shoulda/matchers/action_controller/callback_matcher.rb', line 81 def initialize(method_name, kind, callback_type) @method_name = method_name @kind = kind @callback_type = callback_type end |
Instance Method Details
#description ⇒ Object
104 105 106 |
# File 'lib/shoulda/matchers/action_controller/callback_matcher.rb', line 104 def description "have :#{method_name} as a #{kind}_#{callback_type}" end |
#failure_message ⇒ Object
94 95 96 97 |
# File 'lib/shoulda/matchers/action_controller/callback_matcher.rb', line 94 def "Expected that #{controller_class.name} would have :#{method_name}"\ " as a #{kind}_#{callback_type}" end |
#failure_message_when_negated ⇒ Object
99 100 101 102 |
# File 'lib/shoulda/matchers/action_controller/callback_matcher.rb', line 99 def "Expected that #{controller_class.name} would not have"\ " :#{method_name} as a #{kind}_#{callback_type}" end |
#matches?(controller) ⇒ Boolean
87 88 89 90 91 92 |
# File 'lib/shoulda/matchers/action_controller/callback_matcher.rb', line 87 def matches?(controller) @controller = controller @controller_class = controller.class callbacks.map(&:filter).include?(method_name) end |