Xml_http_request : action not found?

I have this in a functional test:

xml_http_request :delete, person_movie_path(1,1)

and the error I get says the action cannot be found, as if the
‘:delete’ method is not being translated to the appropriate destroy
action. It works fine as an Ajax call from the browser.

What am I doing wrong?

Quoting itsastickup [email protected]:

I have this in a functional test:

xml_http_request :delete, person_movie_path(1,1)

and the error I get says the action cannot be found, as if the
‘:delete’ method is not being translated to the appropriate destroy
action. It works fine as an Ajax call from the browser.

Probably wrong path. Check the URL generated by
“person_movie_path(1,1)”
against the output of “rake routes”.

HTH,
Jeffrey

I have this in a functional test:

xml_http_request :delete, person_movie_path(1,1)

and the error I get says the action cannot be found, as if the
‘:delete’ method is not being translated to the appropriate destroy
action. It works fine as an Ajax call from the browser.

Probably wrong path. Check the URL generated by “person_movie_path(1,1)”
against the output of “rake routes”.

That’s what I thought but it checks out fine (I’ve practically blinded
myself examining rake routes). I even test the route in the test
method, and it passes. And it does work from the browser: indentical
path (and :delete method).

The error I get is :

ActionController::UnknownAction: No action responded to /people/1/
movies/1. Actions: create, create_guid, lots more methods here,
including “destroy”…

Ok, so the solution seems to be to forget paths and do the test like
this :

xml_http_request :delete,‘destroy’,{:id=>1,:person_id=>1}