<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -105,6 +105,26 @@ class ActionController::IntegrationTest &lt; ActiveSupport::TestCase
 
   self.app = build_app
 
+  class StubDispatcher
+    def self.new(*args)
+      lambda { |env|
+        params = env['action_dispatch.request.path_parameters']
+        controller, action = params[:controller], params[:action]
+        [200, {'Content-Type' =&gt; 'text/html'}, [&quot;#{controller}##{action}&quot;]]
+      }
+    end
+  end
+
+  def self.stub_controllers
+    old_dispatcher = ActionDispatch::Routing::RouteSet::Dispatcher
+    ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher }
+    ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, StubDispatcher }
+    yield ActionDispatch::Routing::RouteSet.new
+  ensure
+    ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher }
+    ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, old_dispatcher }
+  end
+
   def with_routing(&amp;block)
     real_routes = ActionController::Routing::Routes
     ActionController::Routing.module_eval { remove_const :Routes }</diff>
      <filename>actionpack/test/abstract_unit.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,112 +12,99 @@ class TestRoutingMapper &lt; ActionDispatch::IntegrationTest
     end
   end
 
-  class Dispatcher
-    def self.new(*args)
-      lambda { |env|
-        params = env['action_dispatch.request.path_parameters']
-        controller, action = params[:controller], params[:action]
-        [200, {'Content-Type' =&gt; 'text/html'}, [&quot;#{controller}##{action}&quot;]]
-      }
-    end
-  end
-
-  old_dispatcher = ActionDispatch::Routing::RouteSet::Dispatcher
-  ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher }
-  ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, Dispatcher }
-  Routes = ActionDispatch::Routing::RouteSet.new
-  Routes.draw do |map|
-    controller :sessions do
-      get  'login', :to =&gt; :new, :as =&gt; :login
-      post 'login', :to =&gt; :create
-
-      delete 'logout', :to =&gt; :destroy, :as =&gt; :logout
-    end
-
-    match 'account/login', :to =&gt; redirect(&quot;/login&quot;)
-
-    match 'openid/login', :via =&gt; [:get, :post], :to =&gt; &quot;openid#login&quot;
-
-    controller(:global) do
-      match 'global/:action'
-      match 'global/export',      :to =&gt; :export, :as =&gt; :export_request
-      match 'global/hide_notice', :to =&gt; :hide_notice, :as =&gt; :hide_notice
-      match '/export/:id/:file',  :to =&gt; :export, :as =&gt; :export_download, :constraints =&gt; { :file =&gt; /.*/ }
-    end
-
-    constraints(:ip =&gt; /192\.168\.1\.\d\d\d/) do
-      get 'admin', :to =&gt; &quot;queenbee#index&quot;
-    end
+  stub_controllers do |routes|
+    Routes = routes
+    Routes.draw do |map|
+      controller :sessions do
+        get  'login', :to =&gt; :new, :as =&gt; :login
+        post 'login', :to =&gt; :create
+
+        delete 'logout', :to =&gt; :destroy, :as =&gt; :logout
+      end
 
-    constraints IpRestrictor do
-      get 'admin/accounts', :to =&gt; &quot;queenbee#accounts&quot;
-    end
+      match 'account/login', :to =&gt; redirect(&quot;/login&quot;)
 
-    resources :projects, :controller =&gt; :project do
-      resources :involvements, :attachments
+      match 'openid/login', :via =&gt; [:get, :post], :to =&gt; &quot;openid#login&quot;
 
-      resources :participants do
-        put :update_all, :on =&gt; :collection
+      controller(:global) do
+        match 'global/:action'
+        match 'global/export',      :to =&gt; :export, :as =&gt; :export_request
+        match 'global/hide_notice', :to =&gt; :hide_notice, :as =&gt; :hide_notice
+        match '/export/:id/:file',  :to =&gt; :export, :as =&gt; :export_download, :constraints =&gt; { :file =&gt; /.*/ }
       end
 
-      resources :companies do
-        resources :people
-        resource  :avatar
+      constraints(:ip =&gt; /192\.168\.1\.\d\d\d/) do
+        get 'admin', :to =&gt; &quot;queenbee#index&quot;
       end
 
