Sha256: 4d1a9202d0b136c885578d58ed4dcc7a1bf03ffc413670a8926befaa3b3078ba

Contents?: true

Size: 480 Bytes

Versions: 23

Compression:

Stored size: 480 Bytes

Contents

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

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

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

  def generate_json(name)
    JSON.generate(self.fetch(name))
  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

23 entries across 23 versions & 1 rubygems

Version Path
myjohndeere-0.1.11 test/api_fixtures.rb
myjohndeere-0.1.10 test/api_fixtures.rb
myjohndeere-0.1.9 test/api_fixtures.rb
myjohndeere-0.1.8 test/api_fixtures.rb
myjohndeere-0.1.7 test/api_fixtures.rb
myjohndeere-0.1.6 test/api_fixtures.rb
myjohndeere-0.1.5 test/api_fixtures.rb
myjohndeere-0.1.4 test/api_fixtures.rb
myjohndeere-0.1.3 test/api_fixtures.rb
myjohndeere-0.1.2 test/api_fixtures.rb
myjohndeere-0.1.1 test/api_fixtures.rb
myjohndeere-0.1.0 test/api_fixtures.rb
myjohndeere-0.0.11 test/api_fixtures.rb
myjohndeere-0.0.10 test/api_fixtures.rb
myjohndeere-0.0.9 test/api_fixtures.rb
myjohndeere-0.0.8 test/api_fixtures.rb
myjohndeere-0.0.7 test/api_fixtures.rb
myjohndeere-0.0.6 test/api_fixtures.rb
myjohndeere-0.0.5 test/api_fixtures.rb
myjohndeere-0.0.4 test/api_fixtures.rb