mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
testing urls
This commit is contained in:
parent
db8d6863b3
commit
95ab3666e5
1 changed files with 18 additions and 0 deletions
18
test/sinatra/url_test.rb
Normal file
18
test/sinatra/url_test.rb
Normal 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
|
||||
|
Loading…
Reference in a new issue