Methods
S
T
Attributes
[R] rs
Instance Public methods
setup()
# File rails/actionpack/test/controller/routing_test.rb, line 19
def setup
  @rs = ::ActionController::Routing::RouteSet.new
  @rs.draw {|m| m.connect ':controller/:action/:id' }
  ActionController::Routing.use_controllers! %w(content admin/user admin/news_feed)
end
setup_for_named_route()
# File rails/actionpack/test/controller/routing_test.rb, line 168
def setup_for_named_route
  x = Class.new
  x.send(:define_method, :url_for) {|x| x}
  rs.named_routes.install(x)
  x
end
setup_request_method_routes_for(method)
# File rails/actionpack/test/controller/routing_test.rb, line 462
def setup_request_method_routes_for(method)
  @request = ActionController::TestRequest.new
  @request.env["REQUEST_METHOD"] = method
  @request.request_uri = "/match"

  rs.draw do |r|
    r.connect '/match', :controller => 'books', :action => 'get', :conditions => { :method => :get }
    r.connect '/match', :controller => 'books', :action => 'post', :conditions => { :method => :post }
    r.connect '/match', :controller => 'books', :action => 'put', :conditions => { :method => :put }
    r.connect '/match', :controller => 'books', :action => 'delete', :conditions => { :method => :delete }
  end
end
test_action_expiry()
# File rails/actionpack/test/controller/routing_test.rb, line 333
def test_action_expiry
  assert_equal '/content', rs.generate({:controller => 'content'}, {:controller => 'content', :action => 'show'})
end
test_backwards()
# File rails/actionpack/test/controller/routing_test.rb, line 289
def test_backwards
  rs.draw do |map|
    map.connect 'page/:id/:action', :controller => 'pages', :action => 'show'
    map.connect ':controller/:action/:id'
  end

  assert_equal '/page/20', rs.generate({:id => 20}, {:controller => 'pages', :action => 'show'})
  assert_equal '/page/20', rs.generate(:controller => 'pages', :id => 20, :action => 'show')
  assert_equal '/pages/boo', rs.generate(:controller => 'pages', :action => 'boo')
end
test_basic_named_route()
# File rails/actionpack/test/controller/routing_test.rb, line 137
def test_basic_named_route
  rs.add_named_route :home, '', :controller => 'content', :action => 'list' 
  x = setup_for_named_route.new
  assert_equal({:controller => 'content', :action => 'list', :use_route => :home, :only_path => false},
               x.send(:home_url))
end
test_both_requirement_and_optional()
# File rails/actionpack/test/controller/routing_test.rb, line 359
def test_both_requirement_and_optional
  rs.draw do |map|
    map.blog('test/:year', :controller => 'post', :action => 'show',
      :defaults => { :year => nil },
      :requirements => { :year => %r\d{4}/ }
    )
    map.connect ':controller/:action/:id'
  end

  assert_equal '/test', rs.generate(:controller => 'post', :action => 'show')
  assert_equal '/test', rs.generate(:controller => 'post', :action => 'show', :year => nil)
  
  x = setup_for_named_route.new
  assert_equal({:controller => 'post', :action => 'show', :use_route => :blog, :only_path => false},
               x.send(:blog_url))
end
test_changing_controller()
# File rails/actionpack/test/controller/routing_test.rb, line 198
def test_changing_controller
  assert_equal '/admin/stuff/show/10', rs.generate(
    {:controller => 'stuff', :action => 'show', :id => 10},
    {:controller => 'admin/user', :action => 'index'}
  )
end
test_default_setup()
# File rails/actionpack/test/controller/routing_test.rb, line 25
def test_default_setup
  assert_equal({:controller => "content", :action => 'index'}, rs.recognize_path("/content"))
  assert_equal({:controller => "content", :action => 'list'}, rs.recognize_path("/content/list"))
  assert_equal({:controller => "content", :action => 'show', :id => '10'}, rs.recognize_path("/content/show/10"))
  
  assert_equal({:controller => "admin/user", :action => 'show', :id => '10'}, rs.recognize_path("/admin/user/show/10"))
  
  assert_equal '/admin/user/show/10', rs.generate(:controller => 'admin/user', :action => 'show', :id => 10)
  
  assert_equal '/admin/user/show', rs.generate({:action => 'show'}, {:controller => 'admin/user', :action => 'list', :id => '10'})
  assert_equal '/admin/user/list/10', rs.generate({}, {:controller => 'admin/user', :action => 'list', :id => '10'})

  assert_equal '/admin/stuff', rs.generate({:controller => 'stuff'}, {:controller => 'admin/user', :action => 'list', :id => '10'})
  assert_equal '/stuff', rs.generate({:controller => '/stuff'}, {:controller => 'admin/user', :action => 'list', :id => '10'})
