test/on.rb in cuba-3.0.0.rc2 vs test/on.rb in cuba-3.0.0.rc3
- old
+ new
@@ -7,11 +7,11 @@
end
end
_, _, resp = Cuba.call({})
- assert_equal ["+1"], resp.body
+ assert_response resp, ["+1"]
end
test "executes on non-false" do
Cuba.define do
on "123" do
@@ -19,11 +19,11 @@
end
end
_, _, resp = Cuba.call({ "PATH_INFO" => "/123", "SCRIPT_NAME" => "/" })
- assert_equal ["+1"], resp.body
+ assert_response resp, ["+1"]
end
test "ensures SCRIPT_NAME and PATH_INFO are reverted" do
Cuba.define do
on lambda { env["SCRIPT_NAME"] = "/hello"; false } do
@@ -35,11 +35,11 @@
_, _, resp = Cuba.call(env)
assert_equal "/", env["SCRIPT_NAME"]
assert_equal "/hello", env["PATH_INFO"]
- assert_equal [], resp.body
+ assert_response resp, []
end
test "skips consecutive matches" do
Cuba.define do
on true do
@@ -58,11 +58,11 @@
env = {}
_, _, resp = Cuba.call(env)
assert_equal "foo", env["foo"]
- assert_equal ["foo"], resp.body
+ assert_response resp, ["foo"]
assert ! env["bar"]
end
test "finds first match available" do
@@ -76,11 +76,11 @@
end
end
_, _, resp = Cuba.call({})
- assert_equal ["bar"], resp.body
+ assert_response resp, ["bar"]
end
test "reverts a half-met matcher" do
Cuba.define do
on "post", false do
@@ -89,9 +89,9 @@
end
env = { "PATH_INFO" => "/post", "SCRIPT_NAME" => "/" }
_, _, resp = Cuba.call(env)
- assert_equal [], resp.body
+ assert_response resp, []
assert_equal "/post", env["PATH_INFO"]
assert_equal "/", env["SCRIPT_NAME"]
-end
\ No newline at end of file
+end