class Koine::TestRunner::Adapters::Custom

Public Class Methods

new(file_pattern:, command: nil, commands: {}) click to toggle source
# File lib/koine/test_runner/adapters/custom.rb, line 5
def initialize(file_pattern:, command: nil, commands: {})
  super(file_pattern: file_pattern)
  @command = command
  @commands = {}.tap do |hash|
    commands.each do |key, value|
      hash[key.to_sym] = value
    end
  end
end

Private Instance Methods

all_tests(config) click to toggle source
# File lib/koine/test_runner/adapters/custom.rb, line 17
def all_tests(config)
  command(command_for(:all), config)
end
command(template, config) click to toggle source
# File lib/koine/test_runner/adapters/custom.rb, line 33
def command(template, config)
  template.sub('{command}', @command)
          .sub('{file}', config.file_path.to_s)
          .sub('{line}', config.line.to_s)
end
command_for(type) click to toggle source
# File lib/koine/test_runner/adapters/custom.rb, line 29
def command_for(type)
  @commands.fetch(type).to_s
end
file_line_command(config) click to toggle source
# File lib/koine/test_runner/adapters/custom.rb, line 25
def file_line_command(config)
  command(command_for(:line), config)
end
single_file_command(config) click to toggle source
# File lib/koine/test_runner/adapters/custom.rb, line 21
def single_file_command(config)
  command(command_for(:file), config)
end