1 require File.dirname(__FILE__) + '/../helper'
4 it "gives :format for free" do
5 route = Sinatra::Route.new('/foo/:test/:blake')
7 route.recognize('/foo/bar/baz').should.equal true
8 route.params.should.equal :test => 'bar', :blake => 'baz', :format => 'html'
10 route.recognize('/foo/bar/baz.xml').should.equal true
11 route.params.should.equal :test => 'bar', :blake => 'baz', :format => 'xml'
14 it "doesn't auto add :format for routes with explicit formats" do
15 route = Sinatra::Route.new('/foo/:test.xml')
16 route.recognize('/foo/bar').should.equal false
17 route.recognize('/foo/bar.xml').should.equal true
18 route.params.should.equal :test => 'bar', :format => 'xml'