Class: ActiveModelSerializers::Test::Schema::AssertSchema
- Inherits:
-
Object
- Object
- ActiveModelSerializers::Test::Schema::AssertSchema
- Defined in:
- lib/active_model_serializers/test/schema.rb
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- (Object) message
readonly
Returns the value of attribute message.
-
- (Object) payload
readonly
Returns the value of attribute payload.
-
- (Object) request
readonly
Returns the value of attribute request.
-
- (Object) response
readonly
Returns the value of attribute response.
-
- (Object) schema_path
readonly
Returns the value of attribute schema_path.
Instance Method Summary (collapse)
- - (Object) call
-
- (AssertSchema) initialize(schema_path, request, response, message, payload = nil)
constructor
Interface may change.
Constructor Details
- (AssertSchema) initialize(schema_path, request, response, message, payload = nil)
Interface may change.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/active_model_serializers/test/schema.rb', line 40 def initialize(schema_path, request, response, , payload = nil) require_json_schema! @request = request @response = response @payload = payload @schema_path = schema_path || schema_path_default @message = @document_store = JsonSchema::DocumentStore.new add_schema_to_document_store end |
Instance Attribute Details
- (Object) message (readonly)
Returns the value of attribute message
37 38 39 |
# File 'lib/active_model_serializers/test/schema.rb', line 37 def @message end |
- (Object) payload (readonly)
Returns the value of attribute payload
37 38 39 |
# File 'lib/active_model_serializers/test/schema.rb', line 37 def payload @payload end |
- (Object) request (readonly)
Returns the value of attribute request
37 38 39 |
# File 'lib/active_model_serializers/test/schema.rb', line 37 def request @request end |
- (Object) response (readonly)
Returns the value of attribute response
37 38 39 |
# File 'lib/active_model_serializers/test/schema.rb', line 37 def response @response end |
- (Object) schema_path (readonly)
Returns the value of attribute schema_path
37 38 39 |
# File 'lib/active_model_serializers/test/schema.rb', line 37 def schema_path @schema_path end |
Instance Method Details
- (Object) call
51 52 53 54 55 56 |
# File 'lib/active_model_serializers/test/schema.rb', line 51 def call json_schema.(store: document_store) status, errors = json_schema.validate(response_body) @message = [, errors.map(&:to_s).to_sentence].compact.join(': ') status end |