Class: Plyushkin::Test::HoardedAttributeMatcher::IgnoreUnchangedMatcher

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

Instance Method Summary collapse

Constructor Details

#initialize(attr_name) ⇒ IgnoreUnchangedMatcher

Returns a new instance of IgnoreUnchangedMatcher.



54
55
56
# File 'lib/plyushkin/test/hoarded_attribute_matcher.rb', line 54

def initialize(attr_name)
  @attr_name = attr_name
end

Instance Method Details

#failure_messageObject



62
63
64
# File 'lib/plyushkin/test/hoarded_attribute_matcher.rb', line 62

def failure_message
  message(true)
end

#match(subject) ⇒ Object



58
59
60
# File 'lib/plyushkin/test/hoarded_attribute_matcher.rb', line 58

def match(subject)
  subject.class.plyushkin_model.ignore_unchanged_values[@attr_name]
end

#message(negate) ⇒ Object



70
71
72
# File 'lib/plyushkin/test/hoarded_attribute_matcher.rb', line 70

def message(negate)
  "Plyushkin:: Hoarded attribute #{@attr_name} #{negate ? "ignores" : "does not ignore"} unchanged values"
end

#negative_failure_messageObject



66
67
68
# File 'lib/plyushkin/test/hoarded_attribute_matcher.rb', line 66

def negative_failure_message
  message(false)
end