class SequelSpec::Matchers::Validation::ValidateTypeMatcher

Public Instance Methods

additionnal_param_check() click to toggle source
# File lib/sequel_spec/validation/validate_type_matcher.rb, line 15
def additionnal_param_check
  unless @additionnal
    raise ArgumentError, "You should specify the accepted types using #is"
  end
end
additionnal_param_required?() click to toggle source
# File lib/sequel_spec/validation/validate_type_matcher.rb, line 11
def additionnal_param_required?
  true
end
description() click to toggle source
# File lib/sequel_spec/validation/validate_type_matcher.rb, line 5
def description
  desc = "validate that type of #{@attribute.inspect} is #{@additionnal.inspect}"
  desc << " with option(s) #{hash_to_nice_string @options}" unless @options.empty?
  desc
end
is(value) click to toggle source
# File lib/sequel_spec/validation/validate_type_matcher.rb, line 21
def is(value)
  unless value.is_a?(Class) || value.is_a?(Array)
    raise ArgumentError, "#with expects a Class or an array of Classes"
  end

  @additionnal = value
  self
end
validation_type() click to toggle source
# File lib/sequel_spec/validation/validate_type_matcher.rb, line 30
def validation_type
  :validates_type
end