diff options
author | Arun Agrawal <arunagw@gmail.com> | 2015-10-26 16:28:09 +0100 |
---|---|---|
committer | Arun Agrawal <arunagw@gmail.com> | 2015-10-27 10:18:05 +0100 |
commit | 4810f401c4fd63985fb194d068717853599d0ba9 (patch) | |
tree | 00a756d93822d212d2f196282f18e443a44ddeaa /railties/test | |
parent | 190c69ece3a94dbd92f84833491d1b7b1bad06ea (diff) | |
download | rails-4810f401c4fd63985fb194d068717853599d0ba9.tar.gz rails-4810f401c4fd63985fb194d068717853599d0ba9.tar.bz2 rails-4810f401c4fd63985fb194d068717853599d0ba9.zip |
raise `ArgumentError` when `SECRET_KEY_BASE` is an integer
If `SECRET_KEY_BASE` or other `secret` gets passed as other then string
we need to raise `ArgumentError` to know that it's a wrong argument.
Closes #22072
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/configuration_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index d96d8ded6b..ebcfcb1c3a 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -417,6 +417,19 @@ module ApplicationTests end end + test "raise when secrets.secret_key_base is not a type of string" do + app_file 'config/secrets.yml', <<-YAML + development: + secret_key_base: 123 + YAML + + app 'development' + + assert_raise(ArgumentError) do + app.key_generator + end + end + test "prefer secrets.secret_token over config.secret_token" do app_file 'config/initializers/secret_token.rb', <<-RUBY Rails.application.config.secret_token = "" |