Sha256: 22766faf57afced7ab59666163baad843d991ea82d2f42d02e678c39f5566a9c

Contents?: true

Size: 843 Bytes

Versions: 4

Compression:

Stored size: 843 Bytes

Contents

#encoding: utf-8
require 'spec_helper'

describe Pousse::Crypt do


    describe '#encrypt' do


      it 'encrypt a string' do
        source = '["test"]'
        key = 'superKey'
        iv = '1234567890123456'
        res, iv = Pousse::Crypt::encrypt(source, key, iv)
        Pousse::Crypt::decrypt(res, key, iv).should == source
      end

      it 'encrypt a string' do
        source = '["test", "asdasd"]'
        key = 'poussette'
        res, iv = Pousse::Crypt::encrypt(source, key)
        Pousse::Crypt::decrypt(res, key, iv).should == source
      end

      it 'encrypt and decrypt a string' do
        source = 'Here is some data for the coding'
        key = 'superKey'
        enc, iv = Pousse::Crypt::encrypt(source, key)
        res = Pousse::Crypt::decrypt(enc, key, iv)
        res.should == source
      end
    end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pousse-0.0.6 spec/pousse/crypt_spec.rb
pousse-0.0.5 spec/pousse/crypt_spec.rb
pousse-0.0.4 spec/pousse/crypt_spec.rb
pousse-0.0.3 spec/pousse/crypt_spec.rb