Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

There is no need to open AC::Base three times to setup tests.

  • Loading branch information...
commit ff3f55ee583743abf03a75d221216614e7ccd5e8 1 parent f405df6
@carlosantoniodasilva carlosantoniodasilva authored josevalim committed
Showing with 20 additions and 27 deletions.
  1. +20 −27 actionpack/test/abstract_unit.rb
View
47 actionpack/test/abstract_unit.rb
@@ -274,33 +274,20 @@ def assert_header(name, value)
end
end
-class ActionController::Base
- def self.test_routes(&block)
- routes = ActionDispatch::Routing::RouteSet.new
- routes.draw(&block)
- include routes.url_helpers
- end
-end
-
-class ::ApplicationController < ActionController::Base
-end
-
-module ActionView
- class TestCase
- # Must repeat the setup because AV::TestCase is a duplication
- # of AC::TestCase
- setup do
- @routes = SharedTestRoutes
- end
- end
-end
-
module ActionController
class Base
include ActionController::Testing
- end
+ # This stub emulates the Railtie including the URL helpers from a Rails application
+ include SharedTestRoutes.url_helpers
- Base.view_paths = FIXTURE_LOAD_PATH
+ self.view_paths = FIXTURE_LOAD_PATH
+
+ def self.test_routes(&block)
+ routes = ActionDispatch::Routing::RouteSet.new
+ routes.draw(&block)
+ include routes.url_helpers
+ end
+ end
class TestCase
include ActionDispatch::TestProcess
@@ -311,9 +298,15 @@ class TestCase
end
end
-# This stub emulates the Railtie including the URL helpers from a Rails application
-module ActionController
- class Base
- include SharedTestRoutes.url_helpers
+class ::ApplicationController < ActionController::Base
+end
+
+module ActionView
+ class TestCase
+ # Must repeat the setup because AV::TestCase is a duplication
+ # of AC::TestCase
+ setup do
+ @routes = SharedTestRoutes
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.