When I load script/console
, sometimes I want to play with the output of a controller or a view helper method.
Are there ways to:
- simulate a request?
- call methods from a controller instance on said request?
- test helper methods, either via said controller instance or another way?
Best Answer
To call helpers, use the
helper
object:If you want to use a helper that's not included by default (say, because you removed
helper :all
fromApplicationController
), just include the helper.As for dealing with controllers, I quote Nick's answer: