Class: SequelSpec::Matchers::Validation::ValidateFormatMatcher
Instance Method Summary
collapse
#allowing_blank, #allowing_missing, #allowing_nil, #args_to_called_attributes, #valid?, #with_message
Methods inherited from Base
#failure_message, #failure_message_when_negated, #hash_to_nice_string, #initialize, #matches?, #with_options
Instance Method Details
#additionnal_param_check ⇒ Object
15
16
17
18
19
|
# 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? ⇒ Boolean
11
12
13
|
# File 'lib/sequel_spec/validation/validate_format_matcher.rb', line 11
def additionnal_param_required?
true
end
|
#description ⇒ Object
5
6
7
8
9
|
# 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 ⇒ Object
30
31
32
|
# File 'lib/sequel_spec/validation/validate_format_matcher.rb', line 30
def validation_type
:validates_format
end
|
#with(value) ⇒ Object
21
22
23
24
25
26
27
28
|
# 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
|