end
test_dynamic_path_allowed()
# File rails/actionpack/test/controller/routing_test.rb, line 272
def test_dynamic_path_allowed
  rs.draw do |map|
    map.connect '*path', :controller => 'content', :action => 'show_file'
  end

  assert_equal '/pages/boo', rs.generate(:controller => 'content', :action => 'show_file', :path => %w(pages boo))
end
test_dynamic_recall_paths_allowed()
# File rails/actionpack/test/controller/routing_test.rb, line 280
def test_dynamic_recall_paths_allowed
  rs.draw do |map|
    map.connect '*path', :controller => 'content', :action => 'show_file'
  end
  
  recall_path = ActionController::Routing::PathSegment::Result.new(%w(pages boo))
  assert_equal '/pages/boo', rs.generate({}, :controller => 'content', :action => 'show_file', :path => recall_path)
end
test_ignores_leading_slash()
# File rails/actionpack/test/controller/routing_test.rb, line 41
def test_ignores_leading_slash
  @rs.draw {|m| m.connect '/:controller/:action/:id'}
  test_default_setup
end
test_named_route_method()
# File rails/actionpack/test/controller/routing_test.rb, line 435
def test_named_route_method
  rs.draw do |map|
    map.categories 'categories', :controller => 'content', :action => 'categories'
    map.connect ':controller/:action/:id'
  end

  assert_equal '/categories', rs.generate(:controller => 'content', :action => 'categories')
  assert_equal '/content/hi', rs.generate({:controller => 'content', :action => 'hi'})
end
test_named_route_with_default()
# File rails/actionpack/test/controller/routing_test.rb, line 151
def test_named_route_with_default
  rs.add_named_route :page, 'page/:title', :controller => 'content', :action => 'show_page', :title => 'AboutPage'
  x = setup_for_named_route.new
  assert_equal({:controller => 'content', :action => 'show_page', :title => 'AboutPage', :use_route => :page, :only_path => false},
               x.send(:page_url))
  assert_equal({:controller => 'content', :action => 'show_page', :title => 'AboutRails', :use_route => :page, :only_path => false},
               x.send(:page_url, :title => "AboutRails"))

end
test_named_route_with_nested_controller()
# File rails/actionpack/test/controller/routing_test.rb, line 161
def test_named_route_with_nested_controller
  rs.add_named_route :users, 'admin/user', :controller => '/admin/user', :action => 'index'
  x = setup_for_named_route.new
  assert_equal({:controller => '/admin/user', :action => 'index', :use_route => :users, :only_path => false},
               x.send(:users_url))
end
test_named_route_with_option()
# File rails/actionpack/test/controller/routing_test.rb, line 144
def test_named_route_with_option
  rs.add_named_route :page, 'page/:title', :controller => 'content', :action => 'show_page'
  x = setup_for_named_route.new
  assert_equal({:controller => 'content', :action => 'show_page', :title => 'new stuff', :use_route => :page, :only_path => false},
               x.send(:page_url, :title => 'new stuff'))
end
test_named_route_with_regexps()
# File rails/actionpack/test/controller/routing_test.rb, line 181
def test_named_route_with_regexps
  rs.draw do |map|
    map.article 'page/:year/:month/:day/:title', :controller => 'page', :action => 'show',
      :year => %r\d+/, :month => %r\d+/, :day => %r\d+/
    map.connect ':controller/:action/:id'
  end
  x = setup_for_named_route.new
  assert_equal(
    {:controller => 'page', :action => 'show', :title => 'hi', :use_route => :article, :only_path => false},
    x.send(:article_url, :title => 'hi')
  )
  assert_equal(
    {:controller => 'page', :action => 'show', :title => 'hi', :day => 10, :year => 2005, :month => 6, :use_route => :article, :only_path => false},
    x.send(:article_url, :title => 'hi', :day => 10, :year => 2005, :month => 6)
  )
