Module: ActionController::Testing

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

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary (collapse)

Methods included from ActiveSupport::Concern

append_features, extended, included

Methods included from RackDelegation

#dispatch, #reset_session, #response_body=

Instance Method Details

- (Object) headers=(new_headers)

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



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

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

- (Object) process_with_new_base_test(request, response)

TODO: Clean this up



8
9
10
11
12
13
14
15
16
17
18
19
# File 'actionpack/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

- (Object) set_test_assigns



21
22
23
24
25
26
27
# File 'actionpack/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