Class: JSONSchemer::Fuzz::Keyword::MinLength

Inherits:
Object
  • Object
show all
Defined in:
lib/json_schemer/fuzz/keyword/min_length.rb

Class Method Summary collapse

Class Method Details

.invalid_params(attributes) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/json_schemer/fuzz/keyword/min_length.rb', line 6

def invalid_params(attributes)
  min_length = attributes["minLength"]
  raise "No minLength keyword given: #{attributes}" unless min_length

  generated_params = []

  generated_params << /\w{1}/.gen * (min_length - 1)

  generated_params
end

.valid_param(attributes) ⇒ Object



17
18
19
20
21
22
# File 'lib/json_schemer/fuzz/keyword/min_length.rb', line 17

def valid_param(attributes)
  min_length = attributes["minLength"]
  raise "No minLength keyword given: #{attributes}" unless min_length

  /\w{1}/.gen * min_length
end