end
test_named_route_without_hash()
# File rails/actionpack/test/controller/routing_test.rb, line 175
def test_named_route_without_hash
  rs.draw do |map|
    map.normal ':controller/:action/:id'
  end
end
test_named_routes_array()
# File rails/actionpack/test/controller/routing_test.rb, line 445
def test_named_routes_array
  test_named_route_method
  assert_equal [:categories], rs.named_routes.names
end
test_named_url_with_no_action_specified()
# File rails/actionpack/test/controller/routing_test.rb, line 409
def test_named_url_with_no_action_specified
  rs.draw do |map|
    map.home '', :controller => 'content'
    map.connect ':controller/:action/:id'
  end
  
  assert_equal '/', rs.generate(:controller => 'content', :action => 'index')
  assert_equal '/', rs.generate(:controller => 'content')
  
  x = setup_for_named_route.new
  assert_equal({:controller => 'content', :action => 'index', :use_route => :home, :only_path => false},
               x.send(:home_url))
end
test_nil_defaults()
# File rails/actionpack/test/controller/routing_test.rb, line 450
def test_nil_defaults
  rs.draw do |map|
    map.connect 'journal',
      :controller => 'content',
      :action => 'list_journal',
      :date => nil, :user_id => nil
    map.connect ':controller/:action/:id'
  end

  assert_equal '/journal', rs.generate(:controller => 'content', :action => 'list_journal', :date => nil, :user_id => nil)
end
test_non_controllers_cannot_be_matched()
# File rails/actionpack/test/controller/routing_test.rb, line 219
def test_non_controllers_cannot_be_matched
  rs.draw do |map|
    map.connect ':controller/:action/:id'
  end
  assert_raises(ActionController::RoutingError) { rs.recognize_path("/not_a/show/10") }
end
test_paths_do_not_accept_defaults()
# File rails/actionpack/test/controller/routing_test.rb, line 226
def test_paths_do_not_accept_defaults
  assert_raises(ActionController::RoutingError) do
    rs.draw do |map|
      map.path 'file/*path', :controller => 'content', :action => 'show_file', :path => %w(fake default)
      map.connect ':controller/:action/:id'
    end
  end
  
  rs.draw do |map|
    map.path 'file/*path', :controller => 'content', :action => 'show_file', :path => []
    map.connect ':controller/:action/:id'
  end
end
test_paths_escaped()
# File rails/actionpack/test/controller/routing_test.rb, line 205
def test_paths_escaped
  rs.draw do |map|
    map.path 'file/*path', :controller => 'content', :action => 'show_file'
    map.connect ':controller/:action/:id'
  end
  results = rs.recognize_path "/file/hello+world/how+are+you%3F"
  assert results, "Recognition should have succeeded"
  assert_equal ['hello world', 'how are you?'], results[:path]

  results = rs.recognize_path "/file"
  assert results, "Recognition should have succeeded"
  assert_equal [], results[:path]
end
test_recognition_with_uppercase_controller_name()
# File rails/actionpack/test/controller/routing_test.rb, line 337
def test_recognition_with_uppercase_controller_name
  assert_equal({:controller => "content", :action => 'index'}, rs.recognize_path("/Content"))
  assert_equal({:controller => "content", :action => 'list'}, rs.recognize_path("/ConTent/list"))
  assert_equal({:controller => "content", :action => 'show', :id => '10'}, rs.recognize_path("/CONTENT/show/10"))

  # these used to work, before the routes rewrite, but support for this was pulled in the new version...
  #assert_equal({'controller' => "admin/news_feed", 'action' => 'index'}, rs.recognize_path("Admin/NewsFeed"))
  #assert_equal({'controller' => "admin/news_feed", 'action' => 'index'}, rs.recognize_path("Admin/News_Feed"))
end
test_requirement_should_prevent_optional_id()
# File rails/actionpack/test/controller/routing_test.rb, line 347
def test_requirement_should_prevent_optional_id
  rs.draw do |map|
    map.post 'post/:id', :controller=> 'post', :action=> 'show', :requirements => {:id => %r\d+/}
  end

  assert_equal '/post/10', rs.generate(:controller => 'post', :action => 'show', :id => 10)
  
  assert_raises ActionController::RoutingError do
    rs.generate(:controller => 'post', :action => 'show')
  end
