Rob and Matt,
Thanks for your reply. I have now got my head around this now, and
have now traced where my routing problem is and now have an reusable
test to check I don't break things by changing routes.rb in future.
Rob, having a real-life example was what I was really looking for in
the documentation, I always find that more useful.
Here is my new 'functional' test in full as a reference for future to
just get the basic stuff going.
# test/functional/routing_test.rb
require File.dirname(__FILE__) + '/../test_helper'
class RoutingTest < ActionController::TestCase
def setup
load "config/routes.rb"
end
def test_recognizes_quote_routes
ActionController::Routing.use_controllers! ["quote"]
assert_recognizes({:controller => 'quote' , :action => 'index' },
"/quote" )
assert_recognizes({:controller => 'quote' , :action => 'new' },
"/" )
assert_recognizes({:controller => 'quote' , :action =>
'affiliate', :affiliate => 'xxxx'}, "/xxxx" )
assert_recognizes({:controller => 'quote' , :action =>
'promotion', :affiliate => 'scan', :promotion => 'promo'}, "/scan/
promo" )
end
def test_recognizes_policyholder
ActionController::Routing.use_controllers! ["policyholder"]
assert_recognizes({:controller => 'policyholder' , :action =>
'new' }, "/policyholder/new" )
assert_recognizes({:controller => 'policyholder' , :action =>
'edit', :id => '3' }, "/policyholder/edit/3" )
end
def test_recognizes_confirmation
ActionController::Routing.use_controllers! ["confirmation"]
assert_recognizes({:controller => 'confirmation' , :action =>
'new' }, "/confirmation/new" )
end
end
-- and to run it.
$ ruby test/functional/routing_test.rb
Loaded suite test/functional/routing_test
Started
...
Finished in 0.157376 seconds.
3 tests, 7 assertions, 0 failures, 0 errors
Thanks again.
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
-~----------~----~----~----~------~----~------~--~---