diff options
Diffstat (limited to 'actionpack/lib/action_controller/test_case.rb')
| -rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 33 | 
1 files changed, 18 insertions, 15 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 380e9d29b4..b43bb9dc17 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -7,6 +7,13 @@ require 'action_controller/template_assertions'  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:      DEFAULT_ENV = ActionDispatch::TestRequest::DEFAULT_ENV.dup      DEFAULT_ENV.delete 'PATH_INFO' @@ -210,11 +217,11 @@ module ActionController    #       # Simulate a POST response with the given HTTP parameters.    #       post(:create, params: { book: { title: "Love Hina" }})    # -  #       # Assert that the controller tried to redirect us to +  #       # Asserts that the controller tried to redirect us to    #       # the created book's URI.    #       assert_response :found    # -  #       # Assert that the controller really put the book in the database. +  #       # Asserts that the controller really put the book in the database.    #       assert_not_nil Book.find_by(title: "Love Hina")    #     end    #   end @@ -452,16 +459,16 @@ module ActionController              parameters = nil            end -          if parameters.present? || session.present? || flash.present? +          if parameters || session || flash              non_kwarg_request_warning            end          end -        if body.present? +        if body            @request.set_header 'RAW_POST_DATA', body          end -        if http_method.present? +        if http_method            http_method = http_method.to_s.upcase          else            http_method = "GET" @@ -469,16 +476,12 @@ module ActionController          parameters ||= {} -        if format.present? +        if format            parameters[:format] = format          end          @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 @@ -509,20 +512,19 @@ module ActionController            end          end -        @controller.request  = @request -        @controller.response = @response -          @request.fetch_header("SCRIPT_NAME") do |k|            @request.set_header k, @controller.config.relative_url_root          end          @controller.recycle! -        @controller.process(action) +        @controller.dispatch(action, @request, @response) +        @request = @controller.request +        @response = @controller.response          @request.delete_header 'HTTP_COOKIE'          if @request.have_cookie_jar? -          unless @response.committed? +          unless @request.cookie_jar.committed?              @request.cookie_jar.write(@response)              self.cookies.update(@request.cookie_jar.instance_variable_get(:@cookies))            end @@ -659,4 +661,5 @@ module ActionController      include Behavior    end +  # :startdoc:  end  | 
