Class: Utils::ConfigFile::Probe

Inherits:
BlockConfig show all
Defined in:
lib/utils/config_file.rb

Overview

A configuration class for test execution settings.

This class manages the configuration options related to running tests, specifically supporting different test frameworks and defining which directories should be included in test discovery and execution.

Instance Method Summary collapse

Methods inherited from BlockConfig

config, inherited, lazy_config, #to_ruby

Constructor Details

#initialize(&block) ⇒ Probe

The initialize method sets up the configuration by validating the test framework.

This method initializes the configuration object and ensures that the specified test framework is one of the allowed values. It raises an error if the test framework is not supported.

Parameters:

  • block (Proc)

    a block to be passed to the superclass initializer



264
265
266
267
268
269
270
# File 'lib/utils/config_file.rb', line 264

def initialize(&block)
  super
  test_frameworks_allowed = [ :'test-unit', :rspec ]
  test_frameworks_allowed.include?(test_framework) or
    raise ConfigFileError,
      "test_framework has to be in #{test_frameworks_allowed.inspect}"
end

Instance Method Details

#include_dirs_argumentString

The include_dirs_argument method constructs a colon-separated string from include directories.

This method takes the include directories configuration and converts it into a single colon-delimited string suitable for use in command-line arguments or environment variables.

Returns:

  • (String)

    a colon-separated string of include directory paths



252
253
254
# File 'lib/utils/config_file.rb', line 252

def include_dirs_argument
  Array(include_dirs) * ':'
end

#server_typeSymbol

The server_type method configures the type of server to be used.

This method sets up the server type configuration option, which determines the underlying server implementation to be utilized, this is either :unix for UNIX domain sockets or :tcp for TCP Sockets.

Returns:

  • (Symbol)

    returns the server type configured



234
# File 'lib/utils/config_file.rb', line 234

config :server_type, :unix