mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
0510208dd1
Usually users extends tests classes doing something like: ActionView::TestCase.include MyCustomTestHelpers This is bad because it will load the ActionView::TestCase right aways and this will load ActionController::Base making its on_load hooks to execute early than it should. One way to fix this is using the on_load hooks of the components like: ActiveSupport.on_load(:action_view) do ActionView::TestCase.include MyCustomTestHelpers end The problem with this approach is that the test extension will be only load when ActionView::Base is loaded and this may happen too late in the test. To fix this we are adding hooks to people extend the test classes that will be loaded exactly when the test classes are needed.
9 lines
203 B
Ruby
9 lines
203 B
Ruby
require "active_support/test_case"
|
|
|
|
module ActiveJob
|
|
class TestCase < ActiveSupport::TestCase
|
|
include ActiveJob::TestHelper
|
|
|
|
ActiveSupport.run_load_hooks(:active_job_test_case, self)
|
|
end
|
|
end
|