class Shoulda::Hanami::Matchers::AllowValueMatcher

Public Class Methods

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

Public Instance Methods

description() click to toggle source
# File lib/shoulda/hanami/matchers/allow_value_matcher.rb, line 17
def description
  "allow '#{@value}' to be set to '#{@attribute}'"
end
failure_message() click to toggle source
# File lib/shoulda/hanami/matchers/allow_value_matcher.rb, line 21
def failure_message
  "'#{@value}' is an invalid format for '#{@attribute}'"
end
failure_message_when_negated() click to toggle source
# File lib/shoulda/hanami/matchers/allow_value_matcher.rb, line 25
def failure_message_when_negated
  "'#{@value}' is a valid format for '#{@attribute}'"
end
for(attribute) click to toggle source
# File lib/shoulda/hanami/matchers/allow_value_matcher.rb, line 29
def for(attribute)
  @attribute = attribute
  self
end
matches?(target) click to toggle source
# File lib/shoulda/hanami/matchers/allow_value_matcher.rb, line 13
def matches?(target)
  !Matcher.new(target.class.new(@attribute => @value), @attribute, :format).matches?
end