diff --git a/test/sinatra/url_test.rb b/test/sinatra/url_test.rb new file mode 100644 index 00000000..fa447b57 --- /dev/null +++ b/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 +