Hi Friendz, I just started to work in Integration Test. but my test was failured. i just pasted my code below. Failure message was: Expected response to be <:success> , but was <302> Can u guys Plz give me a solution for this problem. CODE: def test_year_template get ''/calendar'' assert_response :success assert_template "/calendar/year" end Advance Thx, regards, Karthick. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
There''s no way we can tell just from this. Some where in your Calendar controller''s index method (or one of the filters etc...) you are calling redirect. Fred -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> There''s no way we can tell just from this. Some where in your Calendar > controller''s index method (or one of the filters etc...) you are calling > redirect. > > Fredhi friendz, Thx, yes am using filter(before filter in my calendar controller) and also am using redirect in my index method. Plz tell me how to tackle this Advance Thx, regards, Karthick. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Well if your index does a redirect (and is supposed to) then your test shouldn''t contain assert_response :success, which (in effect) asserts that you didn''t redirect Fred -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> Well if your index does a redirect (and is supposed to) then your test > shouldn''t contain assert_response :success, which (in effect) asserts > that you didn''t redirect > > Fredhi Fred, thx, i had removed assert_response. but now it produces the following error expecting <"calendar/year"> but rendering with <nil> could u plz give me a solution for that. Advance Thx, regards, Karthick -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
dblack-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org
2006-Oct-10 09:06 UTC
Re: Doubts in Integration testing
Hi -- On Tue, 10 Oct 2006, Narayana Karthick wrote:> > Frederick Cheung wrote: >> Well if your index does a redirect (and is supposed to) then your test >> shouldn''t contain assert_response :success, which (in effect) asserts >> that you didn''t redirect >> >> Fred > > hi Fred, > thx, > i had removed assert_response. but now it produces the following error > > expecting <"calendar/year"> but rendering with <nil> > > could u plz give me a solution for that.The general solution for tests that fail is to fix your code :-) Without seeing what''s in your controller, it''s impossible to give very specific advice beyond just guessing. David -- David A. Black | dblack-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] DABlog (DAB''s Weblog) [2] | Co-director, Ruby Central, Inc. [4] [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
unknown wrote:> Hi -- > > On Tue, 10 Oct 2006, Narayana Karthick wrote: > >> i had removed assert_response. but now it produces the following error >> >> expecting <"calendar/year"> but rendering with <nil> >> >> could u plz give me a solution for that. > > The general solution for tests that fail is to fix your code :-) > Without seeing what''s in your controller, it''s impossible to give very > specific advice beyond just guessing. > > > David > > -- > David A. Black | dblack-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org > Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] > DABlog (DAB''s Weblog) [2] | Co-director, Ruby Central, Inc. [4] > [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com > [2] http://dablog.rubypal.com | [4] http://www.rubycentral.orgHi david, Nice to see u response to my question. first of all thx. I just pasted my code below, plz go through it & give me a solution for my problem. class CalendarController < ApplicationController before_filter :set_date def year #display current year calendar end def index redirect_to :action => ''list'' end private def set_date @date = Date.parse((params[:date] || Date.today).to_s) end end Advance Thx, regards, Karthick -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You either need to fix your controller (assuming the integration test demonstrates the correct behaviour) or change your test, assuming your controller is doing the right thing. I''m guessing you actually want to do get ''/calendar/year'' in your test, since you appear to be trying to test that bit of functionality. Fred -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---