Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Kill routing timed tests

  • Loading branch information...
commit f86a4b84ddded3fe29184196e4fdd7ffaa4c27ac 1 parent c6bc8e6
@josh josh authored
Showing with 3 additions and 50 deletions.
  1. +3 −50 actionpack/test/controller/routing_test.rb
View
53 actionpack/test/controller/routing_test.rb
@@ -9,7 +9,6 @@ def index() head :ok end
def rescue_action(e) raise e end
end
-RunTimeTests = ARGV.include? 'time'
ROUTING = ActionController::Routing
class ROUTING::RouteBuilder
@@ -759,7 +758,7 @@ def setup
ActionController::Routing.use_controllers! %w(content admin/user admin/news_feed)
end
-
+
def teardown
@rs.clear!
end
@@ -815,52 +814,6 @@ def test_time_recognition
map.resources :pages
map.connect ':controller/:action/:id'
}
- n = 1000
- if RunTimeTests
- GC.start
- rectime = Benchmark.realtime do
- n.times do
- rs.recognize_path("/videos/1234567", {:method => :get})
- rs.recognize_path("/videos/1234567/abuse", {:method => :get})
- rs.recognize_path("/users/1234567/settings", {:method => :get})
- rs.recognize_path("/channels/1234567", {:method => :get})
- rs.recognize_path("/session/new", {:method => :get})
- rs.recognize_path("/admin/user/show/10", {:method => :get})
- end
- end
- puts "\n\nRecognition (#{rs.routes.size} routes):"
- per_url = rectime / (n * 6)
- puts "#{per_url * 1000} ms/url"
- puts "#{1 / per_url} url/s\n\n"
- end
- end
-
- 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
def test_route_with_colon_first
@@ -2567,10 +2520,10 @@ def test_load_with_configuration
routes.reload
end
-
+
def test_load_multiple_configurations
routes.add_configuration_file("engines.rb")
-
+
File.expects(:stat).at_least_once.returns(@stat)
routes.expects(:load).with('./config/routes.rb')
Please sign in to comment.
Something went wrong with that request. Please try again.