I keep getting the following test failure: Expected response to be a <:redirect>, but was <200> While testing a line for the SHLG: assert_redirected_to(@controller.url_for(:action => "welcome")) I have no clue why it''s sending a 200 instead of a redirect...is there any way I can output the exact response so I can see what the page is actually saying, instead of just the response code? Thanks, Pat
assert false,@response.body -- -- Tom Mornini On Oct 14, 2005, at 3:05 AM, Pat Maddox wrote:> I keep getting the following test failure: > Expected response to be a <:redirect>, but was <200> > > While testing a line for the SHLG: > assert_redirected_to(@controller.url_for(:action => "welcome")) > > I have no clue why it''s sending a 200 instead of a redirect...is there > any way I can output the exact response so I can see what the page is > actually saying, instead of just the response code? > > Thanks, > Pat > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Hi Pat, See what curl -I http://<your.url/here> returns when your server runs outside of the unit test. Cheers, Nick>-----Ursprüngliche Nachricht----- >Von: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]Im Auftrag von Pat Maddox >Gesendet: Freitag, 14. Oktober 2005 12:06 >An: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >Betreff: [Rails] Functional tests, viewing the response > > >I keep getting the following test failure: >Expected response to be a <:redirect>, but was <200> > >While testing a line for the SHLG: >assert_redirected_to(@controller.url_for(:action => "welcome")) > >I have no clue why it''s sending a 200 instead of a redirect...is there >any way I can output the exact response so I can see what the page is >actually saying, instead of just the response code? > >Thanks, >Pat >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails >
On Oct 14, 2005, at 3:05 AM, Pat Maddox wrote:> I keep getting the following test failure: > Expected response to be a <:redirect>, but was <200> > > While testing a line for the SHLG: > assert_redirected_to(@controller.url_for(:action => "welcome")) > > I have no clue why it''s sending a 200 instead of a redirect...is there > any way I can output the exact response so I can see what the page is > actually saying, instead of just the response code?You can always do: puts @response.body I find it to be a very useful debugging technique. - Jamis
Just a hit.. one of your model validations are failing on test. Possible causes: your fixtures are not valid. On 10/14/05, Jamis Buck <jamis-uHoyYlH2B+GakBO8gow8eQ@public.gmane.org> wrote:> > On Oct 14, 2005, at 3:05 AM, Pat Maddox wrote: > > > I keep getting the following test failure: > > Expected response to be a <:redirect>, but was <200> > > > > While testing a line for the SHLG: > > assert_redirected_to(@controller.url_for(:action => "welcome")) > > > > I have no clue why it''s sending a 200 instead of a redirect...is there > > any way I can output the exact response so I can see what the page is > > actually saying, instead of just the response code? > > You can always do: > > puts @response.body > > I find it to be a very useful debugging technique. > > - Jamis > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- First they laugh at you, then they ignore you, then they fight you. Then you win. -- Mahatma Karamchand Gandhi _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
If you have a fixture problem, try out this fixture test I wrote. Save it in test/unit/fixture_test.rb and just specify the fixtures you want to test instead of mine. - Jamie require File.dirname(__FILE__) + ''/../test_helper'' class FixtureTest < Test::Unit::TestCase fixtures :subscribers, :providers, :subscriptions, :lists, :list_locations, :list_events def test_should_have_valid_fixtures self.fixture_table_names.each do |table| model_name = table.to_s.singularize.classify model = Object.const_get(model_name) fixtures = model.find(:all) fixtures.each do |fixture| assert_equal true, fixture.valid? end end end end On Fri, 2005-04-11 at 05:05 -0400, Leon Leslie wrote:> Just a hit.. one of your model validations are failing on test. > > Possible causes: your fixtures are not valid. > > On 10/14/05, Jamis Buck <jamis-uHoyYlH2B+GakBO8gow8eQ@public.gmane.org> wrote: > On Oct 14, 2005, at 3:05 AM, Pat Maddox wrote: > > > I keep getting the following test failure: > > Expected response to be a <:redirect>, but was <200> > > > > While testing a line for the SHLG: > > assert_redirected_to(@controller.url_for(:action => > "welcome")) > > > > I have no clue why it''s sending a 200 instead of a > redirect...is there > > any way I can output the exact response so I can see what > the page is > > actually saying, instead of just the response code? > > You can always do: > > puts @response.body > > I find it to be a very useful debugging technique. > > - Jamis > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > -- > First they laugh at you, then they ignore you, then they fight you. > Then you win. > -- Mahatma Karamchand Gandhi > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
On 10/14/05, Jamis Buck <jamis-uHoyYlH2B+GakBO8gow8eQ@public.gmane.org> wrote:> On Oct 14, 2005, at 3:05 AM, Pat Maddox wrote: > > > I keep getting the following test failure: > > Expected response to be a <:redirect>, but was <200> > > > > While testing a line for the SHLG: > > assert_redirected_to(@controller.url_for(:action => "welcome")) > > > > I have no clue why it''s sending a 200 instead of a redirect...is there > > any way I can output the exact response so I can see what the page is > > actually saying, instead of just the response code? > > You can always do: > > puts @response.body > > I find it to be a very useful debugging technique. > > - JamisIt''s been nearly a month, but I just got around to looking back at this. Still getting the error. Some people suggested it was because of fixtures, but I''m just doing a post, so fixtures aren''t involved. I displayed the response, and it''s just the basic login page, there are no error messages at all. Here''s my code: post :signup, :user => { :login => "newbob", :password => "newpassword", :password_confirmation => "newpassword", :email => "bobemail-J0of1frlU80@public.gmane.org" } assert_session_has_no :user assert_redirect_url(@controller.url_for(:action => "login")) Those are all the required fields...and if I signup through my app normally using those exact values, I get redirected to the login page fine. It might be that validation is failing? My signup page isn''t giving me any errors though, so I''m totally clueless. Pat
On 11/14/05, Pat Maddox <pergesu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 10/14/05, Jamis Buck <jamis-uHoyYlH2B+GakBO8gow8eQ@public.gmane.org> wrote: > > On Oct 14, 2005, at 3:05 AM, Pat Maddox wrote: > > > > > I keep getting the following test failure: > > > Expected response to be a <:redirect>, but was <200> > > > > > > While testing a line for the SHLG: > > > assert_redirected_to(@controller.url_for(:action => "welcome")) > > > > > > I have no clue why it''s sending a 200 instead of a redirect...is there > > > any way I can output the exact response so I can see what the page is > > > actually saying, instead of just the response code? > > > > You can always do: > > > > puts @response.body > > > > I find it to be a very useful debugging technique. > > > > - Jamis > > It''s been nearly a month, but I just got around to looking back at > this. Still getting the error. Some people suggested it was because > of fixtures, but I''m just doing a post, so fixtures aren''t involved. > I displayed the response, and it''s just the basic login page, there > are no error messages at all. Here''s my code: > > post :signup, :user => { :login => "newbob", :password => > "newpassword", :password_confirmation => "newpassword", :email => > "bobemail-J0of1frlU80@public.gmane.org" } > assert_session_has_no :user > assert_redirect_url(@controller.url_for(:action => "login")) > > Those are all the required fields...and if I signup through my app > normally using those exact values, I get redirected to the login page > fine. It might be that validation is failing? My signup page isn''t > giving me any errors though, so I''m totally clueless. > > Pat >It''s definitely not validation, because I just commented out all the validation code for the User model. I''m going pretty crazy here.
On Mon, 2005-11-14 at 05:32 -0700, Pat Maddox wrote:> On 11/14/05, Pat Maddox <pergesu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > On 10/14/05, Jamis Buck <jamis-uHoyYlH2B+GakBO8gow8eQ@public.gmane.org> wrote: > > > On Oct 14, 2005, at 3:05 AM, Pat Maddox wrote: > > > > > > > I keep getting the following test failure: > > > > Expected response to be a <:redirect>, but was <200>> > It''s been nearly a month, but I just got around to looking back at > > this. Still getting the error. Some people suggested it was because > > of fixtures, but I''m just doing a post, so fixtures aren''t involved. > > I displayed the response, and it''s just the basic login page, there > > are no error messages at all. Here''s my code: > > > >I had a similar problem with the Salted Hash login code, and it turned out that one of the tests depends on working transactions in the database. Since I was testing with MyISAM tables in MySQL, the test failed. Changing the table to InnoDB solved the problem. Kind regards, Hans _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails