Functional tests for actions that aren't rendered

Hi all,

I'm not sure exactly where it is I'm going astray here, but I'm struggling with what seems like a pretty basic scenario. In my controller, I've got an action that can't be rendered. It does some stuff in the session and database and then redirects.

In my functional tests, I'm attempting to test this action but it's always failing because it can't find a template:

test:

def test_savejob_logged_out     get :savejob, {:id => 1} end

error:

test_savejob_logged_out(CareersControllerTest): ActionController::MissingTemplate: Missing template /Users/ben/projects/jobapp/config/../app/views/careers/savejob.rhtml method assert_existence_of_template_file in base.rb at line 1034 ...snip...

What am I doing wrong? Is it really that uncommon to have an action that isn't rendered?

Thanks, Ben

You don’t need to render a response body, but you do need to send a response of some kind!

Try render :nothing => true to send a 200 OK response with no body.

jeremy

See, this is what I don't get. The redirect is sending a 302 and it works like a champ in the browser. But in the functional test, it complains about there not being a template... like it's checking for the template before it actually tries to run the action.

Ben

Geez, sorry for the top post. Still getting used to gmail.