Forum: Rails Engines development Engines bug breaks functional tests with datetime_toolbocks

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.
Geoff D. (Guest)
on 2007-06-21 01:35
(Received via mailing list)
This is following up on http://lists.toolbocks.com/pipermail/
toolbocks-user/2007-May/000027.html
(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:
http://dev.rails-engines.org/engines-plugin/tickets/16

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'

require 'engines'
Engines.after_initialize

(Engines.after_initialize loads the extra plugins)

Geoff
James A. (Guest)
on 2007-06-21 02:37
(Received via mailing list)
Hi Geoff,

Thanks for the thorough investigation. The first thing I'd do here
would be to open a new ticket (or reopen Ticket #16) and post your
findings there. Then we can start looking at how to fix this issue in
the test environment.

James
This topic is locked and can not be replied to.