There is an assert_routing function for integration tests. What I’ve been doing is creating a seperate routing_test integration just to test the routing. For your case:
assert_routing ‘/specialaction/4’, :controller => ‘mycontroller’, :action => ‘myaction’, :id => 4
assert_equal ‘/specialaction/4’, url_for(:only_path => true, :controller => ‘mycontroller’, :action => ‘myaction’, :id => 4)
I’m sure there’s a key to check for certain subdomains. Never done that so I would have to look it up.
I’ve learned that routing is easily the most fragile part of a rails app, and can be a PIA to debug. Make sure you’ve got integration tests for it.