Skip to content

Commit

Permalink
refactor the before_setup hooks to a module
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Aug 9, 2012
1 parent 0b29c7b commit 1e8c0a2
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions actionpack/test/abstract_unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ def run_setup_once

SharedTestRoutes = ActionDispatch::Routing::RouteSet.new

module ActionDispatch
module SharedRoutes
def before_setup
@routes = SharedTestRoutes
super
end
end
end

module ActiveSupport
class TestCase
include SetupOnce
Expand Down Expand Up @@ -159,10 +168,7 @@ def config
end

class ActionDispatch::IntegrationTest < ActiveSupport::TestCase
def before_setup
@routes = SharedTestRoutes
super
end
include ActionDispatch::SharedRoutes

def self.build_app(routes = nil)
RoutedRackApp.new(routes || ActionDispatch::Routing::RouteSet.new) do |middleware|
Expand Down Expand Up @@ -291,11 +297,7 @@ def self.test_routes(&block)

class TestCase
include ActionDispatch::TestProcess

def before_setup
@routes = SharedTestRoutes
super
end
include ActionDispatch::SharedRoutes
end
end

Expand All @@ -306,10 +308,7 @@ module ActionView
class TestCase
# Must repeat the setup because AV::TestCase is a duplication
# of AC::TestCase
def before_setup
@routes = SharedTestRoutes
super
end
include ActionDispatch::SharedRoutes
end
end

Expand Down

0 comments on commit 1e8c0a2

Please sign in to comment.