aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorEugene Kenny <elkenny@gmail.com>2017-12-22 22:13:19 +0000
committerEugene Kenny <elkenny@gmail.com>2018-01-07 20:13:58 +0000
commitd2113777a137bb6740d576cd75061782703f075b (patch)
tree87febcc0e62e623d3f23dec38f897a466a1caa6f /railties
parent1ba8412607ae7190dc1c59718099e2f04372905d (diff)
downloadrails-d2113777a137bb6740d576cd75061782703f075b.tar.gz
rails-d2113777a137bb6740d576cd75061782703f075b.tar.bz2
rails-d2113777a137bb6740d576cd75061782703f075b.zip
Allow use_authenticated_message_encryption to be set in new_framework_defaults_5_2.rb
Enabling this option in new_framework_defaults_5_2.rb didn't work before, as railtie initializers run before application initializers. Using `respond_to?` to decide whether to set the option wasn't working either, as `ActiveSupport::OrderedOptions` responds to any message.
Diffstat (limited to 'railties')
-rw-r--r--railties/test/application/configuration_test.rb30
1 files changed, 27 insertions, 3 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index 907eb4fa58..437b1ded72 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -1739,9 +1739,7 @@ module ApplicationTests
test "default SQLite3Adapter.represent_boolean_as_integer for 5.1 is false" do
remove_from_config '.*config\.load_defaults.*\n'
- add_to_top_of_config <<-RUBY
- config.load_defaults 5.1
- RUBY
+
app_file "app/models/post.rb", <<-RUBY
class Post < ActiveRecord::Base
end
@@ -1890,6 +1888,32 @@ module ApplicationTests
assert_equal "https://example.org/", last_response.location
end
+ test "ActiveSupport::MessageEncryptor.use_authenticated_message_encryption is true by default for new apps" do
+ app "development"
+
+ assert_equal true, ActiveSupport::MessageEncryptor.use_authenticated_message_encryption
+ end
+
+ test "ActiveSupport::MessageEncryptor.use_authenticated_message_encryption is false by default for upgraded apps" do
+ remove_from_config '.*config\.load_defaults.*\n'
+
+ app "development"
+
+ assert_equal false, ActiveSupport::MessageEncryptor.use_authenticated_message_encryption
+ end
+
+ test "ActiveSupport::MessageEncryptor.use_authenticated_message_encryption can be configured via config.active_support.use_authenticated_message_encryption" do
+ remove_from_config '.*config\.load_defaults.*\n'
+
+ app_file "config/initializers/new_framework_defaults_5_2.rb", <<-RUBY
+ Rails.application.config.active_support.use_authenticated_message_encryption = true
+ RUBY
+
+ app "development"
+
+ assert_equal true, ActiveSupport::MessageEncryptor.use_authenticated_message_encryption
+ end
+
test "config.active_support.hash_digest_class is Digest::MD5 by default" do
app "development"