Sha256: f344c5c33d8335fda7f2486b6a7c638f57f303c0b85d989208d8cbc7f76ed7a8

Contents?: true

Size: 458 Bytes

Versions: 2

Compression:

Stored size: 458 Bytes

Contents

require 'spec_helper'

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

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

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

  it 'returns false when decryption fails' do
    expect(Parsel::JSON.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/json_spec.rb
parsel-0.2.0 spec/parsel/json_spec.rb