end
test_route_with_colon_first()
# File rails/actionpack/test/controller/routing_test.rb, line 94
def test_route_with_colon_first
  rs.draw do |map|
    map.connect '/:controller/:action/:id', :action => 'index', :id => nil
    map.connect ':url', :controller => 'tiny_url', :action => 'translate'
  end
end
test_route_with_fixnum_default()
# File rails/actionpack/test/controller/routing_test.rb, line 300
def test_route_with_fixnum_default
  rs.draw do |map|
    map.connect 'page/:id', :controller => 'content', :action => 'show_page', :id => 1
    map.connect ':controller/:action/:id'
  end

  assert_equal '/page', rs.generate(:controller => 'content', :action => 'show_page')
  assert_equal '/page', rs.generate(:controller => 'content', :action => 'show_page', :id => 1)
  assert_equal '/page', rs.generate(:controller => 'content', :action => 'show_page', :id => '1')
  assert_equal '/page/10', rs.generate(:controller => 'content', :action => 'show_page', :id => 10)

  assert_equal({:controller => "content", :action => 'show_page', :id => '1'}, rs.recognize_path("/page"))
  assert_equal({:controller => "content", :action => 'show_page', :id => '1'}, rs.recognize_path("/page/1"))
  assert_equal({:controller => "content", :action => 'show_page', :id => '10'}, rs.recognize_path("/page/10"))
end
test_route_with_regexp_and_dot()
# File rails/actionpack/test/controller/routing_test.rb, line 113
def test_route_with_regexp_and_dot
  rs.draw do |map|
    map.connect ':controller/:action/:file',
                      :controller => %radmin|user/,
                      :action => %rupload|download/,
                      :defaults => {:file => nil},
                      :requirements => {:file => %r{[^/]+(\.[^/]+)?}}
  end
  # Without a file extension
  assert_equal '/user/download/file',
    rs.generate(:controller => "user", :action => "download", :file => "file")
  assert_equal(
    {:controller => "user", :action => "download", :file => "file"},
    rs.recognize_path("/user/download/file"))

  # Now, let's try a file with an extension, really a dot (.)
  assert_equal '/user/download/file.jpg',
    rs.generate(
      :controller => "user", :action => "download", :file => "file.jpg")
  assert_equal(
    {:controller => "user", :action => "download", :file => "file.jpg"},
    rs.recognize_path("/user/download/file.jpg"))
end
test_route_with_regexp_for_controller()
# File rails/actionpack/test/controller/routing_test.rb, line 101
def test_route_with_regexp_for_controller
  rs.draw do |map|
    map.connect ':controller/:admintoken/:action/:id', :controller => %radmin\/.+/
    map.connect ':controller/:action/:id'
  end
  assert_equal({:controller => "admin/user", :admintoken => "foo", :action => "index"},
      rs.recognize_path("/admin/user/foo"))
  assert_equal({:controller => "content", :action => "foo"}, rs.recognize_path("/content/foo"))
  assert_equal '/admin/user/foo', rs.generate(:controller => "admin/user", :admintoken => "foo", :action => "index")
  assert_equal '/content/foo', rs.generate(:controller => "content", :action => "foo")
end
test_route_with_text_default()

For newer revision

# File rails/actionpack/test/controller/routing_test.rb, line 317
def test_route_with_text_default
  rs.draw do |map|
    map.connect 'page/:id', :controller => 'content', :action => 'show_page', :id => 1
    map.connect ':controller/:action/:id'
  end

  assert_equal '/page/foo', rs.generate(:controller => 'content', :action => 'show_page', :id => 'foo')
  assert_equal({:controller => "content", :action => 'show_page', :id => 'foo'}, rs.recognize_path("/page/foo"))

  token = "\3321\2202\3320\2265\3320\2272\3321\2201\3321\2202" # 'text' in russian
  escaped_token = CGI::escape(token)

  assert_equal '/page/' + escaped_token, rs.generate(:controller => 'content', :action => 'show_page', :id => token)
  assert_equal({:controller => "content", :action => 'show_page', :id => token}, rs.recognize_path("/page/#{escaped_token}"))
