Class: TestRunner::TestConfig
- Inherits:
-
Object
- Object
- TestRunner::TestConfig
- Defined in:
- lib/test-runner/test_config.rb
Instance Attribute Summary collapse
- #config_path ⇒ Test readonly
- #test ⇒ Test readonly
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
- #build ⇒ Object
- #dig(*keys) ⇒ Object
-
#initialize(test, config_path:, system: NixCli::DEFAULT_SYSTEM, test_config_path: nil) ⇒ TestConfig
constructor
A new instance of TestConfig.
Constructor Details
#initialize(test, config_path:, system: NixCli::DEFAULT_SYSTEM, test_config_path: nil) ⇒ TestConfig
Returns a new instance of TestConfig.
19 20 21 22 23 24 |
# File 'lib/test-runner/test_config.rb', line 19 def initialize(test, config_path:, system: NixCli::DEFAULT_SYSTEM, test_config_path: nil) @test = test @nix = NixCli.new(system:, test_config_path:) @config_path = config_path @config = {} end |
Instance Attribute Details
#config_path ⇒ Test (readonly)
15 16 17 |
# File 'lib/test-runner/test_config.rb', line 15 def config_path @config_path end |
#test ⇒ Test (readonly)
15 16 17 |
# File 'lib/test-runner/test_config.rb', line 15 def test @test end |
Class Method Details
.build(test, config_path:, system: NixCli::DEFAULT_SYSTEM, test_config_path: nil) ⇒ Object
8 9 10 11 12 |
# File 'lib/test-runner/test_config.rb', line 8 def self.build(test, config_path:, system: NixCli::DEFAULT_SYSTEM, test_config_path: nil) tc = new(test, system:, test_config_path:, config_path:) tc.build tc end |
Instance Method Details
#[](key) ⇒ Object
32 33 34 |
# File 'lib/test-runner/test_config.rb', line 32 def [](key) @config[key] end |
#build ⇒ Object
26 27 28 29 30 |
# File 'lib/test-runner/test_config.rb', line 26 def build FileUtils.mkdir_p(File.dirname(config_path)) @nix.build_test_json(test.path, config_path) @config = JSON.parse(File.read(config_path)) end |
#dig(*keys) ⇒ Object
36 37 38 |
# File 'lib/test-runner/test_config.rb', line 36 def dig(*keys) @config.dig(*keys) end |