How can I test a "magic" route?

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!

On 12/7/05, Peter F. [email protected] 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 O. [email protected] wrote:

rick
http://techno-weenie.net


Rails mailing list
[email protected]
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

map.connect ‘:controller/service.wsdl’, :action => ‘wsdl’

map.connect ‘:controller/:action/:id’

end

assert_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