Sha256: 91646038c2657dca6db4d9f82ca20123f091414edae2cb6bc4a9306ee5be2a96

Contents?: true

Size: 784 Bytes

Versions: 6

Compression:

Stored size: 784 Bytes

Contents

require 'spec_helper'

describe CryptKeeper::Provider::ActiveSupport do
  subject { described_class.new(key: 'cake', salt: 'salt') }

  let :plaintext do
    "string"
  end

  let :encrypted do
    subject.encrypt plaintext
  end

  let :decrypted do
    subject.decrypt encrypted
  end

  describe "#encrypt" do
    specify { expect(encrypted).to_not eq(plaintext) }
    specify { expect(encrypted).to_not be_blank }
  end

  describe "#decrypt" do
    specify { expect(decrypted).to eq(plaintext) }
    specify { expect(decrypted).to_not be_blank }
  end

  describe "#search" do
    let :records do
      [{ name: 'Bob' }, { name: 'Tim' }]
    end

    it "finds the matching record" do
      expect(subject.search(records, :name, 'Bob')).to eql([records.first])
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
crypt_keeper-2.3.0 spec/crypt_keeper/provider/active_support_spec.rb
crypt_keeper-2.2.0 spec/crypt_keeper/provider/active_support_spec.rb
crypt_keeper-2.1.0 spec/crypt_keeper/provider/active_support_spec.rb
crypt_keeper-2.0.1 spec/crypt_keeper/provider/active_support_spec.rb
crypt_keeper-2.0.0.rc2 spec/crypt_keeper/provider/active_support_spec.rb
crypt_keeper-2.0.0.rc1 spec/crypt_keeper/provider/active_support_spec.rb