Class: Capsium::Package::Testing::ConfigTest
- Defined in:
- lib/capsium/package/testing/config_test.rb,
sig/capsium/package/testing/config_test.rbs
Overview
A "config" test (05x-testing): the configuration file must exist in the package and parse as the declared format; known Capsium package configs are additionally validated against their canonical models.
Constant Summary collapse
- FORMATS =
%w[json yaml].freeze
Instance Attribute Summary collapse
-
#config_file ⇒ String
readonly
Returns the value of attribute config_file.
-
#format ⇒ String
readonly
Returns the value of attribute format.
Attributes inherited from TestCase
Instance Method Summary collapse
-
#initialize(name:, format:, config_file:) ⇒ ConfigTest
constructor
A new instance of ConfigTest.
- #run(context) ⇒ TestCase::Result
Methods inherited from TestCase
build, from_h, register, types
Constructor Details
#initialize(name:, format:, config_file:) ⇒ ConfigTest
Returns a new instance of ConfigTest.
19 20 21 22 23 |
# File 'lib/capsium/package/testing/config_test.rb', line 19 def initialize(name:, format:, config_file:) super(name: name) @format = format @config_file = config_file end |
Instance Attribute Details
#config_file ⇒ String (readonly)
Returns the value of attribute config_file.
17 18 19 |
# File 'lib/capsium/package/testing/config_test.rb', line 17 def config_file @config_file end |
#format ⇒ String (readonly)
Returns the value of attribute format.
17 18 19 |
# File 'lib/capsium/package/testing/config_test.rb', line 17 def format @format end |
Instance Method Details
#run(context) ⇒ TestCase::Result
25 26 27 28 |
# File 'lib/capsium/package/testing/config_test.rb', line 25 def run(context) problems = config_problems(context) Result.new(name: name, ok: problems.empty?, messages: problems) end |