Sha256: f7b6ca857c3657c640fd34bfeb616b8d8c5d2d4cbdb83106e76f7415cf7f2395

Contents?: true

Size: 592 Bytes

Versions: 3

Compression:

Stored size: 592 Bytes

Contents

Given /^the Stove config is empty$/ do
  path = File.join(tmp_path, '_config.rb')

  write_file(path, '{}')
  set_env('STOVE_CONFIG', path)
end

Given /^the Stove config at "(.+)" is "(.*)"$/ do |path, value|
  parts   = path.split('.').map(&:to_sym)
  parents = parts[0...-1]

  path = ENV['STOVE_CONFIG']
  config = JSON.parse(File.read(path), symbolize_names: true)

  # Vivify the hash
  parent = parents.inject(config) do |config, parent|
    config[parent] ||= {}
    config[parent]
  end

  parent[parts.last] = value

  File.open(path, 'w') { |f| f.write(JSON.generate(config)) }
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stove-2.0.0 features/step_definitions/config_steps.rb
stove-2.0.0.beta.2 features/step_definitions/config_steps.rb
stove-2.0.0.beta.1 features/step_definitions/config_steps.rb