Class: Plyushkin::Test::HoardedAttributeMatcher::OfTypeMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/plyushkin/test/hoarded_attribute_matcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(attr_name, type) ⇒ OfTypeMatcher

Returns a new instance of OfTypeMatcher.



31
32
33
# File 'lib/plyushkin/test/hoarded_attribute_matcher.rb', line 31

def initialize(attr_name, type)
  @attr_name, @type = attr_name, type
end

Instance Method Details

#failure_messageObject



39
40
41
# File 'lib/plyushkin/test/hoarded_attribute_matcher.rb', line 39

def failure_message
  message(false)
end

#match(subject) ⇒ Object



35
36
37
# 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_messageObject



43
44
45
# File 'lib/plyushkin/test/hoarded_attribute_matcher.rb', line 43

def negative_failure_message
  message(true)
end