123456789_123456789_123456789_123456789_123456789_

Class: ActionView::TestCase::TestController

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
self, ::ActionDispatch::TestProcess, ::ActionDispatch::TestProcess::FixtureFile, ::ActionController::Base, ::AbstractController::Rendering, ::AbstractController::Translation, ::ActionController::Helpers, ::ActionController::Redirecting, ::ActionController::UrlFor, ::AbstractController::UrlFor, ::ActionDispatch::Routing::UrlFor, ::ActionDispatch::Routing::PolymorphicRoutes, ::ActionView::Layouts, ::ActionView::Rendering, ::ActionView::ViewPaths, ::ActionController::Renderers::All, ::ActionController::Renderers, ::ActionController::EtagWithTemplateDigest, ::ActionController::EtagWithFlash, ::ActionController::ConditionalGet, ::ActionController::Head, ::AbstractController::Caching, ::AbstractController::Caching::Fragments, ::AbstractController::Caching::ConfigMethods, ::ActionController::Caching, ::ActionController::MimeResponds, ::ActionController::StrongParameters, ::ActionController::ParameterEncoding, ::ActionController::FormBuilder, ::ActionController::RequestForgeryProtection, ::AbstractController::Helpers, ::ActionController::Streaming, ::ActionController::DataStreaming, ::ActionController::Rendering, ::ActionController::HttpAuthentication::Basic::ControllerMethods, ::ActionController::HttpAuthentication::Digest::ControllerMethods, ::ActionController::HttpAuthentication::Token::ControllerMethods, ::ActionController::DefaultHeaders, ::ActionController::Logging, ::AbstractController::Callbacks, ::ActiveSupport::Callbacks, ::ActionController::Rescue, ::ActiveSupport::Rescuable, ::ActionController::Instrumentation, ::ActiveSupport::Benchmarkable, ::ActionController::ParamsWrapper, ::ActionController::Metal, ::AbstractController::Base, ::ActiveSupport::Configurable
Inherits: ActionController::Base
Defined in: actionview/lib/action_view/test_case.rb

Constant Summary

::ActionController::ParamsWrapper - Included

EXCLUDE_PARAMETERS

::ActiveSupport::Callbacks - Included

CALLBACK_FILTER_TYPES

::ActionController::Rendering - Included

RENDER_FORMATS_IN_PRIORITY

::ActionController::RequestForgeryProtection - Included

AUTHENTICITY_TOKEN_LENGTH, CROSS_ORIGIN_JAVASCRIPT_WARNING, CSRF_TOKEN, GLOBAL_CSRF_TOKEN_IDENTIFIER, NULL_ORIGIN_MESSAGE

::ActionController::Renderers - Included

RENDERERS

::ActionController::Redirecting - Included

ILLEGAL_HEADER_VALUE_REGEX

::AbstractController::Rendering - Included

DEFAULT_PROTECTED_INSTANCE_VARIABLES

::ActionController::Base - Inherited

MODULES, PROTECTED_IVARS

Class Attribute Summary

Class Method Summary

::ActionController::Base - Inherited

.without_modules

Shortcut helper that returns all the modules included in ::ActionController::Base except the ones passed as arguments:

::ActionController::Metal - Inherited

.action

Returns a ::Rack endpoint for the given action name.

.controller_name

Returns the last part of the controller’s name, underscored, without the ending Controller.

.dispatch

Direct dispatch to the controller.

.make_response!,
.middleware

The middleware stack used by this controller.

.new,
.use

Pushes the given ::Rack middleware and its arguments to the bottom of the middleware stack.

::AbstractController::Base - Inherited

.abstract,
.abstract!

Define a controller as abstract.

.action_methods

A list of method names that should be considered actions.

.clear_action_methods!

action_methods are cached and there is sometimes a need to refresh them.

.controller_path

Returns the full controller name, underscored, without the ending Controller.

.internal_methods

A list of all internal methods for a controller.

