Sha256: d2343781d36eee1bb9b7631ed27fb0e0cec943f2e76e4c273c2aeed96c1244ab
Contents?: true
Size: 833 Bytes
Versions: 12
Compression:
Stored size: 833 Bytes
Contents
require File.expand_path("helper", File.dirname(__FILE__)) setup do Cuba.define do on "post" do on :id do |id| res.write id end end end { "SCRIPT_NAME" => "/", "PATH_INFO" => "/post" } end test "matches numeric ids" do |env| env["PATH_INFO"] += "/1" _, _, resp = Cuba.call(env) assert_equal ["1"], resp.body end test "matches decimal numbers" do |env| env["PATH_INFO"] += "/1.1" _, _, resp = Cuba.call(env) assert_equal ["1.1"], resp.body end test "matches slugs" do |env| env["PATH_INFO"] += "/my-blog-post-about-cuba" _, _, resp = Cuba.call(env) assert_equal ["my-blog-post-about-cuba"], resp.body end test "matches only the first segment available" do |env| env["PATH_INFO"] += "/one/two/three" _, _, resp = Cuba.call(env) assert_equal ["one"], resp.body end
Version data entries
12 entries across 12 versions & 1 rubygems