class Shoulda::ActiveRecord::Matchers::ValidateFormatOfMatcher
:nodoc:
def description
def description "#{@attribute} have a valid format" end
def initialize(attribute)
def initialize(attribute) super end
def matches?(subject)
def matches?(subject) super(subject) @expected_message ||= :blank return disallows_value_of(@value_to_fail, @expected_message) if @value_to_fail allows_value_of(@value_to_pass, @expected_message) if @value_to_pass end
def not_with(value)
def not_with(value) raise "You may not call both with and not_with" if @value_to_pass @value_to_fail = value self end
def with(value)
def with(value) raise "You may not call both with and not_with" if @value_to_fail @value_to_pass = value self end
def with_message(message)
def with_message(message) @expected_message = message if message self end