class Shoulda::Matchers::ActionController::CallbackMatcher
@private
Attributes
callback_type[R]
controller[R]
controller_class[R]
kind[R]
method_name[R]
Public Class Methods
new(method_name, kind, callback_type)
click to toggle source
# File lib/shoulda/matchers/action_controller/callback_matcher.rb, line 156 def initialize(method_name, kind, callback_type) @method_name = method_name @kind = kind @callback_type = callback_type end
Public Instance Methods
description()
click to toggle source
# File lib/shoulda/matchers/action_controller/callback_matcher.rb, line 179 def description "have :#{method_name} as a #{kind}_#{callback_type}" end
failure_message()
click to toggle source
# File lib/shoulda/matchers/action_controller/callback_matcher.rb, line 169 def failure_message "Expected that #{controller_class.name} would have :#{method_name} as a #{kind}_#{callback_type}" end
Also aliased as: failure_message_for_should
failure_message_when_negated()
click to toggle source
# File lib/shoulda/matchers/action_controller/callback_matcher.rb, line 174 def failure_message_when_negated "Expected that #{controller_class.name} would not have :#{method_name} as a #{kind}_#{callback_type}" end
Also aliased as: failure_message_for_should_not
matches?(controller)
click to toggle source
# File lib/shoulda/matchers/action_controller/callback_matcher.rb, line 162 def matches?(controller) @controller = controller @controller_class = controller.class callbacks.map(&:filter).include?(method_name) end
Protected Instance Methods
callbacks()
click to toggle source
# File lib/shoulda/matchers/action_controller/callback_matcher.rb, line 185 def callbacks controller_class._process_action_callbacks.select do |callback| callback.kind == kind end end