class Plyushkin::Test::HoardedAttributeMatcher::CallbackMatcher

Public Class Methods

new(attr_name, callback) click to toggle source
# File lib/plyushkin/test/hoarded_attribute_matcher.rb, line 76
def initialize(attr_name, callback)
  @attr_name, @callback = attr_name, callback
end

Public Instance Methods

failure_message() click to toggle source
# File lib/plyushkin/test/hoarded_attribute_matcher.rb, line 85
def failure_message
  message(true)
end
match(subject) click to toggle source
# File lib/plyushkin/test/hoarded_attribute_matcher.rb, line 80
def match(subject)
  callbacks = subject.class.plyushkin_model.callbacks[@attr_name]
  callbacks && (callbacks[:after_create] == @callback)
end
message(negate) click to toggle source
# File lib/plyushkin/test/hoarded_attribute_matcher.rb, line 93
def message(negate)
  "Plyushkin:: Hoarded attribute #{@attr_name} #{negate ? "does not callback" : "calls back"} #{@callback}"
end
negative_failure_message() click to toggle source
# File lib/plyushkin/test/hoarded_attribute_matcher.rb, line 89
def negative_failure_message
  message(false)
end