How can I test a "magic" route?


#1

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!


#2

On 12/7/05, Peter F. removed_email_address@domain.invalid 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


#3

On 12/7/05, Rick O. removed_email_address@domain.invalid wrote:

rick
http://techno-weenie.net


Rails mailing list
removed_email_address@domain.invalid
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


#4

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