Class: ApiValidator::Json
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from ApiValidator::Base
Instance Method Details
#validate(response) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/api-validator/json.rb', line 4 def validate(response) response_body = response.body.respond_to?(:to_hash) ? response.body.to_hash : response.body _failed_assertions = failed_assertions(response_body) super.merge( :key => :response_body, :failed_assertions => _failed_assertions.map(&:to_hash), :diff => diff(response_body, _failed_assertions), :valid => _failed_assertions.empty? ) end |