Sha256: aa19e377b5fc4b9dbe141a1606443d0d426390ceec664a330b39544775d73dcc

Contents?: true

Size: 468 Bytes

Versions: 2

Compression:

Stored size: 468 Bytes

Contents

require 'spec_helper'

describe Parsel::Marshal do
  let(:key) { 'my secret key' }

  it 'encrypts data' do
    expect(Parsel::Marshal.encrypt(key, 'hello')).not_to eq(Marshal.dump('hello'))
  end

  it 'decrypts data' do
    encrypted = Parsel::Marshal.encrypt(key, 'hello')
    expect(Parsel::Marshal.decrypt(key, encrypted)).to eq('hello')
  end

  it 'returns false when decryption fails' do
    expect(Parsel::Marshal.decrypt('abc', '123')).to be_falsy
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
parsel-0.3.0 spec/parsel/marshal_spec.rb
parsel-0.2.0 spec/parsel/marshal_spec.rb