about summary refs log tree commit homepage
path: root/test/test_rack.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_rack.rb')
-rw-r--r--test/test_rack.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/test_rack.rb b/test/test_rack.rb
new file mode 100644
index 0000000..bd0d5b5
--- /dev/null
+++ b/test/test_rack.rb
@@ -0,0 +1,26 @@
+# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
+# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
+require_relative 'helper'
+require 'rack/lobster'
+require 'yahns/rack'
+class TestRack < Testcase
+  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
+  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
+  end
+end