module ActiveModelSerializers::Test::Schema

def assert_request_response_schema(schema_path = nil, message = nil)

May be renamed
def assert_request_response_schema(schema_path = nil, message = nil)
  assert_request_schema(schema_path, message)
  assert_response_schema(schema_path, message)
end

def assert_request_schema(schema_path = nil, message = nil)

def assert_request_schema(schema_path = nil, message = nil)
  matcher = AssertRequestSchema.new(schema_path, request, response, message)
  assert(matcher.call, matcher.message)
end

def assert_response_schema(schema_path = nil, message = nil)

Returns:
  • (Minitest::Assertion) - when the response is invalid
  • (Boolean) - true when the response is valid

Parameters:
  • message (String) -- a custom error message
  • schema_path (String) -- a custom schema path
def assert_response_schema(schema_path = nil, message = nil)
  matcher = AssertResponseSchema.new(schema_path, request, response, message)
  assert(matcher.call, matcher.message)
end

def assert_schema(payload, schema_path = nil, message = nil)

def assert_schema(payload, schema_path = nil, message = nil)
  matcher = AssertSchema.new(schema_path, request, response, message, payload)
  assert(matcher.call, matcher.message)
end