class SequelSpec::Matchers::Validation::ValidateFormatMatcher

Public Instance Methods

additionnal_param_check() click to toggle source
# File lib/sequel_spec/validation/validate_format_matcher.rb, line 15
def additionnal_param_check
  unless @additionnal
    raise ArgumentError, "You should specify the format using #with"
  end
end
additionnal_param_required?() click to toggle source
# File lib/sequel_spec/validation/validate_format_matcher.rb, line 11
def additionnal_param_required?
  true
end
description() click to toggle source
# File lib/sequel_spec/validation/validate_format_matcher.rb, line 5
def description
  desc = "validate format of #{@attribute.inspect} against #{@additionnal.inspect}"
  desc << " with option(s) #{hash_to_nice_string @options}" unless @options.empty?
  desc
end
validation_type() click to toggle source
# File lib/sequel_spec/validation/validate_format_matcher.rb, line 30
def validation_type
  :validates_format
end
with(value) click to toggle source
# File lib/sequel_spec/validation/validate_format_matcher.rb, line 21
def with(value)
  unless value.is_a?(Regexp)
    raise ArgumentError, "#with expects a Regexp"
  end

  @additionnal = value
  self
end