test/all.rb in syro-3.1.0 vs test/all.rb in syro-3.1.1
- old
+ new
@@ -97,10 +97,28 @@
res.text "Also not found!"
end
end
end
+path_info = Syro.new do
+ on "foo" do
+ get do
+ res.text req.path
+ end
+ end
+
+ get do
+ res.text req.path
+ end
+end
+
+script_name = Syro.new do
+ on "path" do
+ run(path_info)
+ end
+end
+
app = Syro.new do
get do
res.write "GET /"
end
@@ -236,10 +254,14 @@
end
on "json" do
res.json "json!"
end
+
+ on "script" do
+ run(script_name)
+ end
end
setup do
Driver.new(app)
end
@@ -412,6 +434,12 @@
f.get("/handlers/with_local_handler")
assert_equal 404, f.last_response.status
assert_equal "text/plain", f.last_response.headers["Content-Type"]
assert_equal "Also not found!", f.last_response.body
+end
+
+test "script name and path info" do |f|
+ f.get("/script/path")
+ assert_equal 200, f.last_response.status
+ assert_equal "/script/path", f.last_response.body
end