1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

testing urls

This commit is contained in:
blake.mizerany@gmail.com 2007-09-17 18:39:48 +00:00
parent db8d6863b3
commit 95ab3666e5

18
test/sinatra/url_test.rb Normal file
View file

@ -0,0 +1,18 @@
require File.dirname(__FILE__) + '/../helper'
describe "Route" do
it "should recognize params in urls" do
route = Sinatra::Route.new('/foo/:test/:blake')
route.recognize('/foo/bar/baz').should.equal true
route.params.should.equal :test => 'bar', :blake => 'baz', :format => 'html'
route.recognize('/foo/bar/baz.xml').should.equal true
route.params.should.equal :test => 'bar', :blake => 'baz', :format => 'xml'
end
# it "test" do
# p /^(\w)$|^(\w\.\w)$/.match('b').captures rescue 'NOTHING'
# end
end