.method_added

Refresh the cached action_methods when a new action_method is added.

::ActiveSupport::DescendantsTracker - Extended

Instance Attribute Summary

::ActionController::Base - Inherited

::ActionController::Helpers - Included

::ActionController::Redirecting - Included

::AbstractController::UrlFor - Included

::ActionView::Layouts - Included

#action_has_layout=,
#action_has_layout?

Controls whether an action should be rendered using a layout.

::ActionView::Rendering - Included

::ActionView::ViewPaths - Included

::ActionController::Renderers::All - Included

::ActionController::EtagWithTemplateDigest - Included

::ActionController::EtagWithFlash - Included

::AbstractController::Caching - Inherited

::AbstractController::Caching::ConfigMethods - Included

::ActionController::StrongParameters - Included

#params

Returns a new ::ActionController::Parameters object that has been instantiated with the request.parameters.

#params=

Assigns the given value to the #params hash.

::ActionController::RequestForgeryProtection - Included

#_helper_methods, #_helper_methods?, #raise_on_missing_callback_actions,
#any_authenticity_token_valid?

Checks if any of the authenticity tokens from the request are valid.

#marked_for_same_origin_verification?

If the verify_authenticity_token before_action ran, verify that JavaScript responses are only served to same-origin GET requests.

#non_xhr_javascript_response?

Check for cross-origin JavaScript responses.

#protect_against_forgery?

Checks if the controller allows forgery protection.

#valid_request_origin?

Checks if the request originated from the same origin by looking at the Origin header.

#verified_request?

Returns true or false if a request is verified.

::AbstractController::Callbacks - Included

::ActionController::Rescue - Included

#rescue_handlers, #rescue_handlers?,
#show_detailed_exceptions?

Override this method if you want to customize when detailed exceptions must be shown.

::ActionController::Instrumentation - Included

::ActionController::Metal - Inherited

#content_type, #headers, #location, #media_type, #middleware_stack, #middleware_stack?, #params, #params=,
#performed?

Tests if render or redirect has already happened.

#request

:attr_reader: request.

#response

:attr_reader: response.

#response=

Assign the response and mark it as committed.

#response_body=, #session, #status

::AbstractController::Base - Inherited

#action_name

Returns the name of the action this controller is processing.

#formats

Returns the formats that can be processed by the controller.

#performed?

Tests if a response body is set.

#response_body

Returns the body of the HTTP response sent by the controller.

Instance Method Summary

::ActionDispatch::TestProcess - Included

::ActionDispatch::TestProcess::FixtureFile - Included

#file_fixture_upload

