test/pgp_reader_test.rb in iostreams-0.19.0 vs test/pgp_reader_test.rb in iostreams-0.20.0
- old
+ new
@@ -29,14 +29,18 @@
assert_raises IOStreams::Pgp::Failure do
IOStreams::Pgp::Reader.open(temp_file.path, passphrase: 'BAD') { |file| file.read }
end
end
- it 'fails with stream input' do
- io = StringIO.new
- assert_raises NotImplementedError do
- IOStreams::Pgp::Reader.open(io, passphrase: 'BAD') { |file| file.read }
+ it 'streams input' do
+ IOStreams::Pgp::Writer.open(temp_file.path, recipient: 'receiver@example.org') do |io|
+ io.write(decrypted)
end
+
+ encrypted = IOStreams::File::Reader.open(temp_file.path, &:read)
+ io = StringIO.new(encrypted)
+ result = IOStreams::Pgp::Reader.open(io, passphrase: 'receiver_passphrase', &:read)
+ assert_equal decrypted, result
end
end
end