mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix all the broken tests due to the AC configuration refactor
This commit is contained in:
parent
1f0f05b10c
commit
15b3b74624
7 changed files with 24 additions and 13 deletions
|
@ -91,6 +91,9 @@ module ActionController
|
|||
deprecated_config_writer :session_store
|
||||
deprecated_config_writer :session_options
|
||||
deprecated_config_accessor :relative_url_root, "relative_url_root is ineffective. Please stop using it"
|
||||
deprecated_config_accessor :assets_dir
|
||||
deprecated_config_accessor :javascripts_dir
|
||||
deprecated_config_accessor :stylesheets_dir
|
||||
|
||||
# For old tests
|
||||
def initialize_template_class(*) end
|
||||
|
|
|
@ -3,24 +3,28 @@ module ActionController #:nodoc:
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
self.config.session_store ||= :cookie_store
|
||||
# This is still needed for the session secret for some reason.
|
||||
self.config.session_options ||= {}
|
||||
end
|
||||
|
||||
def self.session_store_for(store)
|
||||
case store
|
||||
when :active_record_store
|
||||
ActiveRecord::SessionStore
|
||||
when Symbol
|
||||
ActionDispatch::Session.const_get(store.to_s.camelize)
|
||||
else
|
||||
store
|
||||
end
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
def session_options
|
||||
config.session_options
|
||||
end
|
||||
|
||||
def session_store
|
||||
case store = config.session_store
|
||||
when :active_record_store
|
||||
ActiveRecord::SessionStore
|
||||
when Symbol
|
||||
ActionDispatch::Session.const_get(store.to_s.camelize)
|
||||
else
|
||||
store
|
||||
end
|
||||
SessionManagement.session_store_for(config.session_store)
|
||||
end
|
||||
|
||||
def session=(options = {})
|
||||
|
|
|
@ -13,6 +13,9 @@ module ActionController
|
|||
|
||||
log_subscriber ActionController::Railties::LogSubscriber.new
|
||||
|
||||
config.action_controller.session_store = :cookie_store
|
||||
config.action_controller.session_options = {}
|
||||
|
||||
initializer "action_controller.logger" do
|
||||
ActionController::Base.logger ||= Rails.logger
|
||||
end
|
||||
|
|
|
@ -88,7 +88,7 @@ module Rails
|
|||
middleware.use('::Rack::Sendfile', lambda { action_dispatch.x_sendfile_header })
|
||||
middleware.use('::ActionDispatch::Callbacks', lambda { !cache_classes })
|
||||
middleware.use('::ActionDispatch::Cookies')
|
||||
middleware.use(lambda { action_controller.session_store }, lambda { action_controller.session_options })
|
||||
middleware.use(lambda { ActionController::SessionManagement.session_store_for(action_controller.session_store) }, lambda { action_controller.session })
|
||||
middleware.use('::ActionDispatch::Flash', :if => lambda { action_controller.session_store })
|
||||
middleware.use(lambda { metal_loader.build_middleware(metals) }, :if => lambda { metal_loader.metals.any? })
|
||||
middleware.use('ActionDispatch::ParamsParser')
|
||||
|
|
|
@ -28,7 +28,7 @@ module ApplicationTests
|
|||
end
|
||||
RUBY
|
||||
|
||||
get "/"
|
||||
get "/not/slash"
|
||||
assert_equal 200, last_response.status
|
||||
assert_equal "FooMetal", last_response.body
|
||||
end
|
||||
|
@ -50,7 +50,7 @@ module ApplicationTests
|
|||
end
|
||||
RUBY
|
||||
|
||||
get "/"
|
||||
get "/not/slash"
|
||||
assert_equal 200, last_response.status
|
||||
assert_equal "Metal B", last_response.body
|
||||
end
|
||||
|
|
|
@ -19,6 +19,7 @@ module ApplicationTests
|
|||
"Rack::Runtime",
|
||||
"Rails::Rack::Logger",
|
||||
"ActionDispatch::ShowExceptions",
|
||||
"ActionDispatch::RemoteIp",
|
||||
"Rack::Sendfile",
|
||||
"ActionDispatch::Callbacks",
|
||||
"ActionDispatch::Cookies",
|
||||
|
|
|
@ -254,7 +254,7 @@ YAML
|
|||
require 'rack/test'
|
||||
extend Rack::Test::Methods
|
||||
|
||||
get "/"
|
||||
get "/not/slash"
|
||||
assert_equal 200, last_response.status
|
||||
assert_equal "FooMetal", last_response.body
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue