Class: TestRCLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/multi_movingsign/testrc_loader.rb

Overview

Helper that reads a test YAML file and loads/executes the appropriate scripts noop_movingsign_sign

Class Method Summary collapse

Class Method Details

.load(testrc_path) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/multi_movingsign/testrc_loader.rb', line 6

def self.load(testrc_path)
  base_dir = File.expand_path(File.dirname testrc_path)
  testrc_hash = YAML::load(File.read(testrc_path))

  script_path = testrc_hash['script']
  script_path = File.join(base_dir, script_path) if Pathname.new(script_path).relative?

  parameters = testrc_hash['parameters'] || {}

  Kernel.eval(File.read(script_path), binding, script_path)
end