Sha256: 4b281320888b977ee869d748a2067614fa5cb1697d92ee7cf148d77d6d2c828b

Contents?: true

Size: 760 Bytes

Versions: 19

Compression:

Stored size: 760 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'configliere/crypter'
include Configliere

describe "Crypter" do
  ENCRYPTED_FOO_VAL = "q\317\201\247\230\314P\021\305\n\363\315d\207\345y\346\255\a\202\006i\245\343T\203e\327a\316\245\313"
  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 ENCRYPTED_FOO_VAL[0..15]
    # 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

19 entries across 19 versions & 1 rubygems

Version Path
configliere-0.3.4 spec/configliere/crypter_spec.rb
configliere-0.3.3 spec/configliere/crypter_spec.rb
configliere-0.2.3 spec/configliere/crypter_spec.rb
configliere-0.3.2 spec/configliere/crypter_spec.rb
configliere-0.3.1 spec/configliere/crypter_spec.rb
configliere-0.3.0 spec/configliere/crypter_spec.rb
configliere-0.2.2 spec/configliere/crypter_spec.rb
configliere-0.2.1 spec/configliere/crypter_spec.rb
configliere-0.1.1 spec/configliere/crypter_spec.rb
configliere-0.1.0 spec/configliere/crypter_spec.rb
configliere-0.0.9 spec/configliere/crypter_spec.rb
configliere-0.0.8 spec/configliere/crypter_spec.rb
configliere-0.0.7 spec/configliere/crypter_spec.rb
configliere-0.0.6 spec/configliere/crypter_spec.rb
configliere-0.0.5 spec/configliere/crypter_spec.rb
configliere-0.0.4 spec/configliere/crypter_spec.rb
configliere-0.0.3 spec/configliere/crypter_spec.rb
configliere-0.0.2 spec/configliere/crypter_spec.rb
configliere-0.0.1 spec/configliere/crypter_spec.rb