mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
db5f1a46f2
- `secrets.secret_token` is now used in all places `config.secret_token` was - `secrets.secret_token`, when not present in `config/secrets.yml`, now falls back to the value of `config.secret_token` - when `secrets.secret_token` is set, it over-writes `config.secret_token` so they are the same (for backwards-compatibility) - Update docs to reference app.secrets in all places - Remove references to `config.secret_token`, `config.secret_key_base` - Warn that missing secret_key_base is deprecated - Add tests for secret_token, key_generator, and message_verifier - the legacy key generator is used with the message verifier when secrets.secret_key_base is blank and secret_token is set - app.key_generator raises when neither secrets.secret_key_base nor secret_token are set - app.env_config raises when neither secrets.secret_key_base nor secret_token are set - Add changelog Run focused tests via ruby -w -Itest test/application/configuration_test.rb -n '/secret_|key_/'
46 lines
1 KiB
Ruby
46 lines
1 KiB
Ruby
require 'isolation/abstract_unit'
|
|
|
|
module ApplicationTests
|
|
class UrlGenerationTest < ActiveSupport::TestCase
|
|
include ActiveSupport::Testing::Isolation
|
|
|
|
def app
|
|
Rails.application
|
|
end
|
|
|
|
test "it works" do
|
|
boot_rails
|
|
require "rails"
|
|
require "action_controller/railtie"
|
|
require "action_view/railtie"
|
|
|
|
class MyApp < Rails::Application
|
|
secrets.secret_key_base = "3b7cd727ee24e8444053437c36cc66c4"
|
|
config.session_store :cookie_store, key: "_myapp_session"
|
|
config.active_support.deprecation = :log
|
|
config.eager_load = false
|
|
end
|
|
|
|
Rails.application.initialize!
|
|
|
|
class ::ApplicationController < ActionController::Base
|
|
end
|
|
|
|
class ::OmgController < ::ApplicationController
|
|
def index
|
|
render text: omg_path
|
|
end
|
|
end
|
|
|
|
MyApp.routes.draw do
|
|
get "/" => "omg#index", as: :omg
|
|
end
|
|
|
|
require 'rack/test'
|
|
extend Rack::Test::Methods
|
|
|
|
get "/"
|
|
assert_equal "/", last_response.body
|
|
end
|
|
end
|
|
end
|