test/symmetric_encryption_test.rb in symmetric-encryption-3.6.0 vs test/symmetric_encryption_test.rb in symmetric-encryption-3.7.0
- old
+ new
@@ -1,10 +1,10 @@
-require File.dirname(__FILE__) + '/test_helper'
+require_relative 'test_helper'
# Unit Test for SymmetricEncryption
#
-class SymmetricEncryptionTest < Test::Unit::TestCase
+class SymmetricEncryptionTest < Minitest::Test
context 'SymmetricEncryption' do
context 'configuration' do
setup do
@ciphers = SymmetricEncryption.send(:read_config, File.join(File.dirname(__FILE__), 'config', 'symmetric-encryption.yml'), 'test')
@@ -274,9 +274,22 @@
assert encrypted = SymmetricEncryption.encrypt(@is_broken, random_iv=false, compress=false, type=:boolean)
assert_equal true, SymmetricEncryption.encrypted?(encrypted)
assert_equal @is_broken, SymmetricEncryption.decrypt(encrypted, version=nil, type=:boolean)
end
end
+
+ context "when yaml" do
+ setup do
+ @test = { :a => :b }
+ end
+
+ should "encrypt and decrypt a false value to and from a boolean" do
+ assert encrypted = SymmetricEncryption.encrypt(@test, random_iv=false, compress=false, type=:yaml)
+ assert_equal true, SymmetricEncryption.encrypted?(encrypted)
+ assert_equal @test, SymmetricEncryption.decrypt(encrypted, version=nil, type=:yaml)
+ end
+ end
+
end
end
end