Sha256: 74e31ef5c1dc62b9784e7632085c054398022ec5e92511e5642016ef40fc4a99

Contents?: true

Size: 694 Bytes

Versions: 2

Compression:

Stored size: 694 Bytes

Contents

require 'spec_helper'

describe Conceal do
  let(:key) { SecureRandom.hex(128) }

  it 'has a version number' do
    expect(Conceal::VERSION).not_to be nil
  end

  it 'encrypt then decrypt returns the same original plaintext' do
    expect(Conceal.decrypt(Conceal.encrypt('hello', key: key), key: key)).to eq('hello')
  end

  describe '#encrypt' do
    it 'does not return the plaintext' do
      expect(Conceal.encrypt('hello', key: key)).not_to eq('hello')
    end

    it 'outputs different values each time (different iv/salt)' do
      first  = Conceal.encrypt('hello', key: key)
      second = Conceal.encrypt('hello', key: key)

      expect(first).not_to eq(second)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
conceal-0.2.0 spec/conceal_spec.rb
conceal-0.1.0 spec/conceal_spec.rb