Forum: Ruby on Rails Plugins unit testing

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
75da740d43c5780539214f24ce1148a6?d=identicon&s=25 Jean Helou (Guest)
on 2006-01-04 22:40
(Received via mailing list)
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/
  | - <etc>
  |- 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
This topic is locked and can not be replied to.