end
test_set_to_nil_forgets()
# File rails/actionpack/test/controller/routing_test.rb, line 376
def test_set_to_nil_forgets
  rs.draw do |map|
    map.connect 'pages/:year/:month/:day', :controller => 'content', :action => 'list_pages', :month => nil, :day => nil
    map.connect ':controller/:action/:id'
  end
  
  assert_equal '/pages/2005',
    rs.generate(:controller => 'content', :action => 'list_pages', :year => 2005)
  assert_equal '/pages/2005/6',
    rs.generate(:controller => 'content', :action => 'list_pages', :year => 2005, :month => 6)
  assert_equal '/pages/2005/6/12',
    rs.generate(:controller => 'content', :action => 'list_pages', :year => 2005, :month => 6, :day => 12)
  
  assert_equal '/pages/2005/6/4',
    rs.generate({:day => 4}, {:controller => 'content', :action => 'list_pages', :year => '2005', :month => '6', :day => '12'})

  assert_equal '/pages/2005/6',
    rs.generate({:day => nil}, {:controller => 'content', :action => 'list_pages', :year => '2005', :month => '6', :day => '12'})

  assert_equal '/pages/2005',
    rs.generate({:day => nil, :month => nil}, {:controller => 'content', :action => 'list_pages', :year => '2005', :month => '6', :day => '12'})
end
test_should_have_better_error_message_when_options_diff_is_empty()

this specifies the case where your formerly would get a very confusing error message with an empty diff

# File rails/actionpack/test/controller/routing_test.rb, line 263
def test_should_have_better_error_message_when_options_diff_is_empty
  rs.draw do |map|
    map.content '/content/:query', :controller => 'content', :action => 'show'
  end
  exception = assert_raise(ActionController::RoutingError) { rs.generate(:controller => 'content', :action => 'show', :use_route => "content") }
  expected_message = "content_url failed to generate from #{{:action=>"show", :controller=>"content"}.inspect} - you may have ambiguous routes, or you may need to supply additional parameters for this route.  content_url has the following required parameters: [\"content\", :query] - are they all satisifed?"
  assert_equal expected_message, exception.message
end
test_should_list_options_diff_when_routing_requirements_dont_match()
# File rails/actionpack/test/controller/routing_test.rb, line 240
def test_should_list_options_diff_when_routing_requirements_dont_match
  rs.draw do |map|
    map.post 'post/:id', :controller=> 'post', :action=> 'show', :requirements => {:id => %r\d+/}
  end
  exception = assert_raise(ActionController::RoutingError) { rs.generate(:controller => 'post', :action => 'show', :bad_param => "foo", :use_route => "post") }
  assert_match %r^post_url failed to generate/, exception.message
  from_match = exception.message.match(%rfrom \{[^\}]+\}/).to_s
  assert_match %r:bad_param=>"foo"/,   from_match
  assert_match %r:action=>"show"/,     from_match
  assert_match %r:controller=>"post"/, from_match
  
  expected_match = exception.message.match(%rexpected: \{[^\}]+\}/).to_s
  assert_no_match %r:bad_param=>"foo"/,   expected_match
  assert_match    %r:action=>"show"/,     expected_match
  assert_match    %r:controller=>"post"/, expected_match

  diff_match = exception.message.match(%rdiff: \{[^\}]+\}/).to_s
  assert_match    %r:bad_param=>"foo"/,   diff_match
  assert_no_match %r:action=>"show"/,     diff_match
  assert_no_match %r:controller=>"post"/, diff_match
end
test_subpath_generated()
# File rails/actionpack/test/controller/routing_test.rb, line 519
def test_subpath_generated
  Object.const_set(:SubpathBooksController, Class.new(ActionController::Base))

  rs.draw do |r|
    r.connect '/books/:id;edit', :controller => 'subpath_books', :action => 'edit'
    r.connect '/items/:id;:action', :controller => 'subpath_books'
    r.connect '/posts/new;:action', :controller => 'subpath_books'
  end

  assert_equal "/books/7;edit", rs.generate(:controller => "subpath_books", :id => 7, :action => "edit")
  assert_equal "/items/15;complete", rs.generate(:controller => "subpath_books", :id => 15, :action => "complete")
  assert_equal "/posts/new;preview", rs.generate(:controller => "subpath_books", :action => "preview")
ensure
  Object.send(:remove_const, :SubpathBooksController) rescue nil
