class Plyushkin::Test::PersistedAttributeMatcher

Public Class Methods

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

Public Instance Methods

matches?(subject) click to toggle source
Calls superclass method Plyushkin::Test::MatcherBase#matches?
# File lib/plyushkin/test/persisted_attribute_matcher.rb, line 12
def matches?(subject)
  @failure_message          = "Plyushkin: no persisted attribute with name '#{@attr_name}'" unless subject.class.persisted_attributes.include?(@attr_name)
  @negative_failure_message = "Plyushkin: persisted attribute with name '#{@attr_name}' exists" unless subject.class.persisted_attributes.include?(@attr_name)
  super
end
with_format(formatter) click to toggle source
# File lib/plyushkin/test/persisted_attribute_matcher.rb, line 7
def with_format(formatter)
  matchers << WithFormatMatcher.new(@attr_name, formatter)
  self
end