aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-09-26 21:38:48 -0500
committerJoshua Peek <josh@joshpeek.com>2009-09-26 21:38:48 -0500
commit14866fa3d83676d340d94464f50e2e0ea989c3c1 (patch)
treed44a15b1b57fbba70a218221bbdbc6694e4f94eb /actionpack/lib
parentb0506b086fa1b59b072aaf7de99f01846fce10a4 (diff)
downloadrails-14866fa3d83676d340d94464f50e2e0ea989c3c1.tar.gz
rails-14866fa3d83676d340d94464f50e2e0ea989c3c1.tar.bz2
rails-14866fa3d83676d340d94464f50e2e0ea989c3c1.zip
Allow setting a default application for all integration tests
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