Skip to content

Commit

Permalink
There is no need to open AC::Base three times to setup tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosantoniodasilva authored and josevalim committed Sep 25, 2010
1 parent f405df6 commit ff3f55e
Showing 1 changed file with 20 additions and 27 deletions.
47 changes: 20 additions & 27 deletions actionpack/test/abstract_unit.rb
Expand Up @@ -274,33 +274,20 @@ def assert_header(name, value)
end end
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 module ActionController
class Base class Base
include ActionController::Testing 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 class TestCase
include ActionDispatch::TestProcess include ActionDispatch::TestProcess
Expand All @@ -311,9 +298,15 @@ class TestCase
end end
end end


# This stub emulates the Railtie including the URL helpers from a Rails application class ::ApplicationController < ActionController::Base
module ActionController end
class Base
include SharedTestRoutes.url_helpers module ActionView
class TestCase
# Must repeat the setup because AV::TestCase is a duplication
# of AC::TestCase
setup do
@routes = SharedTestRoutes
end
end end
end end

0 comments on commit ff3f55e

Please sign in to comment.