class WebConsole::Testing::FakeMiddleware

def call(env)

def call(env)
  [ 200, @headers, [ render(req_path(env)) ] ]
end

def initialize(opts)

def initialize(opts)
  @headers        = opts.fetch(:headers, DEFAULT_HEADERS)
  @req_path_regex = opts[:req_path_regex]
  @view_path      = opts[:view_path]
end

def render(template)

def render(template)
  view.render(template: template, layout: nil)
end

def req_path(env)

extract target path from REQUEST_PATH
def req_path(env)
  env["REQUEST_PATH"].match(@req_path_regex)[1]
end

def view

def view
  @view = View.new(@view_path)
end