18 March 2009 · About 1 minute read

Rails: Upgrading test_helper.rb for Rails 2.3

Keen to be using the latest code and features of Rails, I installed Rails 2.3 for development today. So far, most of the app has worked fine after a running a rake rails:update. However, today I came across an error when running my unit tests:

```bash$ rake test:units

/usr/bin/ruby1.8 -Ilib:test “/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb” “test/unit/client_test.rb”

./test/test_helper.rb:22: undefined method `use_transactional_fixtures=’ for Test::Unit::TestCase:Class (NoMethodError)

rake aborted!```

To see what was going on, I created a new rails app and checked out the default test_helper.rb. It seems the TestCase class has been moved from Test::Unit into ActiveSupport:

```ruby# test_helper.rb (Rails 2.2 - doesn’t work in 2.3)

class Test::Unit::TestCase


test_helper.rb (Rails 2.3)

class ActiveSupport::TestCase


After this quick change, the tests were back up and running.

Chris Blunt
Chris Blunt @cblunt
Chris is the founder of Plymouth Software. As well as code and business, he enjoys being a Dad, swimming, and the fine art of drinking tea.