Problem with plugin tests

Hi there,

I’ve been using Rails engines for a project. My unit tests work fine on
the
project itself, but now I’m writing an engine, and this engine’s unit
tests
don’t run correctly. I get this error:

$ rake test:plugins:units
(in /home/peter/src/libersy)
/usr/pkg/bin/ruby18 -Ilib
“/usr/pkg/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb”
“vendor/plugins/authentication/test/unit/user_test.rb”
/home/peter/src/libersy/test/test_helper.rb:25: undefined method
`use_instantiated_fixtures=’ for Test::Unit::TestCase:Class
(NoMethodError)
from ./vendor/plugins/authentication/test/unit/…/test_helper.rb:3
from ./vendor/plugins/authentication/test/unit/user_test.rb:1
from
/usr/pkg/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb:5
from
/usr/pkg/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb:5
rake aborted!
Command failed with status (1): [/usr/pkg/bin/ruby18 -Ilib
"/usr/pkg/lib/ru…]

(See full trace by running task with --trace)

I’ve tried googling for this error, but couldn’t find anything useful.
My plugin’s test_helper looks like this:

Load the normal Rails helper. This ensures the environment is loaded

require File.expand_path(File.dirname(FILE) +
‘/…/…/…/…/test/test_helper’)

Ensure that we are using the temporary fixture path

Engines::Testing.set_fixture_path

I also get the error when I try to run the test directly from the
console,
like so:
ruby vendor/plugins/authentication/test/unit/user_test.rb

Any idea what could cause this?

Regards,
Peter B.
Solide ICT - http://www.solide-ict.nl

It looks like your Rails application’s test_helper doesn’t know about
some of the testing additions that Rails provides. Does it have the
following lines at the top?

ENV[“RAILS_ENV”] = “test”
require File.expand_path(File.dirname(FILE) +
“/…/config/environment”)
require ‘test_help’

Without these, Test::Unit would definitely fall over…

On Tue, Feb 20, 2007 at 10:03:04AM +0000, James A. wrote:

It looks like your Rails application’s test_helper doesn’t know about
some of the testing additions that Rails provides. Does it have the
following lines at the top?

ENV[“RAILS_ENV”] = “test”
require File.expand_path(File.dirname(FILE) + “/…/config/environment”)
require ‘test_help’

Without these, Test::Unit would definitely fall over…

Yes, they’re there, as put in there by a default Rails application
setup.
As I said, the application’s tests work fine, it’s just the engine’s
tests
that don’t work.

Regards,
Peter B.
Solide ICT - http://www.solide-ict.nl