end
test_subpath_recognized()
# File rails/actionpack/test/controller/routing_test.rb, line 490
def test_subpath_recognized
  Object.const_set(:SubpathBooksController, Class.new(ActionController::Base))

  rs.draw do |r|
    r.connect '/books/:id;edit', :controller => 'subpath_books', :action => 'edit'
    r.connect '/items/:id;:action', :controller => 'subpath_books'
    r.connect '/posts/new;:action', :controller => 'subpath_books'
    r.connect '/posts/:id', :controller => 'subpath_books', :action => "show"
  end

  hash = rs.recognize_path "/books/17;edit"
  assert_not_nil hash
  assert_equal %w(subpath_books 17 edit), [hash[:controller], hash[:id], hash[:action]]
  
  hash = rs.recognize_path "/items/3;complete"
  assert_not_nil hash
  assert_equal %w(subpath_books 3 complete), [hash[:controller], hash[:id], hash[:action]]
  
  hash = rs.recognize_path "/posts/new;preview"
  assert_not_nil hash
  assert_equal %w(subpath_books preview), [hash[:controller], hash[:action]]

  hash = rs.recognize_path "/posts/7"
  assert_not_nil hash
  assert_equal %w(subpath_books show 7), [hash[:controller], hash[:action], hash[:id]]
ensure
  Object.send(:remove_const, :SubpathBooksController) rescue nil
end
test_time_generation()
# File rails/actionpack/test/controller/routing_test.rb, line 66
def test_time_generation
  n = 5000
  if RunTimeTests
    GC.start
    pairs = [
      [{:controller => 'content', :action => 'index'}, {:controller => 'content', :action => 'show'}],
      [{:controller => 'content'}, {:controller => 'content', :action => 'index'}],   
      [{:controller => 'content', :action => 'list'}, {:controller => 'content', :action => 'index'}],
      [{:controller => 'content', :action => 'show', :id => '10'}, {:controller => 'content', :action => 'list'}],
      [{:controller => 'admin/user', :action => 'index'}, {:controller => 'admin/user', :action => 'show'}],
      [{:controller => 'admin/user'}, {:controller => 'admin/user', :action => 'index'}],
      [{:controller => 'admin/user', :action => 'list'}, {:controller => 'admin/user', :action => 'index'}],
      [{:controller => 'admin/user', :action => 'show', :id => '10'}, {:controller => 'admin/user', :action => 'list'}],
    ]
    p = nil
    gentime = Benchmark.realtime do
      n.times do
      pairs.each {|(a, b)| rs.generate(a, b)}
      end
    end
    
    puts "\n\nGeneration (RouteSet): (#{(n * 8)} urls)"
    per_url = gentime / (n * 8)
    puts "#{per_url * 1000} ms/url"
    puts "#{1 / per_url} url/s\n\n"
  end
end
test_time_recognition()
# File rails/actionpack/test/controller/routing_test.rb, line 46
def test_time_recognition
  n = 10000
  if RunTimeTests
    GC.start
    rectime = Benchmark.realtime do
      n.times do
        rs.recognize_path("content")
        rs.recognize_path("content/list")
        rs.recognize_path("content/show/10")
        rs.recognize_path("admin/user")
        rs.recognize_path("admin/user/list")
        rs.recognize_path("admin/user/show/10")
      end
    end
    puts "\n\nRecognition (RouteSet):"
    per_url = rectime / (n * 6)
    puts "#{per_url * 1000} ms/url"
    puts "#{1 / per_url} url/s\n\n"
  end
end
test_url_generated_when_forgetting_action()
# File rails/actionpack/test/controller/routing_test.rb, line 423
def test_url_generated_when_forgetting_action
  [{:controller => 'content', :action => 'index'}, {:controller => 'content'}].each do |hash| 
    rs.draw do |map|
      map.home '', hash
      map.connect ':controller/:action/:id'
    end
    assert_equal '/', rs.generate({:action => nil}, {:controller => 'content', :action => 'hello'})
    assert_equal '/', rs.generate({:controller => 'content'})
    assert_equal '/content/hi', rs.generate({:controller => 'content', :action => 'hi'})
  end
end
test_url_with_no_action_specified()
# File rails/actionpack/test/controller/routing_test.rb, line 399
def test_url_with_no_action_specified
  rs.draw do |map|
    map.connect '', :controller => 'content'
    map.connect ':controller/:action/:id'
  end
  
  assert_equal '/', rs.generate(:controller => 'content', :action => 'index')
  assert_equal '/', rs.generate(:controller => 'content')
end