Sha256: 4b42a65a4394642d51bb47df73b999b80c3595fc7ce9c2ae82a0c15febbd91dc
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
# -*- encoding: utf-8 -*- require 'spec_helper' describe "Symmetric encryption on embedded document" do let(:person) do Person.new(:first_name => 'John', :last_name => 'Smith', :credit_card => CreditCard.new(:number => '0000111122224444')) end context "Has valid attributes" do context "Before save" do subject { person.credit_card } its(:number) { should_not be_encrypted } its(:number) { should eq('0000111122224444') } its(:number) { should_not eq("0pOZeQMtxuPsAPaoR3fkjMEUIoAuSbFO\n") } it { should be_valid } end context "after save" do before { person.save!; puts person.credit_card.number } subject { person.credit_card } its(:number) { should be_encrypted } its(:number) { should eq("0pOZeQMtxuPsAPaoR3fkjMEUIoAuSbFO\n") } its(:number) { should eq('0000111122224444') } end end it "doesn't encrypt value of field after validation" do person.credit_card.valid? person.should be_valid end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid-encryptor-0.0.4 | spec/embedded_document_spec.rb |