I've a simple method I call in my action methods. So far I've put it
in application.rb in the ActionController class.
However I can't call it from my test code. Where should I be putting
it? I've tried adding this to application.rb :
but it didn't work.
Is this possible?
adding a method to application.rb lets controllers call it because you are adding a method to ApplicationController and your controllers inherit from that.
In a test you are subclassing Test::Unit::TestCase (or more recently ActiveSupport::TestCase or some other class if you are using a different testing framework), so clearly you can't call and ApplicationController instance method. Easiest thing is probably to put the methods in a module and include it in both places.