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?
On 7/25/07, Jim T. [email protected] 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).
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?
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?