test/on.rb in cuba-1.0.0 vs test/on.rb in cuba-2.0.0.rc1
- old
+ new
@@ -10,9 +10,21 @@
_, _, resp = Cuba.call({})
assert_equal ["+1"], resp.body
end
+test "executes on non-false" do
+ Cuba.define do
+ on "123" do
+ res.write "+1"
+ end
+ end
+
+ _, _, resp = Cuba.call({ "PATH_INFO" => "/123", "SCRIPT_NAME" => "/" })
+
+ assert_equal ["+1"], resp.body
+end
+
test "restores SCRIPT_NAME and PATH_INFO" do
Cuba.define do
on true do
env["SCRIPT_NAME"] = "foo"
env["PATH_INFO"] = "/hello"
\ No newline at end of file