Shortcut for ‘Rack::Test::UploadedFile.new(File.join(ActionDispatch::IntegrationTest.file_f ixture_path, path), type)`:

#fixture_file_upload

::AbstractController::Rendering - Included

#render

Normalizes arguments and options, and then delegates to render_to_body and sticks the result in self.response_body.

#render_to_body

Performs the actual template rendering.

#render_to_string

Similar to #render, but only returns the rendered template as a string, instead of setting self.response_body.

#rendered_format

Returns Content-Type of rendered content.

#view_assigns

This method should return a hash with assigns.

#_normalize_args

Normalize args by converting render "foo" to render action: "foo" and render "foo/bar" to render file: "foo/bar".

#_normalize_options

Normalize options.

#_process_options

Process extra options.

::AbstractController::Translation - Included

#l
#localize

Delegates to I18n.localize.

#t
#translate

Delegates to I18n.translate.

::ActionController::Helpers - Included

#helpers

Provides a proxy to access helper methods from outside the view.

::ActionController::Redirecting - Included

#redirect_back

Soft deprecated alias for #redirect_back_or_to where the fallback_location location is supplied as a keyword argument instead of the first positional argument.

#redirect_back_or_to

Redirects the browser to the page that issued the request (the referrer) if possible, otherwise redirects to the provided default fallback location.

#redirect_to

Redirects the browser to the target specified in options.

#url_from

Verifies the passed location is an internal URL that’s safe to redirect to and returns it, or nil if not.

::ActionController::UrlFor - Included

::AbstractController::UrlFor - Included

::ActionDispatch::Routing::UrlFor - Included

#initialize,
#route_for

Allows calling direct or regular named route.

#url_for

Generate a URL based on the options provided, default_url_options, and the routes defined in config/routes.rb.

#url_options

Hook overridden in controller to add request information with default_url_options.

#_routes_context, #_with_routes

::ActionDispatch::Routing::PolymorphicRoutes - Included

#polymorphic_path

Returns the path component of a URL for the given record.

#polymorphic_url

Constructs a call to a named RESTful route for the given record and returns the resulting URL string.

::ActionView::Rendering - Included

::ActionView::ViewPaths - Included

#any_templates?,
#append_view_path

Append a path to the list of view paths for the current ::ActionView::LookupContext.

#details_for_lookup,
#lookup_context

::ActionView::LookupContext is the object responsible for holding all information required for looking up templates, i.e. view paths and details.

#prepend_view_path

Prepend a path to the list of view paths for the current ::ActionView::LookupContext.

#template_exists?

::ActionController::Renderers - Included

#_render_to_body_with_renderer,
#render_to_body

Called by render in ::AbstractController::Rendering which sets the return value as the response_body.

::ActionController::ConditionalGet - Included

#expires_in

Sets the Cache-Control header, overwriting existing directives.

#expires_now

Sets an HTTP 1.1 Cache-Control header of no-cache.

#fresh_when

Sets the etag, last_modified, or both on the response, and renders a ‘304 Not Modified` response if the request is already fresh.

#http_cache_forever

Cache or yield the block.

#no_store

Sets an HTTP 1.1 Cache-Control header of no-store.

#stale?

Sets the etag and/or last_modified on the response and checks them against the request.

::ActionController::Head - Included

#head

Returns a response that has no content (merely headers).

::AbstractController::Caching - Inherited

#view_cache_dependencies,
#cache

Convenience accessor.

::AbstractController::Caching::Fragments - Included

#combined_fragment_cache_key

Given a key (as described in expire_fragment), returns a key array suitable for use in reading, writing, or expiring a cached fragment.

#expire_fragment

Removes fragments from the cache.

#fragment_exist?

Check if a cached fragment from the location signified by key exists (see expire_fragment for acceptable formats).

#read_fragment

Reads a cached fragment from the location signified by key (see expire_fragment for acceptable formats).

#write_fragment

Writes content to the location signified by key (see expire_fragment for acceptable formats).

::ActionController::MimeResponds - Included

#respond_to

Without web-service support, an action which collects the data for displaying a list of people might look something like this:

::ActionController::FormBuilder - Included

#default_form_builder

Default form builder for the controller.

::ActionController::RequestForgeryProtection - Included

#commit_csrf_token, #initialize, #reset_csrf_token, #compare_with_global_token, #compare_with_real_token, #csrf_token_hmac,
#form_authenticity_param

The form’s authenticity parameter.

#form_authenticity_token

Creates the authenticity token for the current request.

#global_csrf_token,
#mark_for_same_origin_verification!

GET requests are checked for cross-origin JavaScript after rendering.

#mask_token, #normalize_action_path, #normalize_relative_action_path, #per_form_csrf_token, #real_csrf_token,
#request_authenticity_tokens

Possible authenticity tokens sent in the request.

#unmask_token,
#valid_authenticity_token?

Checks the client’s masked token to see if it matches the session token.

#valid_per_form_csrf_token?,
#verify_authenticity_token

The actual before_action that is used to verify the CSRF token.

#verify_same_origin_request

If verify_authenticity_token was run (indicating that we have forgery protection enabled for this request) then also verify that we aren’t serving an unauthorized cross-origin response.

