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 received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jeremy Kemper
2006-Nov-10 07:40 UTC
Re: Functional tests for actions that aren''t rendered
On 11/9/06, Ben Bleything <bleything-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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?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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ben Bleything
2006-Nov-10 16:24 UTC
Re: Functional tests for actions that aren''t rendered
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 On 11/9/06, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote:> On 11/9/06, Ben Bleything <bleything-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > 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? > > 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 > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ben Bleything
2006-Nov-10 16:24 UTC
Re: Functional tests for actions that aren''t rendered
Geez, sorry for the top post. Still getting used to gmail. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---