Forum: Rails Engines development Problem with plugin tests

Posted by Peter Bex (Guest)
on 2007-02-19 10:10
(Received via mailing list)
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 Bex
Solide ICT - http://www.solide-ict.nl
Posted by James Adam (Guest)
on 2007-02-20 11:04
(Received via mailing list)
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....
Posted by Peter Bex (Guest)
on 2007-02-21 15:08
(Received via mailing list)
On Tue, Feb 20, 2007 at 10:03:04AM +0000, James Adam 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 Bex
Solide ICT - http://www.solide-ict.nl
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.