1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #4147 from lest/remove-app-fallback

remove Rails application fallback from AD::IntegrationTest
This commit is contained in:
José Valim 2011-12-24 00:02:05 -08:00
commit 34bbf8428c
4 changed files with 16 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -282,6 +282,11 @@ module ApplicationTests
assert_equal res, last_response.body # value should be unchanged
end
test "sets ActionDispatch.test_app" do
make_basic_app
assert_equal Rails.application, ActionDispatch.test_app
end
test "sets all Active Record models to whitelist all attributes by default" do
add_to_config <<-RUBY
config.active_record.whitelist_attributes = true