Sha256: c2ac9c2a3988644483a20013d320a37726452fb194395af8d42cee6ed4ec28c1
Contents?: true
Size: 1.07 KB
Versions: 13
Compression:
Stored size: 1.07 KB
Contents
require 'spec_helper' module CryptKeeper module Provider describe AesNew do subject { AesNew.new(key: 'cake', salt: 'salt') } describe "#initialize" do let(:digested_key) do ::Armor.digest('cake', 'salt') end its(:key) { should == digested_key } specify { expect { AesNew.new }.to raise_error(ArgumentError, "Missing :key") } end describe "#encrypt" do let(:encrypted) do subject.encrypt 'string' end specify { encrypted.should_not == 'string' } specify { encrypted.should_not be_blank } end describe "#decrypt" do let(:decrypted) do subject.decrypt "V02ebRU2wLk25AizasROVg==$kE+IpRaUNdBfYqR+WjMqvA==" end specify { decrypted.should == 'string' } 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 end end
Version data entries
13 entries across 13 versions & 1 rubygems