Skip to content
Browse files

push functional test specific methods to it's own module

  • Loading branch information...
1 parent b5442b5 commit 9f4dafb8ef2a7c8c409d5f0a7d2f2fca8215c992 @tenderlove tenderlove committed Jul 3, 2012
Showing with 15 additions and 9 deletions.
  1. +10 −8 actionpack/lib/action_controller/metal/testing.rb
  2. +5 −1 actionpack/lib/action_controller/test_case.rb
View
18 actionpack/lib/action_controller/metal/testing.rb
@@ -4,20 +4,22 @@ module Testing
include RackDelegation
- def set_response!(request)
- super unless @_response
- end
-
- def recycle!
- @_url_options = nil
- end
-
# TODO : Rewrite tests using controller.headers= to use Rack env
def headers=(new_headers)
@_response ||= ActionDispatch::Response.new
@_response.headers.replace(new_headers)
end
+ # Behavior specific to functional tests
+ module Functional # :nodoc:
+ def set_response!(request)
+ end
+
+ def recycle!
+ @_url_options = nil
+ end
+ end
+
module ClassMethods
def before_filters
_process_action_callbacks.find_all{|x| x.kind == :before}.map{|x| x.name}
View
6 actionpack/lib/action_controller/test_case.rb
@@ -491,7 +491,11 @@ def process(action, http_method = 'GET', *args)
@controller.response = @response
build_request_uri(action, parameters)
- @controller.class.class_eval { include Testing }
+
+ unless @controller.respond_to?(:recycle!)
+ @controller.extend(Testing::Functional)
+ @controller.class.class_eval { include Testing }
+ end
@controller.recycle!
name = @request.parameters[:action]

0 comments on commit 9f4dafb

Please sign in to comment.
Something went wrong with that request. Please try again.