Class: JSON::Fuzz::Generator::Keyword::MinLength

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

Class Method Summary collapse

Class Method Details

.invalid_params(attributes) ⇒ Object



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

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)

  return generated_params
end

.valid_param(attributes) ⇒ Object



18
19
20
21
22
23
# File 'lib/json/fuzz/generator/keyword/min_length.rb', line 18

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

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