aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2016-01-12 14:09:43 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2016-01-12 14:09:56 -0800
commit04d61612f9fdc7f80202cd7d68c58900d8f40ab3 (patch)
tree4e2f9ebb4172f48ee7381d2f7ee0fac877fc4b61 /actionpack
parent12f4976200019ebc6b699e512691d9e49a5c6988 (diff)
downloadrails-04d61612f9fdc7f80202cd7d68c58900d8f40ab3.tar.gz
rails-04d61612f9fdc7f80202cd7d68c58900d8f40ab3.tar.bz2
rails-04d61612f9fdc7f80202cd7d68c58900d8f40ab3.zip
monkey patch `recycle!` on to controllers once
Instead of checking whether the class has recycle! or not, we can just always add the method to all controller classes when the test harness is loaded. Technically this means that the controller test harness will not work with controllers that do not inherit from AC::Metal, but then, I'm not sure that is supported anyway. Mixing in the module one will ensure that we don't break method caches, and eliminates a runtime check so it should speed up tests (slightly).
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/test_case.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index c55720859e..81c7dfa3b2 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -8,6 +8,10 @@ require 'rails-dom-testing'
module ActionController
# :stopdoc:
+ class Metal
+ include Testing::Functional
+ end
+
# ActionController::TestCase will be deprecated and moved to a gem in Rails 5.1.
# Please use ActionDispatch::IntegrationTest going forward.
class TestRequest < ActionDispatch::TestRequest #:nodoc:
@@ -478,10 +482,6 @@ module ActionController
@html_document = nil
- unless @controller.respond_to?(:recycle!)
- @controller.extend(Testing::Functional)
- end
-
self.cookies.update @request.cookies
self.cookies.update_cookies_from_jar
@request.set_header 'HTTP_COOKIE', cookies.to_header