Sha256: 6a782b8327ef5285a33c88fd93de3487603b3130d064d67c6ba3a28a0f6c50d8

Contents?: true

Size: 569 Bytes

Versions: 1

Compression:

Stored size: 569 Bytes

Contents

module FixtureHelpers
  def fixture_file(relative_path)
    root = File.expand_path('../../fixtures', __FILE__)
    File.join(root, relative_path)
  end

  def load_payload_fixture(relative_path)
    MultiJson.load(File.read(fixture_file(relative_path)))
  end

  def symbolize_recursive(hash)
    {}.tap do |h|
      hash.each { |key, value| h[key.to_sym] = map_value(value) }
    end
  end

  def map_value(thing)
    case thing
    when Hash
      symbolize_recursive(thing)
    when Array
      thing.map { |v| map_value(v) }
    else
      thing
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rollbar-1.2.11 spec/support/fixture_helpers.rb