config.plugin_paths << .. in environment/test.rb : ignored in Rails 2.0.2

Hi all,

I used to move test-only plugins (like mocha, …) to /vendor/plugins-test, and update config.plugin_paths in environment/test.rb accordingly :

file: environment/test.rb

config.plugin_paths << “#{RAILS_ROOT}/vendor/plugins-test”

Problem: after upgrading a project to Rails 2.0.2 it stopped working (test plugins are not loaded)

Though, If I move that line to environment.rb, it works (but it defeats the purpose of test.rb).

Isn’t this a bug?

Alain Ravet

Hi all,

I used to move test-only plugins (like mocha, ..) to /vendor/plugins-test,
and update config.plugin_paths in environment/test.rb accordingly :
file: environment/test.rb
  ...
  config.plugin_paths << "#{RAILS_ROOT}/vendor/plugins-test"
  ...

Problem: after upgrading a project to Rails 2.0.2 it stopped working (test
plugins are not loaded)
Though, If I move that line to environment.rb, it works (but it defeats the
purpose of test.rb).

Rails 2.0 refactored plugin loading, and now plugin load paths are set before the environment is setup (ie before test.rb, development.rb are loaded).
This certainly wasn't intentional, I'd file a ticket/post on rails-core

Fred