yahns.git  about / heads / tags
sleepy, multi-threaded, non-blocking application server for Ruby
blob c4c884786d513f0a1e6bcb0a5693709cba253ab2 937 bytes (raw)
$ git show HEAD:test/test_rack.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
# Copyright (C) 2013-2016 all contributors <yahns-public@yhbt.net>
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
# frozen_string_literal: true
require_relative 'helper'
require 'rack/lobster'
require 'yahns/rack'
class TestRack < Testcase
  ENV["N"].to_i > 1 and parallelize_me!

  def test_rack
    tmp = tmpfile(%W(config .ru))
    tmp.write "run Rack::Lobster.new\n"
    rapp = GTL.synchronize { Yahns::Rack.new(tmp.path) }
    assert_kind_of Rack::Lobster, GTL.synchronize { rapp.app_after_fork }
    defaults = rapp.app_defaults
    assert_kind_of Hash, defaults
    tmp.close!
  end

  def test_rack_preload
    tmp = tmpfile(%W(config .ru))
    tmp.write "run Rack::Lobster.new\n"
    rapp = GTL.synchronize { Yahns::Rack.new(tmp.path, preload: true) }
    assert_kind_of Rack::Lobster, rapp.instance_variable_get(:@app)
    defaults = rapp.app_defaults
    assert_kind_of Hash, defaults
    tmp.close!
  end
end

git clone git://yhbt.net/yahns.git
git clone https://yhbt.net/yahns.git