Module: ActionController::Testing

Extended by:
ActiveSupport::Concern
Includes:
RackDelegation
Defined in:
lib/action_controller/metal/testing.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from RackDelegation

#dispatch, #reset_session, #response_body=

Instance Method Details

#headers=(new_headers) ⇒ Object

TODO : Rewrite tests using controller.headers= to use Rack env



30
31
32
33
# File 'lib/action_controller/metal/testing.rb', line 30

def headers=(new_headers)
  @_response ||= ActionDispatch::Response.new
  @_response.headers.replace(new_headers)
end

#process_with_new_base_test(request, response) ⇒ Object

TODO: Clean this up



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/action_controller/metal/testing.rb', line 8

def process_with_new_base_test(request, response)
  @_request = request
  @_response = response
  @_response.request = request
  ret = process(request.parameters[:action])
  if cookies = @_request.env['action_dispatch.cookies']
    cookies.write(@_response)
  end
  @_response.prepare!
  set_test_assigns
  ret
end

#set_test_assignsObject



21
22
23
24
25
26
27
# File 'lib/action_controller/metal/testing.rb', line 21

def set_test_assigns
  @assigns = {}
  (instance_variable_names - self.class.protected_instance_variables).each do |var|
    name, value = var[1..-1], instance_variable_get(var)
    @assigns[name] = value
  end
end