Sha256: 45d541180c5477897e47dc1c14d61f31c8867905cfec43e6b5957e071ad27aab

Contents?: true

Size: 843 Bytes

Versions: 370

Compression:

Stored size: 843 Bytes

Contents

require "#{File.dirname(__FILE__)}/../testrequest"

$stderr = File.open("#{File.dirname(__FILE__)}/log_output", "w")

class EnvMiddleware
  def initialize(app)
    @app = app
  end

  def call(env)
    # provides a way to test that lint is present
    if env["PATH_INFO"] == "/broken_lint"
      return [200, {}, ["Broken Lint"]]
    # provides a way to kill the process without knowing the pid
    elsif env["PATH_INFO"] == "/die"
      exit!
    end

    env["test.$DEBUG"]      = $DEBUG
    env["test.$EVAL"]       = BUKKIT if defined?(BUKKIT)
    env["test.$VERBOSE"]    = $VERBOSE
    env["test.$LOAD_PATH"]  = $LOAD_PATH
    env["test.stderr"]      = File.expand_path($stderr.path)
    env["test.Ping"]        = defined?(Ping)
    env["test.pid"]         = Process.pid
    @app.call(env)
  end
end

use EnvMiddleware
run TestRequest.new

Version data entries

370 entries across 326 versions & 67 rubygems

Version Path
rack-1.2.3 test/rackup/config.ru
rack-1.3.0 test/rackup/config.ru
rack-1.3.0.beta2 test/rackup/config.ru
rack-1.3.0.beta test/rackup/config.ru
rack-1.2.2 test/rackup/config.ru
edgar-rack-1.2.1 test/rackup/config.ru
rack-1.2.1 test/rackup/config.ru
rack-1.2.0 spec/rackup/config.ru
rango-0.0.6 vendor/rack/test/rackup/config.ru
rango-0.1.pre vendor/rack/test/rackup/config.ru