Sha256: 3e11e497c81822222bfec0a1be56b4802fff1e70f66505780c0ca5bfd893f628
Contents?: true
Size: 818 Bytes
Versions: 30
Compression:
Stored size: 818 Bytes
Contents
# encoding: utf-8 # This file is distributed under New Relic's license terms. # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details. require 'rack' require 'rack/request' require 'fake_server' module NewRelic class FakeInstanceMetadataService < FakeServer def initialize(*_) super reset end def set_response_for_path(path, response) @responses[path] = response end def response_for_path(path) @responses[path] end def call(env) req = ::Rack::Request.new(env) path = req.path rsp = response_for_path(path) case rsp when ::Rack::Response rsp.to_a when String [200, {}, [rsp]] end end def reset @responses = {} end def app self end end end
Version data entries
30 entries across 30 versions & 2 rubygems