aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/testing/integration.rb22
1 files changed, 20 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb
index 4c0d4455f9..f5dcea9158 100644
--- a/actionpack/lib/action_dispatch/testing/integration.rb
+++ b/actionpack/lib/action_dispatch/testing/integration.rb
@@ -325,6 +325,10 @@ module ActionDispatch
end
module Runner
+ def app
+ @app
+ end
+
# Reset the current session. This is useful for testing multiple sessions
# in a single test case.
def reset!
@@ -354,8 +358,7 @@ module ActionDispatch
# can use this method to open multiple sessions that ought to be tested
# simultaneously.
def open_session(app = nil)
- app ||= @app ||= ActionController::Dispatcher.new
- session = Integration::Session.new(app)
+ session = Integration::Session.new(app || self.app)
# delegate the fixture accessors back to the test instance
extras = Module.new { attr_accessor :delegate, :test_result }
@@ -477,5 +480,20 @@ module ActionDispatch
# end
class IntegrationTest < ActiveSupport::TestCase
include Integration::Runner
+
+ @@app = nil
+
+ def self.app
+ # DEPRECATE AC::Dispatcher fallback
+ @@app || ActionController::Dispatcher.new
+ end
+
+ def self.app=(app)
+ @@app = app
+ end
+
+ def app
+ super || self.class.app
+ end
end
end