The example in the guide does the testing in a functional test, where the routing system is already loaded. I'd recommend that you do the same.
--Matt Jones On Sep 15, 7:23 am, icke <[email protected]> wrote: > Hi, > > I am trying to pull together a unit testing for routes but I am > getting confused. I have read AWDWR section 21.4 which explains how > to code the assertions. > http://guides.rubyonrails.org/testing.html#testing-routes > also basically says the same. The problem I have is working out what > else I need in my test/unit/test_routing.rb. > > require File.dirname(__FILE__) + '/../test_helper' > > def test_recognizes > ActionController::Routing.use_controllers! ["quote"] > load "config/routes.rb" > test "internal routing" do > assert_recognizes({"controller" => "quote" , "action" => > "index" }, "/quote" ) > assert_recognizes({"controller" => "quote" , "action" => > "new" }, "/" ) > end > end > > def test_routing > true > end > > The output is the following: > > $ ruby -I development test/unit/routing_test.rb > Loaded suite test/unit/routing_test > Started > > Finished in 0.000182 seconds. > > 0 tests, 0 assertions, 0 failures, 0 errors > > Agreed it is super fast, but there appears to be no testing going on. > It's early days on my testing on Rails so I am sure I am missing > something major here. Thanks for any pointers in the right direction. > > O. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

