Hello, I have this in routes.rb: map.connect ''UserLogin.jsp'', :controller=>"user", :action=>"login" This does what it should at runtime. I would love to unit-test it. I can''t figure how? Any Ideas are appreciated! -- ------------------------------ Joyeux Noël ------------------------------ Peter Fitzgibbons _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 12/7/05, Peter Fitzgibbons <peter.fitzgibbons-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > I have this in routes.rb: > > map.connect ''UserLogin.jsp'', :controller=>"user", :action=>"login" > > This does what it should at runtime. I would love to unit-test it. I can''t > figure how? > > Any Ideas are appreciated!In your functional test for UserController: assert_routing http://rails.rubyonrails.com/classes/Test/Unit/Assertions.html#M000797 assert_routing really calls assert_generates and assert_recognizes -- rick http://techno-weenie.net
On 12/7/05, Rick Olson <technoweenie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > On 12/7/05, Peter Fitzgibbons <peter.fitzgibbons-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hello, > > I have this in routes.rb: > > > > map.connect ''UserLogin.jsp'', :controller=>"user", :action=>"login" > > > > This does what it should at runtime. I would love to unit-test it. I > can''t > > figure how? > > > > Any Ideas are appreciated! > > In your functional test for UserController: > > assert_routing > http://rails.rubyonrails.com/classes/Test/Unit/Assertions.html#M000797 > > assert_routing really calls assert_generates and assert_recognizes > > -- > rick > http://techno-weenie.net > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >Except that the url "/UserLogin.jsp" is not a proper rails segment, and is not really reversible in the routing hierarchy (user/login resolves to / in subsequent routing. Here''s the entire table : ActionController::Routing::Routes.draw do |map| map.connect '''', :controller => "user", :action => "login" map.connect ''UserLogin.jsp'', :controller=>"user", :action=>"login" map.connect '':controller/service.wsdl'', :action => ''wsdl'' map.connect '':controller/:action/:id'' end -- ------------------------------ Joyeux Noël ------------------------------ Peter Fitzgibbons _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
> Except that the url "/UserLogin.jsp" is not a proper rails segment, and is > not really reversible in the routing hierarchy (user/login resolves to / in > subsequent routing. > > Here''s the entire table : > > ActionController::Routing::Routes.draw do |map| > map.connect '''', :controller => "user", :action => "login" > > map.connect ''UserLogin.jsp'', :controller=>"user", :action=>"login" > > map.connect '':controller/service.wsdl'', :action => ''wsdl'' > > map.connect '':controller/:action/:id'' > > endassert_routing tests both ways by calling assert_recognizes and assert_generates. I''m guessing you just want assert_recognizes then. -- rick http://techno-weenie.net