Forum: Ruby on Rails autotest + integration testing (follow_redirect!) error

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7fd73acc52ca674305ae5103c1050116?d=identicon&s=25 Jim Truher (Guest)
on 2007-07-25 13:02
(Received via mailing list)
I've got an interesting (possibly) problem right now between autotest
and rails integration tests.  There are a few things to preface this
with.

Works fine:
rake test
rake test:integration

Blows up:
autotest

Autotest is correctly determining rails and runs tests just fine.  One
part of the behavior is that if I save a change in just the
integration test (even hitting cmd+s to trigger a diff) the tests
execute fine.  Running all the tests from functional to integration to
unit, however, and the integration tests blow up.

>From what I can tell it runs into follow_redirect! and goes into a
hissy fit, and delivers this error message:
Runtime Error: not a redirect!  500 Internal
    c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/integ
ration.rb:115:in `follow_redirect!'
    c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/integ
ration.rb:547:in `send'
    c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/integ
ration.rb:547:in `method_missing'
    ./test/integration/new_user_test.rb:20:in `test_foo'
    c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/integ
ration.rb:453:in `run'

At this point I'd guess it's something going on with how the db's get
cloned/purged but honestly am too much of a novice to guess much
further past that.  I'm also not sure how to get autotest to reset the
db after every pass.  The useful information I gathered on tests like
this blowing up in some cases but not others basically said add
fixtures - I linked against everything I had, with no changes.  Any
advice?
813f535246722b7bf02aacc9ce818de8?d=identicon&s=25 Bob Showalter (Guest)
on 2007-07-25 17:16
(Received via mailing list)
On 7/25/07, Jim Truher <jtruher@gmail.com> wrote:
> autotest
>
> Autotest is correctly determining rails and runs tests just fine.  One
> part of the behavior is that if I save a change in just the
> integration test (even hitting cmd+s to trigger a diff) the tests
> execute fine.  Running all the tests from functional to integration to
> unit, however, and the integration tests blow up.

...

> The useful information I gathered on tests like
> this blowing up in some cases but not others basically said add
> fixtures - I linked against everything I had, with no changes.  Any
> advice?

What do you mean by "I linked against everything I had?" Do you mean
you're loading all your fixtures in every test case? I suspect it has
something to do with interactions between fixtures being loaded in one
test case but not another.

You might want to add an assert_response :redirect before the
follow_redirect! (That won't fix the error obviously).
7fd73acc52ca674305ae5103c1050116?d=identicon&s=25 Jim Truher (Guest)
on 2007-07-25 22:48
(Received via mailing list)
Correct - I've tried adding all the fixtures available, no change.
There is an assert_response :redirect before the follow.  Also just
for debugging I threw a few lines of puts status in various places
(since that's what follow_redirect! is interested in).  Passing tests,
get normal numbers - 302, 302, 200, etc.  Failing tests, get 500's, so
it looks like however it's bringing up whatever server for testing
isn't being done correctly?
91d00b2e1d76029cb9175053a846051b?d=identicon&s=25 Michael Johnston (lastobelus)
on 2008-02-14 07:23
Did you ever solve this issue? I'm running into (probably) the same
issue, however I don't think it has anything to do with redirects.

Rather in the second, failing case, the http headers of the response are
incomplete.

In my case, i am simply asserting that a response had error code 500
(because an uncaught exception was thrown).

The headers look like this:
(rake test or autotest first run after saving integration test)

@response.headers: {"Status"=>"500 Internal Server Error",
"type"=>"text/html; charset=utf-8", "cookie"=>[],
"Cache-Control"=>"no-cache", "Content-Length"=>11061}

and in the second, failing run of autotest:

@response.headers: {"cookie"=>[], "Cache-Control"=>"no-cache"}


So far I haven't isolated what the difference is, and before I spend too
much time digging thought I'd check if anyone had already solved this
issue.


Jim Truher wrote:
> Correct - I've tried adding all the fixtures available, no change.
> There is an assert_response :redirect before the follow.  Also just
> for debugging I threw a few lines of puts status in various places
> (since that's what follow_redirect! is interested in).  Passing tests,
> get normal numbers - 302, 302, 200, etc.  Failing tests, get 500's, so
> it looks like however it's bringing up whatever server for testing
> isn't being done correctly?
This topic is locked and can not be replied to.