After Rails 2.3.2 upgrade: superclass mismatch for class TestCase (TypeError)

I upgraded a working app from rails 2.1 to 2.3.2. Now when I run rake
test:units I get this error: /usr/lib/ruby/gems/1.8/gems/
activesupport-2.3.2/lib/active_support/test_case.rb:17: superclass
mismatch for class TestCase (TypeError)

I generated a new test app and all tests run OK.

For the upgrade I ran rake:update and renamed the class in test_helper
to ActiveSupport::TestCase. Also renamed the classes in all unit tests
and to inherit from ActiveSupport::TestCase and in functional tests to
inherit from ActionController::TestCase.
I still could not fix it this error. I compared line by line the
config files and the test_helper.rb with a brand new app and there are
almost the same. Google didn’t provide any clue.

Full stack trace here:

/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/
test_case.rb:17: superclass mismatch for class TestCase (TypeError)
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:158:in require' from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/ action_controller/test_case.rb:1 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require’
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/ active_support/dependencies.rb:158:inrequire’
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/test_help.rb:6
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:158:in require' from /home/costi/workspace/r2rrails/test/test_helper.rb:3 from ./test/unit/customer_test.rb:1:inrequire’
from ./test/unit/customer_test.rb:1
from /usr/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake/
rake_test_loader.rb:5:in load' from /usr/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake/ rake_test_loader.rb:5 from /usr/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake/ rake_test_loader.rb:5:ineach’
from /usr/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake/
rake_test_loader.rb:5
rake aborted!

On Apr 6, 11:09 pm, Constantin G.
[email protected] wrote:

inherit from ActionController::TestCase.
Looks to me like you accidentally declared a new class called
ActiveSupport::TestCase. You said your test_helper.rb is almost the
same as one in a freshly generated app - what are the differences?

Fred

On 6 avr, 17:23, Frederick C. [email protected] wrote:

For the upgrade I ran rake:update and renamed the class in test_helper
to ActiveSupport::TestCase. Also renamed the classes in all unit tests
and to inherit from ActiveSupport::TestCase and in functional tests to
inherit from ActionController::TestCase.

Looks to me like you accidentally declared a new class called
ActiveSupport::TestCase. You said your test_helper.rb is almost the
same as one in a freshly generated app - what are the differences?

This is the diff between the two test_helper.rb (one being the virgin
one, the second being the new one). Not much of a difference but my
extra functions.

18,21d17
< #
< # The only drawback to using transactional fixtures is when you
actually
< # need to test transactions. Since your test is bracketed by a
transaction,
< # any transactions started in your code will be automatically
rolled back.
23a20

36a34,35

37a37,56

login_as(user)
yield
logout!

end

def get_roles_and_rights
Right.synchronize_with_controllers
DefaultRights.update
end

On 6 avr, 17:23, Frederick C. [email protected] wrote:

For the upgrade I ran rake:update and renamed the class in test_helper
to ActiveSupport::TestCase. Also renamed the classes in all unit tests
and to inherit from ActiveSupport::TestCase and in functional tests to
inherit from ActionController::TestCase.

Looks to me like you accidentally declared a new class called
ActiveSupport::TestCase. You said your test_helper.rb is almost the
same as one in a freshly generated app - what are the differences?

There must have been a plugin that changed the class TestCase class. I
realized that have done a search and replace in the plugins folder too
for Test::Unit::TestCase and replaced it to ActiveSupport::TestCase. I
did an svn revert on plugins and the rake test:units don’t show the
superclass mismatch for class TestCase error.