Something else I noticed while reading Steve''s guide to testing in Rails. While testing the HomeController: class HomeController; def rescue_action(e) raise e end; end I bet people have written that line of code, or similar, many times. Is there a shortcut in Rails 0.8? In 0.9? Will it go away altogether with the new metaprogramming features? Sorry for the noise. I figure it''s better to have a bit of noise than to overlook an opportunity for slashing code. I''m very impressed with the testing capabilities and look forward to exercising them. Gavin
On Sat, Dec 11, 2004 at 03:16:38AM +1100, Gavin Sinclair wrote:> Something else I noticed while reading Steve''s guide to testing in > Rails. While testing the HomeController: > > class HomeController; def rescue_action(e) raise e end; end > > I bet people have written that line of code, or similar, many times. > Is there a shortcut in Rails 0.8? In 0.9? Will it go away altogether > with the new metaprogramming features?This is automatically generated by the controller generator. You shouldn''t have to type it out ever. -Scott
On Saturday, December 11, 2004, 3:21:46 AM, Scott wrote:> On Sat, Dec 11, 2004 at 03:16:38AM +1100, Gavin Sinclair wrote: >> Something else I noticed while reading Steve''s guide to testing in >> Rails. While testing the HomeController: >> >> class HomeController; def rescue_action(e) raise e end; end >> >> I bet people have written that line of code, or similar, many times. >> Is there a shortcut in Rails 0.8? In 0.9? Will it go away altogether >> with the new metaprogramming features?> This is automatically generated by the controller generator. You > shouldn''t have to type it out ever.The same can be said for the require ''model'' require ''helper'' duo that no longer gets generated. It''s generally nice to avoid static generated code. Not that I have a concrete suggestion in this case. It may well be worth keeping. Gavin
> It''s generally nice to avoid static generated code. Not that I have a > concrete suggestion in this case. It may well be worth keeping.I''ve been meaning to write a set of concrete subclasses for Test::Unit::TestCase for both model and controller testing. When those come around, I would probably be in a better position to slash the line. -- David Heinemeier Hansson, http://www.basecamphq.com/ -- Web-based Project Management http://www.rubyonrails.org/ -- Web-application framework for Ruby http://macromates.com/ -- TextMate: Code and markup editor (OS X) http://www.loudthinking.com/ -- Broadcasting Brain