-      resources :images do
-        post :revise, :on =&gt; :member
+      constraints IpRestrictor do
+        get 'admin/accounts', :to =&gt; &quot;queenbee#accounts&quot;
       end
 
-      resources :people do
-        namespace &quot;:access_token&quot; do
-          resource :avatar
+      resources :projects, :controller =&gt; :project do
+        resources :involvements, :attachments
+
+        resources :participants do
+          put :update_all, :on =&gt; :collection
         end
 
-        member do
-          put  :accessible_projects
-          post :resend, :generate_new_password
+        resources :companies do
+          resources :people
+          resource  :avatar
+        end
+
+        resources :images do
+          post :revise, :on =&gt; :member
+        end
+
+        resources :people do
+          namespace &quot;:access_token&quot; do
+            resource :avatar
+          end
+
+          member do
+            put  :accessible_projects
+            post :resend, :generate_new_password
+          end
         end
-      end
 
-      resources :posts do
-        get  :archive, :toggle_view, :on =&gt; :collection
-        post :preview, :on =&gt; :member
+        resources :posts do
+          get  :archive, :toggle_view, :on =&gt; :collection
+          post :preview, :on =&gt; :member
 
-        resource :subscription
+          resource :subscription
 
-        resources :comments do
-          post :preview, :on =&gt; :collection
+          resources :comments do
+            post :preview, :on =&gt; :collection
+          end
         end
       end
-    end
 
-    match 'sprockets.js', :to =&gt; SprocketsApp
+      match 'sprockets.js', :to =&gt; SprocketsApp
 
-    match 'people/:id/update', :to =&gt; 'people#update', :as =&gt; :update_person
-    match '/projects/:project_id/people/:id/update', :to =&gt; 'people#update', :as =&gt; :update_project_person
+      match 'people/:id/update', :to =&gt; 'people#update', :as =&gt; :update_person
+      match '/projects/:project_id/people/:id/update', :to =&gt; 'people#update', :as =&gt; :update_project_person
 
-    # misc
-    match 'articles/:year/:month/:day/:title', :to =&gt; &quot;articles#show&quot;, :as =&gt; :article
+      # misc
+      match 'articles/:year/:month/:day/:title', :to =&gt; &quot;articles#show&quot;, :as =&gt; :article
 
-    namespace :account do
-      resource :subscription, :credit, :credit_card
-    end
+      namespace :account do
+        resource :subscription, :credit, :credit_card
+      end
 
-    controller :articles do
-      scope 'articles' do
-        scope ':title', :title =&gt; /[a-z]+/, :as =&gt; :with_title do
-          match ':id', :to =&gt; :with_id
+      controller :articles do
+        scope 'articles' do
+          scope ':title', :title =&gt; /[a-z]+/, :as =&gt; :with_title do
+            match ':id', :to =&gt; :with_id
+          end
         end
       end
-    end
 
-    scope ':access_token', :constraints =&gt; { :access_token =&gt; /\w{5,5}/ } do
-      resources :rooms
+      scope ':access_token', :constraints =&gt; { :access_token =&gt; /\w{5,5}/ } do
+        resources :rooms
+      end
     end
   end
-  ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher }
-  ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, old_dispatcher }
 
   def app
     Routes</diff>
      <filename>actionpack/test/dispatch/routing_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e296ea056e87027933c7d37e1e8c1f6ef73bc447</id>
    </parent>
  </parents>
  <author>
    <name>Joshua Peek</name>
    <email>josh@joshpeek.com</email>
  </author>
  <url>http://github.com/samgranieri/rails/commit/43e0bc1c9f39ebf5b253b498b38101a4aba04a45</url>
  <id>43e0bc1c9f39ebf5b253b498b38101a4aba04a45</id>
  <committed-date>2009-10-27T19:02:20-07:00</committed-date>
  <authored-date>2009-10-27T17:48:35-07:00</authored-date>
  <message>Extract routing controller stub helper into abstract unit</message>
  <tree>0ff738bb4028d5b0e83bb4be428a4cab3c905781</tree>
  <committer>
    <name>Joshua Peek</name>
    <email>josh@joshpeek.com</email>
  </committer>
</commit>
