module Mockolate::Validators

Public Class Methods

check_faker(obj) click to toggle source
# File lib/mockolate/validators.rb, line 10
def check_faker(obj)

end
check_value_given?(obj) click to toggle source
# File lib/mockolate/validators.rb, line 5
def check_value_given?(obj)
  return if _check_has_default_value?(obj) || _check_both_given?(obj)
  raise Mockolate::Errors::MissingValueError, 'Default value or all Faker options should be given'
end

Private Class Methods

_check_both_given?(obj) click to toggle source
# File lib/mockolate/validators.rb, line 27
def _check_both_given?(obj)
  _check_has_faker_key?(obj) &&  _check_has_faker_module?(obj)
end
_check_has_default_value?(obj) click to toggle source
# File lib/mockolate/validators.rb, line 15
def _check_has_default_value?(obj)
  !!obj[:value]
end
_check_has_faker_key?(obj) click to toggle source
# File lib/mockolate/validators.rb, line 19
def _check_has_faker_key?(obj)
  return !!obj[:key] 
end
_check_has_faker_module?(obj) click to toggle source
# File lib/mockolate/validators.rb, line 23
def _check_has_faker_module?(obj)
  return !!obj[:fake_from]
end