Permalink
Browse files

testing urls

  • Loading branch information...
1 parent db8d686 commit 95ab3666e5593ac5dbc6414f00d0ebf81083ce50 blake.mizerany@gmail.com committed Sep 17, 2007
Showing with 18 additions and 0 deletions.
  1. +18 −0 test/sinatra/url_test.rb
@@ -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
+

0 comments on commit 95ab366

Please sign in to comment.