# Autotest + integration testing (follow\_redirect!) error

**URL:** <https://www.ruby-forum.com/t/autotest-integration-testing-follow-redirect-error/110332>\
**Category:** Rails\
**Created:** [July 25, 2007, 1:02pm UTC](https://www.ruby-forum.com/t/autotest-integration-testing-follow-redirect-error/110332 "2007-07-25T13:02:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elyod\_72](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed655f/32.png) [@elyod\_72](https://www.ruby-forum.com/u/elyod_72)\
**Post date:** [July 25, 2007, 1:02pm UTC](https://www.ruby-forum.com/t/autotest-integration-testing-follow-redirect-error/110332/1 "2007-07-25T13:02:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![elyod\_72](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed655f/32.png) [@elyod\_72](https://www.ruby-forum.com/u/elyod_72)\
**Post date:** [July 25, 2007, 5:16pm UTC](https://www.ruby-forum.com/t/autotest-integration-testing-follow-redirect-error/110332/2 "2007-07-25T17:16:57Z")

</div>

On 7/25/07, Jim T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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).

---

<div class="post-metadata">

**Author:** ![elyod\_72](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed655f/32.png) [@elyod\_72](https://www.ruby-forum.com/u/elyod_72)\
**Post date:** [July 25, 2007, 10:48pm UTC](https://www.ruby-forum.com/t/autotest-integration-testing-follow-redirect-error/110332/3 "2007-07-25T22:48:35Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![elyod\_72](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed655f/32.png) [@elyod\_72](https://www.ruby-forum.com/u/elyod_72)\
**Post date:** [February 14, 2008, 7:23am UTC](https://www.ruby-forum.com/t/autotest-integration-testing-follow-redirect-error/110332/4 "2008-02-14T07:23:25Z")

</div>

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 T. 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?
