1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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

This commit is contained in:
Carlos Antonio da Silva 2010-09-25 08:24:55 +08:00 committed by José Valim
parent f405df6e57
commit ff3f55ee58

View file

@ -274,11 +274,27 @@ class Rack::TestCase < ActionController::IntegrationTest
end
end
class ActionController::Base
def self.test_routes(&block)
routes = ActionDispatch::Routing::RouteSet.new
routes.draw(&block)
include routes.url_helpers
module ActionController
class Base
include ActionController::Testing
# This stub emulates the Railtie including the URL helpers from a Rails application
include SharedTestRoutes.url_helpers
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
setup do
@routes = SharedTestRoutes
end
end
end
@ -294,26 +310,3 @@ module ActionView
end
end
end
module ActionController
class Base
include ActionController::Testing
end
Base.view_paths = FIXTURE_LOAD_PATH
class TestCase
include ActionDispatch::TestProcess
setup do
@routes = SharedTestRoutes
end
end
end
# This stub emulates the Railtie including the URL helpers from a Rails application
module ActionController
class Base
include SharedTestRoutes.url_helpers
end
end