class Shoulda::Hanami::Matchers::Matcher

Constants

ERRORS

Public Class Methods

new(target, attribute, validation) click to toggle source
# File lib/shoulda/hanami/matchers.rb, line 17
def initialize(target, attribute, validation)
  @target     = target
  @attribute  = attribute
  @validation = validation
end

Public Instance Methods

matches?() click to toggle source
# File lib/shoulda/hanami/matchers.rb, line 23
def matches?
  result = @target.validate
  result.failure? &&
    result.messages.fetch(@attribute).select { |msg| msg.include?(ERRORS[@validation]) }.size > 0
end