Class: Capsium::Package::Testing::ConfigTest

Inherits:
TestCase
  • Object
show all
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 =

Returns:

  • (Array[String])
%w[json yaml].freeze

Instance Attribute Summary collapse

Attributes inherited from TestCase

#name

Instance Method Summary collapse

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_fileString (readonly)

Returns the value of attribute config_file.

Returns:

  • (String)


17
18
19
# File 'lib/capsium/package/testing/config_test.rb', line 17

def config_file
  @config_file
end

#formatString (readonly)

Returns the value of attribute format.

Returns:

  • (String)


17
18
19
# File 'lib/capsium/package/testing/config_test.rb', line 17

def format
  @format
end

Instance Method Details

#run(context) ⇒ TestCase::Result

Parameters:

Returns:



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