Plugins unit testing


#1

Hi,

I am refactoring a utility class from my application in a plugin and I
am trying to get the unit tests to pass. (they were going pretty fine
before I moved things into a plugin)

I did find the ‘rake test_plugins’ command, which seems to trigger my
unit tests, however the load path does not seem to include my plugin’s
directories, so all my previously valid require directive are now
saying they can’t find the files.

I read the Plugins Conventions thread initiated in october by Jamis
Buck, it does mention the need for unit testing but no agreement was
reached over conventions / helpers to use for plugin unit testing.

currently i have the following structure :

your_rails_app/
|- app/
| |- controllers/
| |- models/
| |- helpers/
| |- views/
|- lib/
| -
|- vendor/
|- plugins/
|-my_plugin/
|-init.rb
|-lib/
|-my_plugin_core.rb
|-test/
|-mocks/
|-test/
|-my_plugin_mock.rb
|-unit/
|-my_plugin_test.rb

Is this correct ? should my tests work as they did when they lived in
the main test dir , is it expected that I have to redefine all the
require paths ?

Thanks,
Jean