Class: JSONSchemer::Fuzz::Keyword::Not

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

Class Method Summary collapse

Class Method Details

.invalid_params(attributes) ⇒ Object



6
7
8
9
10
11
# File 'lib/json_schemer/fuzz/keyword/not.rb', line 6

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

  [JSONSchemer::Fuzz.default_param(not_attribute)]
end

.valid_param(attributes) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/json_schemer/fuzz/keyword/not.rb', line 13

def valid_param(attributes)
  attributes = Marshal.load(Marshal.dump(attributes))
  not_attribute = attributes.delete("not")
  raise "No not keyword given: #{attributes}" unless not_attribute

  generated_params = JSONSchemer::Fuzz.generate(not_attribute)

  generated_params.sample
end