Testing /using routes

Hello,

I’ve just recently discovered the wonderful world of routes. But I
can’t get my test to work when using them.

An example:
I have a ClientController which has an index action.
I want to access the action like this: http://mysite/admin/clients
For this, I have created a route: map.connect ‘admin/
clients’, :controller => ‘client’, :action => ‘index’

In my test I have:
get “admin/clients”
[ … some lines of assertions because you need to be logged
in … ]
get “admin/clients”

When my test “hits” the admin/clients url the second time, my test
fails with:
ActionController::UnknownAction: No action responded to /admin/clients

Why is that? And what is it about routes I have missed?

Greetings,
Gitte W.

Gitte W. wrote:

Hello,

I’ve just recently discovered the wonderful world of routes. But I
can’t get my test to work when using them.

When my test “hits” the admin/clients url the second time, my test
fails with:
ActionController::UnknownAction: No action responded to /admin/clients

Why is that? And what is it about routes I have missed?

Greetings,
Gitte W.

Make sure you’re in an integration test, and not a functional test.
Functional test only support direct calling of action with the get and
post methods. Integration tests can use a string that gets routed.

On 08/11/2006, at 9.05, Alex W. wrote:

clients

Why is that? And what is it about routes I have missed?

Greetings,
Gitte W.

Make sure you’re in an integration test, and not a functional test.
Functional test only support direct calling of action with the get and
post methods. Integration tests can use a string that gets routed.

I have not yet looked at integration tests. How does they work and
are there any docs on these somewhere?

Greetings,
Gitte W.