# Problem with plugin tests

**URL:** <https://www.ruby-forum.com/t/problem-with-plugin-tests/86042>\
**Category:** Engines Development\
**Created:** [February 19, 2007, 10:10am UTC](https://www.ruby-forum.com/t/problem-with-plugin-tests/86042 "2007-02-19T10:10:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bodikp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e79b87/32.png) [@bodikp](https://www.ruby-forum.com/u/bodikp)\
**Post date:** [February 19, 2007, 10:10am UTC](https://www.ruby-forum.com/t/problem-with-plugin-tests/86042/1 "2007-02-19T10:10:01Z")

</div>

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](http://www.solide-ict.nl)

---

<div class="post-metadata">

**Author:** ![bodikp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e79b87/32.png) [@bodikp](https://www.ruby-forum.com/u/bodikp)\
**Post date:** [February 20, 2007, 11:04am UTC](https://www.ruby-forum.com/t/problem-with-plugin-tests/86042/2 "2007-02-20T11:04:07Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![bodikp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e79b87/32.png) [@bodikp](https://www.ruby-forum.com/u/bodikp)\
**Post date:** [February 21, 2007, 3:08pm UTC](https://www.ruby-forum.com/t/problem-with-plugin-tests/86042/3 "2007-02-21T15:08:41Z")

</div>

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](http://www.solide-ict.nl)
