aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-24 00:02:05 -0800
committerJosé Valim <jose.valim@gmail.com>2011-12-24 00:02:05 -0800
commit34bbf8428cd5d1cf2bc9c1ce222a84fe5488a34e (patch)
tree427e3261c2406776b30f467f0b1e6814a4b670d5 /actionpack
parent9bbe2b800ed87d803a18888b84ba5b73faba2680 (diff)
parent5f3b9dec0a03055824fa8187ef260e74d75a75eb (diff)
downloadrails-34bbf8428cd5d1cf2bc9c1ce222a84fe5488a34e.tar.gz
rails-34bbf8428cd5d1cf2bc9c1ce222a84fe5488a34e.tar.bz2
rails-34bbf8428cd5d1cf2bc9c1ce222a84fe5488a34e.zip
Merge pull request #4147 from lest/remove-app-fallback
remove Rails application fallback from AD::IntegrationTest
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch.rb3
-rw-r--r--actionpack/lib/action_dispatch/railtie.rb2
-rw-r--r--actionpack/lib/action_dispatch/testing/integration.rb9
3 files changed, 11 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch.rb b/actionpack/lib/action_dispatch.rb
index 4b821037dc..bcb2ac8ffc 100644
--- a/actionpack/lib/action_dispatch.rb
+++ b/actionpack/lib/action_dispatch.rb
@@ -29,6 +29,7 @@ $:.unshift(activemodel_path) if File.directory?(activemodel_path) && !$:.include
require 'active_support'
require 'active_support/dependencies/autoload'
+require 'active_support/core_ext/module/attribute_accessors'
require 'action_pack'
require 'active_model'
@@ -88,6 +89,8 @@ module ActionDispatch
autoload :CacheStore, 'action_dispatch/middleware/session/cache_store'
end
+ mattr_accessor :test_app
+
autoload_under 'testing' do
autoload :Assertions
autoload :Integration
diff --git a/actionpack/lib/action_dispatch/railtie.rb b/actionpack/lib/action_dispatch/railtie.rb
index a4f4825f92..46c06386d8 100644
--- a/actionpack/lib/action_dispatch/railtie.rb
+++ b/actionpack/lib/action_dispatch/railtie.rb
@@ -28,6 +28,8 @@ module ActionDispatch
config.action_dispatch.always_write_cookie = Rails.env.development? if config.action_dispatch.always_write_cookie.nil?
ActionDispatch::Cookies::CookieJar.always_write_cookie = config.action_dispatch.always_write_cookie
+
+ ActionDispatch.test_app = app
end
end
end
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb
index 0f1bb9f260..26db8662a8 100644
--- a/actionpack/lib/action_dispatch/testing/integration.rb
+++ b/actionpack/lib/action_dispatch/testing/integration.rb
@@ -463,9 +463,12 @@ module ActionDispatch
@@app = nil
def self.app
- # DEPRECATE Rails application fallback
- # This should be set by the initializer
- @@app || (defined?(Rails.application) && Rails.application) || nil
+ if !@@app && !ActionDispatch.test_app
+ ActiveSupport::Deprecation.warn "Rails application fallback is deprecated " \
+ "and no longer works, please set ActionDispatch.test_app", caller
+ end
+
+ @@app || ActionDispatch.test_app
end
def self.app=(app)