Controller
processAction()
Signature
Section titled “Signature”processAction() — returns boolean
Available in: controller
Category: Miscellaneous Functions
Description
Section titled “Description”Process the specified action of the controller. This is exposed in the API primarily for testing purposes; you would not usually call it directly unless in the test suite. The optional includeFilters argument allows you to control whether before filters, after filters, or no filters at all should run when invoking the action. By default, all filters execute unless explicitly restricted.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
includeFilters | string | no | true | Set to before to only execute “before” filters, after to only execute “after” filters or false to skip all filters. This argument is generally inherited from the processRequest function during unit test execution. |
Examples
Section titled “Examples”1. Run an action with default behavior (all filters applied)
result = processAction("show");
// Executes the "show" action of the current controller with before/after filters
2. Run an action but only apply "before" filters
result = processAction("edit", includeFilters="before");
// Useful for testing preconditions without running the full action
3. Run an action but only apply "after" filters
result = processAction("update", includeFilters="after");
// Useful for testing cleanup logic that runs post-action
4. Run an action without any filters
result = processAction("delete", includeFilters=false);
// Skips before/after filters, only executes the "delete" action
5. Simulating in a test case
it("should process the show action without filters", function() {
var controller = controller("users");
var success = controller.processAction("show", includeFilters=false);
expect(success).toBeTrue();
});