Sha256: 1cc1d7a52983d1fb58e1abe74bd20467d8eb52fbddeb0f0bb63513a06e15bd0a
Contents?: true
Size: 774 Bytes
Versions: 1
Compression:
Stored size: 774 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'configliere/crypter' include Configliere describe "Crypter" do ENCRYPTED_FOO_VAL = "cc+Bp5jMUBHFCvPNZIfleeatB4IGaaXjVINl12HOpcs=\n".force_encoding("BINARY") FOO_VAL_IV = Base64.decode64(ENCRYPTED_FOO_VAL)[0..15] it "encrypts" do # Force the same initialization vector as used to prepare the test value @cipher = Crypter.send(:new_cipher, :encrypt, 'sekrit') Crypter.should_receive(:new_cipher).and_return(@cipher) @cipher.should_receive(:random_iv).and_return FOO_VAL_IV # OK so do the test now. Crypter.encrypt('foo_val', 'sekrit').should == ENCRYPTED_FOO_VAL end it "decrypts" do Crypter.decrypt(ENCRYPTED_FOO_VAL, 'sekrit').should == 'foo_val' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
configliere-0.4.14 | spec/configliere/crypter_spec.rb |