Module: HammerCLI::Testing::DataHelpers

Defined in:
lib/hammer_cli/testing/data_helpers.rb

Instance Method Summary collapse

Instance Method Details

#load_json(file_path, test_file_context = nil) ⇒ Object



4
5
6
7
8
9
# File 'lib/hammer_cli/testing/data_helpers.rb', line 4

def load_json(file_path, test_file_context=nil)
  unless test_file_context.nil?
    file_path = File.join(File.dirname(test_file_context), file_path)
  end
  JSON.parse(File.read(file_path))
end

#load_yaml(file_path, test_file_context = nil) ⇒ Object



11
12
13
14
15
16
# File 'lib/hammer_cli/testing/data_helpers.rb', line 11

def load_yaml(file_path, test_file_context=nil)
  unless test_file_context.nil?
    file_path = File.join(File.dirname(test_file_context), file_path)
  end
  YAML.load(File.read(file_path))
end