Class: Capsium::Package::Testing::DataValidationTest
- Defined in:
- lib/capsium/package/testing/data_validation_test.rb,
sig/capsium/package/testing/data_validation_test.rbs
Overview
A "data_validation" test (05x-testing): the rows of the data file (format: json or yaml) must validate against the JSON schema file.
Constant Summary collapse
- FORMATS =
%w[json yaml].freeze
Instance Attribute Summary collapse
-
#data_file ⇒ String
readonly
Returns the value of attribute data_file.
-
#format ⇒ String
readonly
Returns the value of attribute format.
-
#schema_file ⇒ String
readonly
Returns the value of attribute schema_file.
Attributes inherited from TestCase
Instance Method Summary collapse
-
#initialize(name:, format:, data_file:, schema_file:) ⇒ DataValidationTest
constructor
A new instance of DataValidationTest.
- #run(context) ⇒ TestCase::Result
Methods inherited from TestCase
build, from_h, register, types
Constructor Details
#initialize(name:, format:, data_file:, schema_file:) ⇒ DataValidationTest
Returns a new instance of DataValidationTest.
19 20 21 22 23 24 |
# File 'lib/capsium/package/testing/data_validation_test.rb', line 19 def initialize(name:, format:, data_file:, schema_file:) super(name: name) @format = format @data_file = data_file @schema_file = schema_file end |
Instance Attribute Details
#data_file ⇒ String (readonly)
Returns the value of attribute data_file.
17 18 19 |
# File 'lib/capsium/package/testing/data_validation_test.rb', line 17 def data_file @data_file end |
#format ⇒ String (readonly)
Returns the value of attribute format.
17 18 19 |
# File 'lib/capsium/package/testing/data_validation_test.rb', line 17 def format @format end |
#schema_file ⇒ String (readonly)
Returns the value of attribute schema_file.
17 18 19 |
# File 'lib/capsium/package/testing/data_validation_test.rb', line 17 def schema_file @schema_file end |
Instance Method Details
#run(context) ⇒ TestCase::Result
26 27 28 29 |
# File 'lib/capsium/package/testing/data_validation_test.rb', line 26 def run(context) problems = validation_problems(context) Result.new(name: name, ok: problems.empty?, messages: problems) end |