From 9f4dafb8ef2a7c8c409d5f0a7d2f2fca8215c992 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 3 Jul 2012 17:13:04 -0700 Subject: push functional test specific methods to it's own module --- actionpack/lib/action_controller/metal/testing.rb | 18 ++++++++++-------- actionpack/lib/action_controller/test_case.rb | 6 +++++- 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/metal/testing.rb b/actionpack/lib/action_controller/metal/testing.rb index f998efb6e9..09581d4fc9 100644 --- a/actionpack/lib/action_controller/metal/testing.rb +++ b/actionpack/lib/action_controller/metal/testing.rb @@ -4,20 +4,22 @@ module ActionController 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} diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 9a5fa719a8..210ae98f8d 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -491,7 +491,11 @@ module ActionController @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] -- cgit v1.2.3