test/keystore/file_test.rb in symmetric-encryption-4.0.0 vs test/keystore/file_test.rb in symmetric-encryption-4.0.1
- old
+ new
@@ -14,15 +14,15 @@
10
end
let :key_config do
SymmetricEncryption::Keystore::File.new_key_config(
- key_path: 'tmp',
- cipher_name: 'aes-256-cbc',
- app_name: 'tester',
- environment: 'test',
- version: version
+ key_path: 'tmp',
+ cipher_name: 'aes-256-cbc',
+ app_name: 'tester',
+ environment: 'test',
+ version: version
)
end
it 'increments the version' do
assert_equal 11, key_config[:version]
@@ -58,17 +58,17 @@
assert_equal 'aes-256-cbc', key_config[:cipher_name]
end
it 'is readable by Key.from_config' do
key_config.delete(:version)
- assert key = SymmetricEncryption::Key.from_config(key_config)
+ assert SymmetricEncryption::Key.from_config(key_config)
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::File.new_config(
key_path: 'tmp',
@@ -86,11 +86,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
@@ -99,11 +99,11 @@
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_filename], "Environment #{env} is missing key_filename: #{ciphers.inspect}"
assert File.exist?(file_name)
end
end
@@ -117,9 +117,8 @@
it 'stores the key' do
keystore.write('TEST')
assert_equal 'TEST', keystore.read
end
end
-
end
end
end