Sha256: 175cf6c6575a6eec8f5535a68424461294a25159bd83f611c0a0c4412e960be2

Contents?: true

Size: 440 Bytes

Versions: 8

Compression:

Stored size: 440 Bytes

Contents

class APIFixtures
  def initialize
    @fixtures = ::JSON.parse(File.read("#{PROJECT_ROOT}/spec/fixtures.json"),
      symbolize_names: true)
    freeze_recursively(@fixtures)
  end

  def [](name)
    @fixtures[name]
  end

  def fetch(*args)
    @fixtures.fetch(*args)
  end

  private

  def freeze_recursively(data)
    data.each do |k, v|
      if v.is_a?(Hash)
        freeze_recursively(v)
      end
    end
    data.freeze
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fieldview-0.0.8 test/api_fixtures.rb
fieldview-0.0.7 test/api_fixtures.rb
fieldview-0.0.6 test/api_fixtures.rb
fieldview-0.0.5 test/api_fixtures.rb
fieldview-0.0.3 test/api_fixtures.rb
fieldview-0.0.2 test/api_fixtures.rb
fieldview-0.0.1 test/api_fixtures.rb
fieldview-0.0.0 test/api_fixtures.rb