class Plyushkin::Test::HoardedAttributeMatcher

Public Class Methods

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

Public Instance Methods

and_after_create_call(sym) click to toggle source
# File lib/plyushkin/test/hoarded_attribute_matcher.rb, line 17
def and_after_create_call(sym)
  matchers << CallbackMatcher.new(@attribute, sym)
  self
end
and_ignore_unchanged_values() click to toggle source
# File lib/plyushkin/test/hoarded_attribute_matcher.rb, line 12
def and_ignore_unchanged_values
  matchers << IgnoreUnchangedMatcher.new(@attribute)
  self
end
matches?(subject) click to toggle source
Calls superclass method Plyushkin::Test::MatcherBase#matches?
# File lib/plyushkin/test/hoarded_attribute_matcher.rb, line 22
def matches?(subject)
  unless subject.class.plyushkin_model.registered_types.keys.include?(@attribute)
    @failure_message          = "Plyushkin: does not hoard attribute #{@attribute}"
    @negative_failure_message = "Plyushkin: hoards attribute #{@attribute}"
  end
  super
end
of_type(type) click to toggle source
# File lib/plyushkin/test/hoarded_attribute_matcher.rb, line 7
def of_type(type)
  matchers << OfTypeMatcher.new(@attribute, type)
  self
end