class Plyushkin::Test::HoardedAttributeMatcher::OfTypeMatcher

Public Class Methods

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

Public Instance Methods

failure_message() click to toggle source
# File lib/plyushkin/test/hoarded_attribute_matcher.rb, line 39
def failure_message
  message(false)
end
match(subject) click to toggle source
# File lib/plyushkin/test/hoarded_attribute_matcher.rb, line 35
def match(subject)
  subject.class.plyushkin_model.registered_types[@attr_name] == @type
end
negative_failure_message() click to toggle source
# File lib/plyushkin/test/hoarded_attribute_matcher.rb, line 43
def negative_failure_message
  message(true)
end

Private Instance Methods

message(negate) click to toggle source
# File lib/plyushkin/test/hoarded_attribute_matcher.rb, line 48
def message(negate)
  "Plyushkin: Hoarded attribute #{@attr_name} is #{negate ? "" : "not"} of type #{@type}"
end