test/pgp_writer_test.rb in iostreams-1.10.2 vs test/pgp_writer_test.rb in iostreams-1.10.3
- old
+ new
@@ -19,26 +19,32 @@
temp_file.delete
end
describe ".file" do
it "writes encrypted text file" do
- IOStreams::Pgp::Writer.file(file_name, recipient: "receiver@example.org") do |io|
- io.write(decrypted)
- end
+ result =
+ IOStreams::Pgp::Writer.file(file_name, recipient: "receiver@example.org") do |io|
+ io.write(decrypted)
+ 53534
+ end
+ assert_equal 53534, result
result = IOStreams::Pgp::Reader.file(file_name, passphrase: "receiver_passphrase", &:read)
assert_equal decrypted, result
end
it "writes encrypted binary file" do
binary_file_name = File.join(File.dirname(__FILE__), "files", "spreadsheet.xlsx")
binary_data = File.open(binary_file_name, "rb", &:read)
File.open(binary_file_name, "rb") do |input|
- IOStreams::Pgp::Writer.file(file_name, recipient: "receiver@example.org") do |output|
- IO.copy_stream(input, output)
- end
+ result =
+ IOStreams::Pgp::Writer.file(file_name, recipient: "receiver@example.org") do |output|
+ IO.copy_stream(input, output)
+ 53534
+ end
+ assert_equal 53534, result
end
result = IOStreams::Pgp::Reader.file(file_name, passphrase: "receiver_passphrase", &:read)
assert_equal binary_data, result
end
@@ -106,12 +112,15 @@
end
end
it "writes to a stream" do
io_string = StringIO.new("".b)
- IOStreams::Pgp::Writer.stream(io_string, recipient: "receiver@example.org", signer: "sender@example.org", signer_passphrase: "sender_passphrase") do |io|
- io.write(decrypted)
- end
+ result =
+ IOStreams::Pgp::Writer.stream(io_string, recipient: "receiver@example.org", signer: "sender@example.org", signer_passphrase: "sender_passphrase") do |io|
+ io.write(decrypted)
+ 53534
+ end
+ assert_equal 53534, result
io = StringIO.new(io_string.string)
result = IOStreams::Pgp::Reader.stream(io, passphrase: "receiver_passphrase", &:read)
assert_equal decrypted, result
end