On Aug 6, 2005, at 12:59 PM, BenJamin Prater wrote:
> I''m in IRB and I want to fire a controller''s method. How
do I do it
> (no breakpoint please!)?
>
> class SiteController < ApplicationController
> def late_employee
> "your fired!"
> end
> end
>
> Show me how to fire my late_employee!
>
This was an interesting puzzle. I''m still not sure I''ve got
the best
way to do this, but here is *A* way to do it (output from irb removed):
ruby script/console
irb> require ''action_controller/test_process''
irb> require ''application''
irb> require ''site_controller''
irb> request = ActionController::TestRequest.new
irb> response = ActionController::TestResponse.new
irb> request.env[''REQUEST_METHOD''] =
''GET''
irb> request.action = "late_employee"
irb> InfoController.process(request,response)
To figure this out, I went to actionpack/lib/action_controller/
test_process.rb
Anyone else have a better way?
> Thanks!
>
> Ben
>
Good luck :)
Duane Johnson
(canadaduane)