Sha256: b6a3f81f63f530b56bda503df4891fa88e960f6307ea72195d00c96d651e499e
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
require_relative "spec_helper" describe Strongroom::Decryptor do before do @cipher = ::MiniTest::Mock.new.tap do |c| c.expect :decrypt, nil c.expect :key=, "plainkey", [ "plainkey" ] c.expect :iv=, "iv", [ "iv" ] c.expect :update, "original inp", [ "ciphertext==" ] c.expect :final, "ut" end @key = ::MiniTest::Mock.new.tap do |k| k.expect :private_decrypt, "plainkey", [ "ekey" ] end @enigma = ::MiniTest::Mock.new.tap do |e| e.expect :ciphertext, "ciphertext==" e.expect :encrypted_key, "ekey" e.expect :iv, "iv" end @cipher_locator = ::MiniTest::Mock.new.tap do |cl| cl.expect :for, @cipher, [ @enigma ] end end it "calls OpenSSL methods" do Strongroom::Decryptor.new(@key, @cipher_locator).decrypt(@enigma) [ @cipher, @key, @enigma ].each &:verify end it "returns correct plaintext" do Strongroom::Decryptor.new(@key, @cipher_locator).decrypt(@enigma).tap do |output| output.must_equal "original input" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
strongroom-0.0.2 | spec/strongroom_decryptor_spec.rb |
strongroom-0.0.1 | spec/strongroom_decryptor_spec.rb |