test/writer_test.rb in symmetric-encryption-0.8.0 vs test/writer_test.rb in symmetric-encryption-0.9.0

- old
+ new

@@ -34,11 +34,13 @@ file = SymmetricEncryption::Writer.new(stream, :header => false) written_len = @data.inject(0) {|sum,str| sum + file.write(str)} file.close assert_equal @data_len, written_len - assert_equal @data_encrypted, stream.string + result = stream.string + result.force_encoding('binary') if defined?(Encoding) + assert_equal @data_encrypted, result end should "encrypt to string stream using .open" do written_len = 0 stream = StringIO.new @@ -52,9 +54,9 @@ written_len = nil SymmetricEncryption::Writer.open(@filename, :header => 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.read(@filename) + assert_equal @data_encrypted, File.open(@filename, 'rb') {|f| f.read } end end end