Sha256: f16af5cca0645a61c9abb172bf807af9fd6d5fb142545f4c3285ce01044d0d31

Contents?: true

Size: 618 Bytes

Versions: 2

Compression:

Stored size: 618 Bytes

Contents

require File.expand_path("helper", File.dirname(__FILE__))

setup do
  { "SCRIPT_NAME" => "/", "PATH_INFO" => "/about/1/2" }
end

test "paths and numbers" do |env|
  Cuba.define do
    on "about" do
      on :one, :two do |one, two|
        res.write one
        res.write two
      end
    end
  end

  _, _, resp = Cuba.call(env)

  assert_equal ["1", "2"], resp.body
end

test "paths and decimals" do |env|
  Cuba.define do
    on "about" do
      on(/(\d+)/) do |one|
        res.write one
      end
    end
  end

  env["PATH_INFO"] = "/about/1.2"

  _, _, resp = Cuba.call(env)

  assert_equal [], resp.body
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cuba-3.0.0.rc2 test/number.rb
cuba-3.0.0.rc1 test/number.rb