If you ever need to test an abstract base controller independently from any subclass, you’ll likely need to add a route for your test. Here’s one example of how to do this in Rails 3:
*UPDATE: * Thanks to the tip by Austin Putman I’ve updated the gist to include an example use of the excellent with_routing method.
Nice technique for longer tests. For single tests, you can also use a **with_routing** block
August 22, 2010 at 10:52 am
Thanks Austin! If I had known that it would have saved me a few hours. I’ve updated the post to show an example of how to reuse with_routing across multiple tests.
August 22, 2010 at 11:10 am
Or take a look at the controller() method in rspec-rails2…
http://pivotallabs.com/users/mgehard/blog/articles/1350-using-rspec2-to-test-rails3-applicationcontroller-functionality
August 23, 2010 at 8:16 am
Very slick – thanks!
August 23, 2010 at 11:40 am