Class: ResponseJsonSyntaxChecker

Inherits:
Checker
  • Object
show all
Defined in:
lib/plugins/plug01_response_json_syntax_checker.rb

Instance Method Summary collapse

Methods inherited from Checker

available_plugins, #initialize

Constructor Details

This class inherits a constructor from Checker

Instance Method Details

#checkObject

checks if the given testcase body represents syntactically valid JSON



4
5
6
7
8
9
10
11
# File 'lib/plugins/plug01_response_json_syntax_checker.rb', line 4

def check
  result = Result.new(@testcase, @response)
  if not valid_json?(@response.body)
    result.succeeded = false
    result.error_message = "expected valid JSON in body\n got --#{@response.body[1..400]}-- #{@response.body.class}"
  end
  result
end