test/reader_test.rb in symmetric-encryption-3.4.0 vs test/reader_test.rb in symmetric-encryption-3.6.0
- old
+ new
@@ -87,23 +87,23 @@
end
end
[
# No Header
- {:header => false, :random_key => false, :random_iv => false},
+ {header: false, random_key: false, random_iv: false},
# Default Header with random key and iv
{},
# Header with no compression ( default anyway )
- {:compress => false},
+ {compress: false},
# Compress and use Random key, iv
- {:compress => true},
+ {compress: true},
# Header but not random key or iv
- {:random_key => false},
+ {random_key: false},
# Random iv only
- {:random_key => false, :random_iv => true},
+ {random_key: false, random_iv: true},
# Random iv only with compression
- {:random_iv => true, :compress => true},
+ {random_iv: true, compress: true},
].each do |options|
[:data, :empty, :blank].each do |usecase|
context "read from #{usecase} file with options: #{options.inspect}" do
@@ -243,11 +243,11 @@
context "reading from files with previous keys" do
setup do
@filename = '_test'
# Create encrypted file with old encryption key
- SymmetricEncryption::Writer.open(@filename, :version => 0) do |file|
+ SymmetricEncryption::Writer.open(@filename, version: 0) do |file|
@data.inject(0) {|sum,str| sum + file.write(str)}
end
end
teardown do
@@ -281,11 +281,11 @@
context "reading from files with previous keys without a header" do
setup do
@filename = '_test'
# Create encrypted file with old encryption key
- SymmetricEncryption::Writer.open(@filename, :version => 0, :header => false, :random_key => false) do |file|
+ SymmetricEncryption::Writer.open(@filename, version: 0, header: false, random_key: false) do |file|
@data.inject(0) {|sum,str| sum + file.write(str)}
end
end
teardown do
@@ -295,17 +295,17 @@
# Required for Windows
end
end
should "decrypt from file in a single read" do
- decrypted = SymmetricEncryption::Reader.open(@filename, :version => 0) {|file| file.read}
+ decrypted = SymmetricEncryption::Reader.open(@filename, version: 0) {|file| file.read}
assert_equal @data_str, decrypted
end
should "decrypt from file in a single read with different version" do
# Should fail since file was encrypted using version 0 key
assert_raise OpenSSL::Cipher::CipherError do
- SymmetricEncryption::Reader.open(@filename, :version => 2) {|file| file.read}
+ SymmetricEncryption::Reader.open(@filename, version: 2) {|file| file.read}
end
end
end
end