Skip to content

Commit d942a5d

Browse files
committed
Use new hooks to extend test cases classes
Whose hooks were added in rails/rails@0510208 to fix load order issues.
1 parent 31d7579 commit d942a5d

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

Gemfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
source 'https://rubygems.org'
22
gemspec
3+
4+
gem 'actionpack', github: 'rails/rails', branch: '5-0-stable'
5+
gem 'actionview', github: 'rails/rails', branch: '5-0-stable'
6+
gem 'activesupport', github: 'rails/rails', branch: '5-0-stable'
7+
gem 'railties', github: 'rails/rails', branch: '5-0-stable'

lib/rails/controller/testing.rb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ module Rails
77
module Controller
88
module Testing
99
def self.install
10-
ActiveSupport.on_load(:action_controller) do
11-
ActionController::TestCase.include Rails::Controller::Testing::TestProcess
12-
ActionController::TestCase.include Rails::Controller::Testing::TemplateAssertions
10+
ActiveSupport.on_load(:action_controller_test_case) do
11+
include Rails::Controller::Testing::TestProcess
12+
include Rails::Controller::Testing::TemplateAssertions
13+
end
1314

14-
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::TemplateAssertions
15-
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::Integration
16-
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::TestProcess
15+
ActiveSupport.on_load(:action_dispatch_integration_test) do
16+
include Rails::Controller::Testing::TemplateAssertions
17+
include Rails::Controller::Testing::Integration
18+
include Rails::Controller::Testing::TestProcess
1719
end
1820

19-
ActiveSupport.on_load(:action_view) do
20-
ActionView::TestCase.include Rails::Controller::Testing::TemplateAssertions
21+
ActiveSupport.on_load(:action_view_test_case) do
22+
include Rails::Controller::Testing::TemplateAssertions
2123
end
2224
end
2325
end

rails-controller-testing.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Gem::Specification.new do |s|
1818

1919
s.required_ruby_version = '>= 2.2.2'
2020

21-
s.add_dependency "actionpack", "~> 5.x"
22-
s.add_dependency "actionview", "~> 5.x"
21+
s.add_dependency "actionpack", "~> 5.x" # TODO: require 5.0.1 to get the test case hook
22+
s.add_dependency "actionview", "~> 5.x" # TODO: require 5.0.1 to get the test case hook
2323
s.add_dependency "activesupport", "~> 5.x"
2424

2525
s.add_development_dependency "railties", "~> 5.x"

0 commit comments

Comments
 (0)