diff --git a/actiontext/test/unit/model_encryption_test.rb b/actiontext/test/unit/model_encryption_test.rb index 4f753ef943..d3218f4d54 100644 --- a/actiontext/test/unit/model_encryption_test.rb +++ b/actiontext/test/unit/model_encryption_test.rb @@ -46,4 +46,3 @@ class ActionText::ModelEncryptionTest < ActiveSupport::TestCase assert_equal expected_value, model.reload.send(attribute_name).body.to_html end end - diff --git a/activerecord/lib/active_record/encryption.rb b/activerecord/lib/active_record/encryption.rb index 423f31a24b..3cfd94562c 100644 --- a/activerecord/lib/active_record/encryption.rb +++ b/activerecord/lib/active_record/encryption.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "active_support/core_ext/module" require "active_support/core_ext/array" diff --git a/activerecord/lib/active_record/encryption/cipher.rb b/activerecord/lib/active_record/encryption/cipher.rb index b8ccd900a1..8bd2efb87f 100644 --- a/activerecord/lib/active_record/encryption/cipher.rb +++ b/activerecord/lib/active_record/encryption/cipher.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # The algorithm used for encrypting and decrypting +Message+ objects. diff --git a/activerecord/lib/active_record/encryption/cipher/aes256_gcm.rb b/activerecord/lib/active_record/encryption/cipher/aes256_gcm.rb index 0aff4250ef..2da677c6c3 100644 --- a/activerecord/lib/active_record/encryption/cipher/aes256_gcm.rb +++ b/activerecord/lib/active_record/encryption/cipher/aes256_gcm.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "openssl" require "base64" diff --git a/activerecord/lib/active_record/encryption/config.rb b/activerecord/lib/active_record/encryption/config.rb index 7af2f72bc8..bd2997ee31 100644 --- a/activerecord/lib/active_record/encryption/config.rb +++ b/activerecord/lib/active_record/encryption/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # Container of contfiguration options diff --git a/activerecord/lib/active_record/encryption/configurable.rb b/activerecord/lib/active_record/encryption/configurable.rb index 802802a958..9994010cd3 100644 --- a/activerecord/lib/active_record/encryption/configurable.rb +++ b/activerecord/lib/active_record/encryption/configurable.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # Configuration API for +ActiveRecord::Encryption+ diff --git a/activerecord/lib/active_record/encryption/context.rb b/activerecord/lib/active_record/encryption/context.rb index e82c20e067..f0e3a554de 100644 --- a/activerecord/lib/active_record/encryption/context.rb +++ b/activerecord/lib/active_record/encryption/context.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # An encryption context configures the different entities used to perform encryption: diff --git a/activerecord/lib/active_record/encryption/contexts.rb b/activerecord/lib/active_record/encryption/contexts.rb index f8d6368b42..e3ca491cf5 100644 --- a/activerecord/lib/active_record/encryption/contexts.rb +++ b/activerecord/lib/active_record/encryption/contexts.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # +ActiveRecord::Encryption+ uses encryption contexts to configure the different entities used to @@ -67,4 +69,4 @@ module ActiveRecord end end end -end \ No newline at end of file +end diff --git a/activerecord/lib/active_record/encryption/derived_secret_key_provider.rb b/activerecord/lib/active_record/encryption/derived_secret_key_provider.rb index 942d95ba52..6ec9e6604b 100644 --- a/activerecord/lib/active_record/encryption/derived_secret_key_provider.rb +++ b/activerecord/lib/active_record/encryption/derived_secret_key_provider.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # A +KeyProvider+ that derives keys from passwords diff --git a/activerecord/lib/active_record/encryption/encryptable_record.rb b/activerecord/lib/active_record/encryption/encryptable_record.rb index f44f177fa5..7fd996b8c0 100644 --- a/activerecord/lib/active_record/encryption/encryptable_record.rb +++ b/activerecord/lib/active_record/encryption/encryptable_record.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # This is the concern mixed in Active Record models to make them encryptable. It adds the +encrypts+ diff --git a/activerecord/lib/active_record/encryption/encrypted_attribute_type.rb b/activerecord/lib/active_record/encryption/encrypted_attribute_type.rb index 1d0178f411..799743e3d5 100644 --- a/activerecord/lib/active_record/encryption/encrypted_attribute_type.rb +++ b/activerecord/lib/active_record/encryption/encrypted_attribute_type.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # An +ActiveModel::Type+ that encrypts/decrypts strings of text @@ -107,7 +109,7 @@ module ActiveRecord end def clean_text_type - @clean_text_type ||= ActiveRecord::Encryption::EncryptedAttributeType.new(downcase: downcase, encryptor: ActiveRecord::Encryption::NullEncryptor.new ) + @clean_text_type ||= ActiveRecord::Encryption::EncryptedAttributeType.new(downcase: downcase, encryptor: ActiveRecord::Encryption::NullEncryptor.new) end end end diff --git a/activerecord/lib/active_record/encryption/encrypted_fixtures.rb b/activerecord/lib/active_record/encryption/encrypted_fixtures.rb index bcc8044468..f7f871e67a 100644 --- a/activerecord/lib/active_record/encryption/encrypted_fixtures.rb +++ b/activerecord/lib/active_record/encryption/encrypted_fixtures.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # Encrypts encryptable columns when loading fixtures automatically diff --git a/activerecord/lib/active_record/encryption/encrypting_only_encryptor.rb b/activerecord/lib/active_record/encryption/encrypting_only_encryptor.rb index 0002182341..90c0d37410 100644 --- a/activerecord/lib/active_record/encryption/encrypting_only_encryptor.rb +++ b/activerecord/lib/active_record/encryption/encrypting_only_encryptor.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # An encryptor that can encrypt data but can't decrypt it diff --git a/activerecord/lib/active_record/encryption/encryptor.rb b/activerecord/lib/active_record/encryption/encryptor.rb index 723436f916..4032ec9c07 100644 --- a/activerecord/lib/active_record/encryption/encryptor.rb +++ b/activerecord/lib/active_record/encryption/encryptor.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "openssl" require "zip" require "active_support/core_ext/numeric" diff --git a/activerecord/lib/active_record/encryption/envelope_encryption_key_provider.rb b/activerecord/lib/active_record/encryption/envelope_encryption_key_provider.rb index 2a1858aeb6..58849720cc 100644 --- a/activerecord/lib/active_record/encryption/envelope_encryption_key_provider.rb +++ b/activerecord/lib/active_record/encryption/envelope_encryption_key_provider.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # Implements a simple envelope encryption approach where: diff --git a/activerecord/lib/active_record/encryption/errors.rb b/activerecord/lib/active_record/encryption/errors.rb index ff236e4469..8bd44292f1 100644 --- a/activerecord/lib/active_record/encryption/errors.rb +++ b/activerecord/lib/active_record/encryption/errors.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption module Errors diff --git a/activerecord/lib/active_record/encryption/extended_deterministic_queries.rb b/activerecord/lib/active_record/encryption/extended_deterministic_queries.rb index 7913512183..812348943d 100644 --- a/activerecord/lib/active_record/encryption/extended_deterministic_queries.rb +++ b/activerecord/lib/active_record/encryption/extended_deterministic_queries.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Automatically expand encrypted arguments to support querying both encrypted and unencrypted data # # Active Record Encryption supports querying the db using deterministic attributes. For example: @@ -54,17 +56,17 @@ module ActiveRecord return value if check_for_additional_values && value.is_a?(Array) && value.last.is_a?(AdditionalValue) case value - when String, Array - list = Array(value) - list + list.flat_map do |each_value| - if check_for_additional_values && each_value.is_a?(AdditionalValue) - each_value - else - additional_values_for(each_value, type) - end + when String, Array + list = Array(value) + list + list.flat_map do |each_value| + if check_for_additional_values && each_value.is_a?(AdditionalValue) + each_value + else + additional_values_for(each_value, type) end - else - value + end + else + value end end diff --git a/activerecord/lib/active_record/encryption/key.rb b/activerecord/lib/active_record/encryption/key.rb index 42678db48a..d87b350d6d 100644 --- a/activerecord/lib/active_record/encryption/key.rb +++ b/activerecord/lib/active_record/encryption/key.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # A key is a container for a given +secret+ diff --git a/activerecord/lib/active_record/encryption/key_generator.rb b/activerecord/lib/active_record/encryption/key_generator.rb index e5001f3097..9fbc45548e 100644 --- a/activerecord/lib/active_record/encryption/key_generator.rb +++ b/activerecord/lib/active_record/encryption/key_generator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "securerandom" module ActiveRecord diff --git a/activerecord/lib/active_record/encryption/key_provider.rb b/activerecord/lib/active_record/encryption/key_provider.rb index be0be27b1b..56d1f9cd32 100644 --- a/activerecord/lib/active_record/encryption/key_provider.rb +++ b/activerecord/lib/active_record/encryption/key_provider.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # A +KeyProvider+ serves keys: diff --git a/activerecord/lib/active_record/encryption/mass_encryption.rb b/activerecord/lib/active_record/encryption/mass_encryption.rb index 7ee477ade6..1ddda62cc5 100644 --- a/activerecord/lib/active_record/encryption/mass_encryption.rb +++ b/activerecord/lib/active_record/encryption/mass_encryption.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # Encrypts all the models belonging to the provided list of classes diff --git a/activerecord/lib/active_record/encryption/message.rb b/activerecord/lib/active_record/encryption/message.rb index f4ca35779b..84d80c3118 100644 --- a/activerecord/lib/active_record/encryption/message.rb +++ b/activerecord/lib/active_record/encryption/message.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # A message defines the structure of the data we store in encrypted attributes. It contains: diff --git a/activerecord/lib/active_record/encryption/message_serializer.rb b/activerecord/lib/active_record/encryption/message_serializer.rb index 17fc4d8c87..a24476c374 100644 --- a/activerecord/lib/active_record/encryption/message_serializer.rb +++ b/activerecord/lib/active_record/encryption/message_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # A message serializer that serializes +Messages+ with JSON. @@ -51,9 +53,9 @@ module ActiveRecord end def headers_to_json(headers) - headers.collect do |key, value| - [key, value.is_a?(ActiveRecord::Encryption::Message) ? message_to_json(value) : encode_if_needed(value)] - end.to_h + headers.transform_values do |value| + value.is_a?(ActiveRecord::Encryption::Message) ? message_to_json(value) : encode_if_needed(value) + end end def encode_if_needed(value) @@ -75,4 +77,4 @@ module ActiveRecord end end end -end \ No newline at end of file +end diff --git a/activerecord/lib/active_record/encryption/null_encryptor.rb b/activerecord/lib/active_record/encryption/null_encryptor.rb index 0d0200963c..bc2e4e5a66 100644 --- a/activerecord/lib/active_record/encryption/null_encryptor.rb +++ b/activerecord/lib/active_record/encryption/null_encryptor.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # An encryptor that won't decrypt or encrypt. It will just return the passed diff --git a/activerecord/lib/active_record/encryption/properties.rb b/activerecord/lib/active_record/encryption/properties.rb index b7d8ca1d88..856f642b2d 100644 --- a/activerecord/lib/active_record/encryption/properties.rb +++ b/activerecord/lib/active_record/encryption/properties.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # This is a wrapper for a hash of encryption properties. It is used by diff --git a/activerecord/lib/active_record/encryption/read_only_null_encryptor.rb b/activerecord/lib/active_record/encryption/read_only_null_encryptor.rb index 4957ec4b7e..6e685b9791 100644 --- a/activerecord/lib/active_record/encryption/read_only_null_encryptor.rb +++ b/activerecord/lib/active_record/encryption/read_only_null_encryptor.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveRecord module Encryption # A +NullEncryptor+ that will raise an error when trying to encrypt data diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index fa638f18d4..bc9c1bf248 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -555,7 +555,7 @@ db_namespace = namespace :db do desc "Generate a set of keys for configuring Active Record encryption in a given environment" task :init do puts <<~MSG - Add this entry to the credentials of the target environment: + Add this entry to the credentials of the target environment:#{' '} active_record_encryption: master_key: #{SecureRandom.alphanumeric(32)} diff --git a/activerecord/test/cases/encryption/cipher/aes256_gcm_test.rb b/activerecord/test/cases/encryption/cipher/aes256_gcm_test.rb index 54e8d8f567..a8f44d914a 100644 --- a/activerecord/test/cases/encryption/cipher/aes256_gcm_test.rb +++ b/activerecord/test/cases/encryption/cipher/aes256_gcm_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" class ActiveRecord::Encryption::Aes256GcmTest < ActiveSupport::TestCase diff --git a/activerecord/test/cases/encryption/cipher_test.rb b/activerecord/test/cases/encryption/cipher_test.rb index bb031a5725..bac69e490e 100644 --- a/activerecord/test/cases/encryption/cipher_test.rb +++ b/activerecord/test/cases/encryption/cipher_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" class ActiveRecord::Encryption::CipherTest < ActiveSupport::TestCase diff --git a/activerecord/test/cases/encryption/concurrency_test.rb b/activerecord/test/cases/encryption/concurrency_test.rb index 0853bb84b7..a25520face 100644 --- a/activerecord/test/cases/encryption/concurrency_test.rb +++ b/activerecord/test/cases/encryption/concurrency_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" require "models/post" diff --git a/activerecord/test/cases/encryption/configurable_test.rb b/activerecord/test/cases/encryption/configurable_test.rb index f477856b12..c0a0316e28 100644 --- a/activerecord/test/cases/encryption/configurable_test.rb +++ b/activerecord/test/cases/encryption/configurable_test.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + require "cases/encryption/helper" require "models/book" class ActiveRecord::Encryption::ConfigurableTest < ActiveRecord::TestCase - test 'can access context properties with top level getters' do + test "can access context properties with top level getters" do assert_equal ActiveRecord::Encryption.key_provider, ActiveRecord::Encryption.context.key_provider end diff --git a/activerecord/test/cases/encryption/contexts_test.rb b/activerecord/test/cases/encryption/contexts_test.rb index 716b30c98c..de38547c4c 100644 --- a/activerecord/test/cases/encryption/contexts_test.rb +++ b/activerecord/test/cases/encryption/contexts_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" require "models/book" require "models/post" diff --git a/activerecord/test/cases/encryption/derived_secret_key_provider_test.rb b/activerecord/test/cases/encryption/derived_secret_key_provider_test.rb index 3bdd8b575d..f840d173dc 100644 --- a/activerecord/test/cases/encryption/derived_secret_key_provider_test.rb +++ b/activerecord/test/cases/encryption/derived_secret_key_provider_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" class ActiveRecord::Encryption::DerivedSecretKeyProviderTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/encryption/encryptable_record_api_test.rb b/activerecord/test/cases/encryption/encryptable_record_api_test.rb index 7813dc5594..528d55415b 100644 --- a/activerecord/test/cases/encryption/encryptable_record_api_test.rb +++ b/activerecord/test/cases/encryption/encryptable_record_api_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" require "models/author" require "models/book" diff --git a/activerecord/test/cases/encryption/encryptable_record_test.rb b/activerecord/test/cases/encryption/encryptable_record_test.rb index 9b1d6b9dc3..8be878aee8 100644 --- a/activerecord/test/cases/encryption/encryptable_record_test.rb +++ b/activerecord/test/cases/encryption/encryptable_record_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" require "models/author" require "models/book" diff --git a/activerecord/test/cases/encryption/encrypted_fixtures_test.rb b/activerecord/test/cases/encryption/encrypted_fixtures_test.rb index 51e43134b8..218d28737f 100644 --- a/activerecord/test/cases/encryption/encrypted_fixtures_test.rb +++ b/activerecord/test/cases/encryption/encrypted_fixtures_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" require "models/book" diff --git a/activerecord/test/cases/encryption/encrypting_only_encryptor_test.rb b/activerecord/test/cases/encryption/encrypting_only_encryptor_test.rb index 97e9ca57fa..68b3b0b8bb 100644 --- a/activerecord/test/cases/encryption/encrypting_only_encryptor_test.rb +++ b/activerecord/test/cases/encryption/encrypting_only_encryptor_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" class ActiveRecord::Encryption::EncryptingOnlyEncryptorTest < ActiveSupport::TestCase diff --git a/activerecord/test/cases/encryption/encryption_schemes_test.rb b/activerecord/test/cases/encryption/encryption_schemes_test.rb index ba8194a7e0..59bc8d0d9a 100644 --- a/activerecord/test/cases/encryption/encryption_schemes_test.rb +++ b/activerecord/test/cases/encryption/encryption_schemes_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" require "models/author" @@ -45,7 +47,7 @@ class ActiveRecord::Encryption::EncryptionSchemesTest < ActiveRecord::TestCase end def decrypt(encrypted_text, key_provider: nil, cipher_options: {}) - @ciphertexts_by_clear_value.each{ |clear_value, encrypted_value| return clear_value if encrypted_value == encrypted_text } + @ciphertexts_by_clear_value.each { |clear_value, encrypted_value| return clear_value if encrypted_value == encrypted_text } raise ActiveRecord::Encryption::Errors::Decryption, "Couldn't find a match for #{encrypted_text} (#{@ciphertexts_by_clear_value.inspect})" end @@ -57,7 +59,7 @@ class ActiveRecord::Encryption::EncryptionSchemesTest < ActiveRecord::TestCase class EncryptedAuthor1 < Author self.table_name = "authors" - encrypts :name, encryptor: TestEncryptor.new( "1" => "2" ) + encrypts :name, encryptor: TestEncryptor.new("1" => "2") end class EncryptedAuthor2 < Author @@ -75,6 +77,4 @@ class ActiveRecord::Encryption::EncryptionSchemesTest < ActiveRecord::TestCase end author end - - end diff --git a/activerecord/test/cases/encryption/encryptor_test.rb b/activerecord/test/cases/encryption/encryptor_test.rb index 90139119c3..fbaa9701da 100644 --- a/activerecord/test/cases/encryption/encryptor_test.rb +++ b/activerecord/test/cases/encryption/encryptor_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" class ActiveRecord::Encryption::EncryptorTest < ActiveSupport::TestCase diff --git a/activerecord/test/cases/encryption/envelope_encryption_key_provider_test.rb b/activerecord/test/cases/encryption/envelope_encryption_key_provider_test.rb index 107433d34d..fc9164c4c0 100644 --- a/activerecord/test/cases/encryption/envelope_encryption_key_provider_test.rb +++ b/activerecord/test/cases/encryption/envelope_encryption_key_provider_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" class ActiveRecord::Encryption::EnvelopeEncryptionKeyProviderTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/encryption/extended_deterministic_queries_test.rb b/activerecord/test/cases/encryption/extended_deterministic_queries_test.rb index 01587b6e9c..7904748892 100644 --- a/activerecord/test/cases/encryption/extended_deterministic_queries_test.rb +++ b/activerecord/test/cases/encryption/extended_deterministic_queries_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" require "models/book" diff --git a/activerecord/test/cases/encryption/helper.rb b/activerecord/test/cases/encryption/helper.rb index a542e84bbf..6114eb4825 100644 --- a/activerecord/test/cases/encryption/helper.rb +++ b/activerecord/test/cases/encryption/helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/helper" require "benchmark/ips" @@ -132,7 +134,7 @@ end class ActiveRecord::TestCase include ActiveRecord::Encryption::EncryptionHelpers, ActiveRecord::Encryption::PerformanceHelpers - #, PerformanceHelpers + # , PerformanceHelpers ENCRYPTION_ERROR_FLAGS = %i[ master_key store_key_references key_derivation_salt support_unencrypted_data encrypt_fixtures ] @@ -149,4 +151,4 @@ class ActiveRecord::TestCase ActiveRecord::Encryption.config.public_send("#{property}=", instance_variable_get("@_original_#{property}")) end end -end \ No newline at end of file +end diff --git a/activerecord/test/cases/encryption/key_generator_test.rb b/activerecord/test/cases/encryption/key_generator_test.rb index c6b1cf91a4..7e0077079b 100644 --- a/activerecord/test/cases/encryption/key_generator_test.rb +++ b/activerecord/test/cases/encryption/key_generator_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" class ActiveRecord::Encryption::KeyGeneratorTest < ActiveSupport::TestCase diff --git a/activerecord/test/cases/encryption/key_provider_test.rb b/activerecord/test/cases/encryption/key_provider_test.rb index c11cefe85a..2e4bede607 100644 --- a/activerecord/test/cases/encryption/key_provider_test.rb +++ b/activerecord/test/cases/encryption/key_provider_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" class ActiveRecord::Encryption::KeyProviderTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/encryption/key_test.rb b/activerecord/test/cases/encryption/key_test.rb index d37891a87d..fab004d2d0 100644 --- a/activerecord/test/cases/encryption/key_test.rb +++ b/activerecord/test/cases/encryption/key_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" class ActiveRecord::Encryption::KeyTest < ActiveSupport::TestCase diff --git a/activerecord/test/cases/encryption/mass_encryption_test.rb b/activerecord/test/cases/encryption/mass_encryption_test.rb index 4986d6ee05..14efd17fb7 100644 --- a/activerecord/test/cases/encryption/mass_encryption_test.rb +++ b/activerecord/test/cases/encryption/mass_encryption_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" require "models/author" require "models/post" diff --git a/activerecord/test/cases/encryption/message_serializer_test.rb b/activerecord/test/cases/encryption/message_serializer_test.rb index 53844a78ac..e5abb16577 100644 --- a/activerecord/test/cases/encryption/message_serializer_test.rb +++ b/activerecord/test/cases/encryption/message_serializer_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" class ActiveRecord::Encryption::MessageSerializerTest < ActiveSupport::TestCase @@ -52,4 +54,4 @@ class ActiveRecord::Encryption::MessageSerializerTest < ActiveSupport::TestCase def serialize_and_deserialize(message, with: @serializer) @serializer.load @serializer.dump(message) end -end \ No newline at end of file +end diff --git a/activerecord/test/cases/encryption/message_test.rb b/activerecord/test/cases/encryption/message_test.rb index 3d27c7eaec..db2467712a 100644 --- a/activerecord/test/cases/encryption/message_test.rb +++ b/activerecord/test/cases/encryption/message_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" class ActiveRecord::Encryption::MessageTest < ActiveSupport::TestCase diff --git a/activerecord/test/cases/encryption/null_encryptor_test.rb b/activerecord/test/cases/encryption/null_encryptor_test.rb index 72ff00d1aa..3a9b8a4a77 100644 --- a/activerecord/test/cases/encryption/null_encryptor_test.rb +++ b/activerecord/test/cases/encryption/null_encryptor_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" class ActiveRecord::Encryption::NullEncryptorTest < ActiveSupport::TestCase diff --git a/activerecord/test/cases/encryption/performance/encryption_performance_test.rb b/activerecord/test/cases/encryption/performance/encryption_performance_test.rb index 4b678b55bd..c84e57c409 100644 --- a/activerecord/test/cases/encryption/performance/encryption_performance_test.rb +++ b/activerecord/test/cases/encryption/performance/encryption_performance_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" require "models/book" require "models/post" diff --git a/activerecord/test/cases/encryption/performance/envelope_encryption_performance_test.rb b/activerecord/test/cases/encryption/performance/envelope_encryption_performance_test.rb index 04f7cb0a48..ce66bb3431 100644 --- a/activerecord/test/cases/encryption/performance/envelope_encryption_performance_test.rb +++ b/activerecord/test/cases/encryption/performance/envelope_encryption_performance_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" require "models/book" diff --git a/activerecord/test/cases/encryption/performance/extended_deterministic_queries_performance_test.rb b/activerecord/test/cases/encryption/performance/extended_deterministic_queries_performance_test.rb index 92cec80bf9..434ca3450a 100644 --- a/activerecord/test/cases/encryption/performance/extended_deterministic_queries_performance_test.rb +++ b/activerecord/test/cases/encryption/performance/extended_deterministic_queries_performance_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" require "models/book" @@ -7,7 +9,7 @@ class ActiveRecord::Encryption::ExtendedDeterministicQueriesPerformanceTest < Ac baseline = -> { EncryptedBook.find_by(format: "paperback") } # not encrypted # Performance is similar with SQL adapter - assert_slower_by_at_most 1.6 , baseline: baseline, duration: 2 do + assert_slower_by_at_most 1.6, baseline: baseline, duration: 2 do EncryptedBook.find_by(name: "Agile Web Development with Rails") # encrypted, deterministic end end diff --git a/activerecord/test/cases/encryption/performance/storage_performance_test.rb b/activerecord/test/cases/encryption/performance/storage_performance_test.rb index a73a36c166..446a687ba7 100644 --- a/activerecord/test/cases/encryption/performance/storage_performance_test.rb +++ b/activerecord/test/cases/encryption/performance/storage_performance_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" class ActiveRecord::Encryption::StoragePerformanceTest < ActiveRecord::TestCase @@ -62,4 +64,4 @@ class ActiveRecord::Encryption::StoragePerformanceTest < ActiveRecord::TestCase def cipher @cipher ||= ActiveRecord::Encryption::Cipher.new end -end \ No newline at end of file +end diff --git a/activerecord/test/cases/encryption/properties_test.rb b/activerecord/test/cases/encryption/properties_test.rb index e6a070ce11..a8ed190fcc 100644 --- a/activerecord/test/cases/encryption/properties_test.rb +++ b/activerecord/test/cases/encryption/properties_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" class ActiveRecord::EncryptionPropertiesTest < ActiveSupport::TestCase diff --git a/activerecord/test/cases/encryption/read_only_null_encryptor_test.rb b/activerecord/test/cases/encryption/read_only_null_encryptor_test.rb index 11c7f9f549..49eb901b25 100644 --- a/activerecord/test/cases/encryption/read_only_null_encryptor_test.rb +++ b/activerecord/test/cases/encryption/read_only_null_encryptor_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" class ActiveRecord::Encryption::ReadOnlyNullEncryptorTest < ActiveSupport::TestCase diff --git a/activerecord/test/cases/encryption/unencrypted_attributes_test.rb b/activerecord/test/cases/encryption/unencrypted_attributes_test.rb index 9160f5cd59..ba4b3ae048 100644 --- a/activerecord/test/cases/encryption/unencrypted_attributes_test.rb +++ b/activerecord/test/cases/encryption/unencrypted_attributes_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/encryption/helper" require "models/post" diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 879bfc451e..241d3d7bdc 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -230,4 +230,4 @@ ActiveRecord::Encryption.configure \ deterministic_key: "test deterministic key", key_derivation_salt: "testing key derivation salt" -ActiveRecord::Encryption::ExtendedDeterministicQueries.install_support \ No newline at end of file +ActiveRecord::Encryption::ExtendedDeterministicQueries.install_support diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb index d1073ff383..c7760875c5 100644 --- a/activerecord/test/models/post.rb +++ b/activerecord/test/models/post.rb @@ -388,4 +388,4 @@ class EncryptedPost < Post encrypts :title encrypts :body, key_provider: MutableDerivedSecretKeyProvider.new("my post body secret!") -end \ No newline at end of file +end diff --git a/activerecord/test/models/traffic_light.rb b/activerecord/test/models/traffic_light.rb index 05f2155bb7..a557f61fa2 100644 --- a/activerecord/test/models/traffic_light.rb +++ b/activerecord/test/models/traffic_light.rb @@ -7,4 +7,4 @@ end class EncryptedTrafficLight < TrafficLight encrypts :state -end \ No newline at end of file +end