class Shoulda::Hanami::Matchers::ValidatePresenceOfMatcher

Public Class Methods

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

Public Instance Methods

description() click to toggle source
# File lib/shoulda/hanami/matchers/validate_presence_of_matcher.rb, line 17
def description
  "require '#{@attribute}' to be set"
end
failure_message() click to toggle source
# File lib/shoulda/hanami/matchers/validate_presence_of_matcher.rb, line 21
def failure_message
  "'#{@attribute}' is a required attribute"
end
failure_message_when_negated() click to toggle source
# File lib/shoulda/hanami/matchers/validate_presence_of_matcher.rb, line 25
def failure_message_when_negated
  "'#{@attribute}' is not a required attribute"
end
matches?(target) click to toggle source
# File lib/shoulda/hanami/matchers/validate_presence_of_matcher.rb, line 13
def matches?(target)
  Matcher.new(target.class.new(@attribute => nil), @attribute, :presence).matches?
end