#xor_byte_strings

::AbstractController::Helpers - Included

::ActionController::DataStreaming - Included

#send_data

Sends the given binary data to the browser.

#send_file

Sends the file.

::ActionController::Rendering - Included

#render

Renders a template and assigns the result to self.response_body.

#render_to_string

Similar to #render, but only returns the rendered template as a string, instead of setting self.response_body.

::ActionController::HttpAuthentication::Basic::ControllerMethods - Included

::ActionController::HttpAuthentication::Digest::ControllerMethods - Included

#authenticate_or_request_with_http_digest

Authenticate using an HTTP Digest, or otherwise render an HTTP header requesting the client to send a ::Digest.

#authenticate_with_http_digest

Authenticate using an HTTP Digest.

#request_http_digest_authentication

Render an HTTP header requesting the client to send a ::Digest for authentication.

::ActionController::HttpAuthentication::Token::ControllerMethods - Included

#authenticate_or_request_with_http_token

Authenticate using an HTTP Bearer token, or otherwise render an HTTP header requesting the client to send a Bearer token.

#authenticate_with_http_token

Authenticate using an HTTP Bearer token.

#request_http_token_authentication

Render an HTTP header requesting the client to send a Bearer token for authentication.

::ActiveSupport::Callbacks - Included

#run_callbacks

Runs the callbacks for the given event.

::ActiveSupport::Rescuable - Included

#rescue_with_handler

Delegates to the class method, but uses the instance as the subject for rescue_from handlers (method calls, instance_exec blocks).

::ActionController::Instrumentation - Included

#redirect_to, #render, #send_data, #send_file,
#append_info_to_payload

Every time after an action is processed, this method is invoked with the payload, so you can add more information.

#cleanup_view_runtime

A hook which allows you to clean up any time, wrongly taken into account in views, like database querying time.

::ActiveSupport::Benchmarkable - Included

#benchmark

Allows you to measure the execution time of a block in a template and records the result to the log.

::ActionController::Metal - Inherited

#controller_name

Delegates to the class’s .controller_name.

#reset_session,
#url_for

Basic url_for that can be overridden for more robust functionality.

::AbstractController::Base - Inherited

#action_methods

Delegates to the class’s .action_methods.

#available_action?

Returns true if a method for the action is available and can be dispatched, false otherwise.

#controller_path

Delegates to the class’s .controller_path.

#process

Calls the action going through the entire Action Dispatch stack.

::ActiveSupport::Configurable - Included

#config

Reads and writes attributes from a configuration OrderedOptions.

Constructor Details

.newTestController

[ GitHub ]

  
# File 'actionview/lib/action_view/test_case.rb', line 34

def initialize
  super
  self.class.controller_path = ""
  @request = ActionController::TestRequest.create(self.class)
  @response = ActionDispatch::TestResponse.new

  @request.env.delete("PATH_INFO")
  @params = ActionController::Parameters.new
end

Class Attribute Details

.controller_path (rw)

[ GitHub ]

  
# File 'actionview/lib/action_view/test_case.rb', line 23

attr_accessor :controller_path

Class Method Details

.controller_name

[ GitHub ]

  
# File 'actionview/lib/action_view/test_case.rb', line 30

def self.controller_name
  "test"
end

Instance Attribute Details

#controller_path=(path) (writeonly)

[ GitHub ]

  
# File 'actionview/lib/action_view/test_case.rb', line 26

def controller_path=(path)
  self.class.controller_path = path
end

#params (rw)

[ GitHub ]

  
# File 'actionview/lib/action_view/test_case.rb', line 19

attr_accessor :request, :response, :params

#request (rw)

[ GitHub ]

  
# File 'actionview/lib/action_view/test_case.rb', line 19

attr_accessor :request, :response, :params

#response (rw)

[ GitHub ]

  
# File 'actionview/lib/action_view/test_case.rb', line 19

attr_accessor :request, :response, :params