Sha256: d2faa8bfacba3e35ec93855a43f3ef88fd956100808f61b70e388095f8a8f658

Contents?: true

Size: 604 Bytes

Versions: 2

Compression:

Stored size: 604 Bytes

Contents

# APIFixtures loads fixture data generated by the core Stripe API so that we
# can have slightly more accurate and up-to-date resource information in our
# tests.
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

2 entries across 2 versions & 1 rubygems

Version Path
stripe-2.0.1 test/api_fixtures.rb
stripe-2.0.0 test/api_fixtures.rb