This is following up on http://lists.toolbocks.com/pipermail/
(datetime_toolbocks fails in functional tests)
Here’s the problem:
Engines causes plugins to be loaded in 2 phases. First plugins that
don’t depend on engines are loaded. Then Rails does some
initialization. Then Engines patches Rails. Then the remaining
plugins get loaded.
After all that is done, Engines’ modifications of dependencies.rb
will cause a subsequent load of application_helper to be patched by
application_helper files in plugins. All well and good in
development and production mode.
The trouble comes in test mode: the file ~rails/lib/test_help.rb gets
loaded during Rails’s initialization, before the engines plugins.
test_help.rb requires application.rb, which in turn loads
application_helper.rb. Because the engines plugins haven’t been
loaded yet, application_helper.rb is unpatched, and
datetime_toolbocks’s methods are unavailable to functional tests.
It looks like there is a related bug in the engines repository:
A nasty fix is to copy ~rails/lib/test_help.rb to your project’s lib
directory and then add the following two lines right before the call
to require_dependency ‘application’
(Engines.after_initialize loads the extra plugins)