Permalink
Browse files

Fix all the broken tests due to the AC configuration refactor

  • Loading branch information...
1 parent 1f0f05b commit 15b3b74624eb4c5ae383956950cab12ca9899131 Carl Lerche committed Mar 4, 2010
@@ -91,6 +91,9 @@ def #{option}=(val)
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 SessionManagement #: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 @@ class Railtie < Rails::Railtie
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 @@ def default_middleware
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 @@ def self.call(env)
end
RUBY
- get "/"
+ get "/not/slash"
assert_equal 200, last_response.status
assert_equal "FooMetal", last_response.body
end
@@ -50,7 +50,7 @@ def self.call(env)
end
RUBY
- get "/"
+ get "/not/slash"
assert_equal 200, last_response.status
assert_equal "Metal B", last_response.body
end
@@ -19,6 +19,7 @@ def setup
"Rack::Runtime",
"Rails::Rack::Logger",
"ActionDispatch::ShowExceptions",
+ "ActionDispatch::RemoteIp",
"Rack::Sendfile",
"ActionDispatch::Callbacks",
"ActionDispatch::Cookies",
@@ -254,7 +254,7 @@ def self.call(env)
require 'rack/test'
extend Rack::Test::Methods
- get "/"
+ get "/not/slash"
assert_equal 200, last_response.status
assert_equal "FooMetal", last_response.body
end

0 comments on commit 15b3b74

Please sign in to comment.