test/writer_test.rb in symmetric-encryption-1.0.0 vs test/writer_test.rb in symmetric-encryption-1.1.1

- old
+ new

@@ -10,12 +10,12 @@ # Load Symmetric Encryption keys SymmetricEncryption.load!(File.join(File.dirname(__FILE__), 'config', 'symmetric-encryption.yml'), 'test') # Unit Test for Symmetric::EncryptedStream # -class EncryptionWriterTest < Test::Unit::TestCase - context 'EncryptionWriter' do +class WriterTest < Test::Unit::TestCase + context SymmetricEncryption::Writer do setup do @data = [ "Hello World\n", "Keep this secret\n", "And keep going even further and further..." @@ -30,11 +30,11 @@ File.delete(@filename) if File.exist?(@filename) end should "encrypt to string stream" do stream = StringIO.new - file = SymmetricEncryption::Writer.new(stream, :header => false) + file = SymmetricEncryption::Writer.new(stream, :header => false, :random_key => false) written_len = @data.inject(0) {|sum,str| sum + file.write(str)} file.close assert_equal @data_len, written_len result = stream.string @@ -51,10 +51,10 @@ assert_equal @data_len, written_len end should "encrypt to file using .open" do written_len = nil - SymmetricEncryption::Writer.open(@filename, :header => false) do |file| + SymmetricEncryption::Writer.open(@filename, :header => false, :random_key => false) do |file| written_len = @data.inject(0) {|sum,str| sum + file.write(str)} end assert_equal @data_len, written_len assert_equal @data_encrypted, File.open(@filename, 'rb') {|f| f.read } end