test/keystore/environment_test.rb in symmetric-encryption-4.0.0 vs test/keystore/environment_test.rb in symmetric-encryption-4.0.1

- old
+ new

@@ -14,14 +14,14 @@ 10 end let :keystore_config do SymmetricEncryption::Keystore::Environment.new_key_config( - cipher_name: 'aes-256-cbc', - app_name: 'tester', - environment: 'test', - version: version + cipher_name: 'aes-256-cbc', + app_name: 'tester', + environment: 'test', + version: version ) end it 'increments the version' do assert_equal 11, keystore_config[:version] @@ -46,21 +46,21 @@ assert_equal 1, keystore_config[:version] end end it 'retains the env var name' do - assert_equal "TESTER_TEST_V11", keystore_config[:key_env_var] + assert_equal 'TESTER_TEST_V11', keystore_config[:key_env_var] end it 'retains cipher_name' do assert_equal 'aes-256-cbc', keystore_config[:cipher_name] end end describe '.new_config' do let :environments do - %i(development test acceptance preprod production) + %i[development test acceptance preprod production] end let :config do SymmetricEncryption::Keystore::Environment.new_config( app_name: 'tester', @@ -77,11 +77,11 @@ assert_equal SymmetricEncryption::Keystore.dev_config, config[:test] assert_equal SymmetricEncryption::Keystore.dev_config, config[:development] end it 'each non test environment has a key encryption key' do - (environments - %i(development test)).each do |env| + (environments - %i[development test]).each do |env| assert config[env][:ciphers].first[:key_encrypting_key], "Environment #{env} is missing the key encryption key" end end it 'every environment has ciphers' do @@ -90,13 +90,13 @@ assert_equal 1, ciphers.size end end it 'creates an encrypted key file for all non-test environments' do - (environments - %i(development test)).each do |env| + (environments - %i[development test]).each do |env| assert ciphers = config[env][:ciphers], "Environment #{env} is missing ciphers: #{config[env].inspect}" - assert file_name = ciphers.first[:key_env_var], "Environment #{env} is missing key_env_var: #{ciphers.inspect}" + assert ciphers.first[:key_env_var], "Environment #{env} is missing key_env_var: #{ciphers.inspect}" end end end describe '#read' do @@ -107,13 +107,12 @@ let :keystore do SymmetricEncryption::Keystore::Environment.new(key_env_var: 'TESTER_ENV_VAR', key_encrypting_key: key) end it 'reads the key' do - ENV["TESTER_ENV_VAR"] = Base64.strict_encode64(key.encrypt('TEST')) + ENV['TESTER_ENV_VAR'] = Base64.strict_encode64(key.encrypt('TEST')) assert_equal 'TEST', keystore.read end end - end end end