Skip to content

Commit

Permalink
Use new hooks to extend test cases classes
Browse files Browse the repository at this point in the history
Whose hooks were added in
rails/rails@0510208
to fix load order issues.
  • Loading branch information
rafaelfranca committed Aug 25, 2016
1 parent 31d7579 commit d942a5d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
source 'https://rubygems.org'
gemspec

gem 'actionpack', github: 'rails/rails', branch: '5-0-stable'
gem 'actionview', github: 'rails/rails', branch: '5-0-stable'
gem 'activesupport', github: 'rails/rails', branch: '5-0-stable'
gem 'railties', github: 'rails/rails', branch: '5-0-stable'
18 changes: 10 additions & 8 deletions lib/rails/controller/testing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ module Rails
module Controller
module Testing
def self.install
ActiveSupport.on_load(:action_controller) do
ActionController::TestCase.include Rails::Controller::Testing::TestProcess
ActionController::TestCase.include Rails::Controller::Testing::TemplateAssertions
ActiveSupport.on_load(:action_controller_test_case) do
include Rails::Controller::Testing::TestProcess
include Rails::Controller::Testing::TemplateAssertions
end

ActionDispatch::IntegrationTest.include Rails::Controller::Testing::TemplateAssertions
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::Integration
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::TestProcess
ActiveSupport.on_load(:action_dispatch_integration_test) do
include Rails::Controller::Testing::TemplateAssertions
include Rails::Controller::Testing::Integration
include Rails::Controller::Testing::TestProcess
end

ActiveSupport.on_load(:action_view) do
ActionView::TestCase.include Rails::Controller::Testing::TemplateAssertions
ActiveSupport.on_load(:action_view_test_case) do
include Rails::Controller::Testing::TemplateAssertions
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions rails-controller-testing.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Gem::Specification.new do |s|

s.required_ruby_version = '>= 2.2.2'

s.add_dependency "actionpack", "~> 5.x"
s.add_dependency "actionview", "~> 5.x"
s.add_dependency "actionpack", "~> 5.x" # TODO: require 5.0.1 to get the test case hook
s.add_dependency "actionview", "~> 5.x" # TODO: require 5.0.1 to get the test case hook
s.add_dependency "activesupport", "~> 5.x"

s.add_development_dependency "railties", "~> 5.x"
Expand Down

1 comment on commit d942a5d

@connorshea
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rafaelfranca happy holidays! Can we get a new release of rails-controller-testing now that 5.0.1 is out?

Please sign in to comment.