class Shoulda::Lotus::Matchers::AllowValueMatcher

Public Class Methods

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

Public Instance Methods

description() click to toggle source
# File lib/shoulda/lotus/matchers/allow_value_matcher.rb, line 18
def description
  "allow '#{@value}' to be set to '#{@attribute}'"
end
failure_message() click to toggle source
# File lib/shoulda/lotus/matchers/allow_value_matcher.rb, line 22
def failure_message
  "'#{@value}' is an invalid format for '#{@attribute}'"
end
failure_message_when_negated() click to toggle source
# File lib/shoulda/lotus/matchers/allow_value_matcher.rb, line 26
def failure_message_when_negated
  "'#{@value}' is a valid format for '#{@attribute}'"
end
for(attribute) click to toggle source
# File lib/shoulda/lotus/matchers/allow_value_matcher.rb, line 30
def for(attribute)
  @attribute = attribute
  self
end
matches?(target) click to toggle source
# File lib/shoulda/lotus/matchers/allow_value_matcher.rb, line 13
def matches?(target)
  target.send("#{@attribute}=", @value)
  !Matcher.new(target, @attribute, :format).matches?
end