Sha256: d0b69c5556facd71a8542940555c8d9e3d279cb69bdd3abb16b8d70fc40e4fa7
Contents?: true
Size: 922 Bytes
Versions: 3
Compression:
Stored size: 922 Bytes
Contents
require "test_helper" require "faraday" require "circuitbox/faraday_middleware" require "rack" class FakeServer def self.instance @@instance ||= FakeServer.new # if the FakeServer is used kill all of them after the tests are done Minitest.after_run { FakeServer.shutdown } @@instance end def initialize @servers = [] end def self.create(port, result) FakeServer.instance.create(port, result) end def self.shutdown FakeServer.instance.shutdown end def shutdown @servers.map { |server| server.exit } @servers = [] end def create(port, result) @servers << Thread.new do Rack::Handler::WEBrick.run(Proc.new { |env| result }, Port: port, AccessLog: [], Logger: WEBrick::Log.new(DEV_NULL)) end sleep 0.5 # wait for the server to spin up end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
circuitbox-0.10.0 | test/integration_helper.rb |
circuitbox-0.9.0 | test/integration_helper.rb |
circuitbox-0.8.0 | test/integration_helper.rb |