-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
While changing the code to be in an `on_load` hook fixed some of the issues with load hook order, it didn't catch all of them. Rails runs its hooks in initializers, meaning they'll be defined after our own hooks which are not in an initializer. Fixes #24
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,19 @@ | |
require 'rails/controller/testing/template_assertions' | ||
require 'rails/controller/testing/version' | ||
|
||
ActiveSupport.on_load(:action_controller) do | ||
ActionController::TestCase.include Rails::Controller::Testing::TestProcess | ||
ActionController::TestCase.include Rails::Controller::Testing::TemplateAssertions | ||
class Rails::Controller::Testing::Railtie < Rails::Railtie | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rafaelfranca
Member
|
||
initializer "rails_controller_testing" do | ||
ActiveSupport.on_load(:action_controller) do | ||
ActionController::TestCase.include Rails::Controller::Testing::TestProcess | ||
ActionController::TestCase.include Rails::Controller::Testing::TemplateAssertions | ||
|
||
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::TemplateAssertions | ||
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::Integration | ||
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::TestProcess | ||
end | ||
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::TemplateAssertions | ||
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::Integration | ||
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::TestProcess | ||
This comment has been minimized.
Sorry, something went wrong.
koenpunt
|
||
end | ||
|
||
ActiveSupport.on_load(:action_view) do | ||
ActionView::TestCase.include Rails::Controller::Testing::TemplateAssertions | ||
ActiveSupport.on_load(:action_view) do | ||
ActionView::TestCase.include Rails::Controller::Testing::TemplateAssertions | ||
end | ||
end | ||
end |
Moving this to inside a Railtie makes the gem unusable outside of a Rails app, should we provide an alternative way to auto included it or just document how to do these
include
s manually?