Module: ActiveModelSerializers::Test::Schema
- Defined in:
- lib/active_model_serializers/test/schema.rb
Defined Under Namespace
Classes: AssertRequestSchema, AssertResponseSchema, AssertSchema
Constant Summary
- MissingSchema =
Class.new(Minitest::Assertion)
- InvalidSchemaError =
Class.new(Minitest::Assertion)
Instance Method Summary (collapse)
-
- (Object) assert_request_response_schema(schema_path = nil, message = nil)
May be renamed.
- - (Object) assert_request_schema(schema_path = nil, message = nil)
-
- (Boolean, Minitest::Assertion) assert_response_schema(schema_path = nil, message = nil)
A Minitest Assertion that test the response is valid against a schema.
- - (Object) assert_schema(payload, schema_path = nil, message = nil)
Instance Method Details
- (Object) assert_request_response_schema(schema_path = nil, message = nil)
May be renamed
23 24 25 26 |
# File 'lib/active_model_serializers/test/schema.rb', line 23 def assert_request_response_schema(schema_path = nil, = nil) assert_request_schema(schema_path, ) assert_response_schema(schema_path, ) end |
- (Object) assert_request_schema(schema_path = nil, message = nil)
17 18 19 20 |
# File 'lib/active_model_serializers/test/schema.rb', line 17 def assert_request_schema(schema_path = nil, = nil) matcher = AssertRequestSchema.new(schema_path, request, response, ) assert(matcher.call, matcher.) end |
- (Boolean, Minitest::Assertion) assert_response_schema(schema_path = nil, message = nil)
A Minitest Assertion that test the response is valid against a schema.
12 13 14 15 |
# File 'lib/active_model_serializers/test/schema.rb', line 12 def assert_response_schema(schema_path = nil, = nil) matcher = AssertResponseSchema.new(schema_path, request, response, ) assert(matcher.call, matcher.) end |
- (Object) assert_schema(payload, schema_path = nil, message = nil)
28 29 30 31 |
# File 'lib/active_model_serializers/test/schema.rb', line 28 def assert_schema(payload, schema_path = nil, = nil) matcher = AssertSchema.new(schema_path, request, response, , payload) assert(matcher.call, matcher.) end |