mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Rails.application#env_config is now public API. [Closes #1924]
This commit is contained in:
@@ -106,6 +106,15 @@ module Rails
|
||||
self
|
||||
end
|
||||
|
||||
# Rails.application.env_config stores some of the Rails initial environment parameters.
|
||||
# Currently stores:
|
||||
#
|
||||
# * action_dispatch.parameter_filter" => config.filter_parameters,
|
||||
# * action_dispatch.secret_token" => config.secret_token,
|
||||
# * action_dispatch.show_exceptions" => config.action_dispatch.show_exceptions
|
||||
#
|
||||
# These parameters will be used by middlewares and engines to configure themselves.
|
||||
#
|
||||
def env_config
|
||||
@env_config ||= super.merge({
|
||||
"action_dispatch.parameter_filter" => config.filter_parameters,
|
||||
|
||||
@@ -516,5 +516,14 @@ module ApplicationTests
|
||||
get "/", { :format => :xml }, "HTTP_ACCEPT" => "application/xml"
|
||||
assert_equal 'XML', last_response.body
|
||||
end
|
||||
|
||||
test "Rails.application#env_config exists and include some existing parameters" do
|
||||
make_basic_app
|
||||
|
||||
assert_respond_to app, :env_config
|
||||
assert_equal app.env_config['action_dispatch.parameter_filter'], app.config.filter_parameters
|
||||
assert_equal app.env_config['action_dispatch.secret_token'], app.config.secret_token
|
||||
assert_equal app.env_config['action_dispatch.show_exceptions'], app.config.action_dispatch.show_exceptions
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user