spec/private/recognize_spec.rb in joshbuddy-usher-0.4.5 vs spec/private/recognize_spec.rb in joshbuddy-usher-0.4.6
- old
+ new
@@ -50,9 +50,15 @@
route_set.recognize(build_request({:method => 'get', :path => '/test/part/one'})).path.route.should == target_route
route_set.recognize(build_request({:method => 'get', :path => '/test/part/two'})).path.route.should == target_route
route_set.recognize(build_request({:method => 'get', :path => '/test/part/three'})).should == nil
end
+ it "shouldn't accept a nil variable" do
+ target_route = route_set.add_route('/:one')
+ route_set.recognize(build_request({:method => 'get', :path => '/one'})).path.route.should == target_route
+ route_set.recognize(build_request({:method => 'get', :path => '/'})).should == nil
+ end
+
it "should recgonize a regex static part containing {}'s" do
target_route = route_set.add_route('/test/part/{^o{2,3}$}')
route_set.recognize(build_request({:method => 'get', :path => '/test/part/oo'})).path.route.should == target_route
route_set.recognize(build_request({:method => 'get', :path => '/test/part/ooo'})).path.route.should == target_route
route_set.recognize(build_request({:method => 'get', :path => '/test/part/oooo'})).should == nil
\ No newline at end of file