How to load new version of test/unit

hi,

I’m having a strange issue with test/unit. I want to use the at_start
method, which is not available in the version that comes bundled with
ruby. So I installed the 2.5.5 version with “gem install test-unit”.
Here’s how I use it:

gem ‘test-unit’, ‘=2.5.5’
require ‘test/unit’
require ‘factory_girl’

Test::Unit.at_start do
puts “In start block”
end

class CouponTest < Test::Unit::TestCase
include FactoryGirl::Syntax::Methods

def test_all_ok
assert true
end
end

This runs OK when I run it directly with ruby, but when I run it with
rake it appears to load the old version of test/unit and so fails with
NoMethodError on at_start. This happens even when I load the gem in the
rakefile. Here’s my rakefile code:

require ‘rake’
require ‘rake/testtask’

Rake::TestTask.new(‘integration’) do |t|
ENV[‘RACK_ENV’] = ‘test’
t.libs << “app”
t.pattern = “app/tests/test*test.rb”
end

So my questions are:

  1. How can I make this work when I run it from the rakefile?
  2. Is there nay way to load the new version of test/unit without
    resorting to “gem ‘test-unit’”?