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