Skip to content

Commit

Permalink
Update model_spec.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
tfwright committed Apr 13, 2016
1 parent 2d1fcdd commit e643ab0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions spec/model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ module CryptKeeper

subject { create_model }

after do
CryptKeeper.stub_encryption = false
end

describe "#crypt_keeper" do
context "Fields" do
it "enables encryption for the given fields" do
Expand Down Expand Up @@ -83,15 +87,13 @@ module CryptKeeper
record = subject.create!(storage: "testing")
CryptKeeper::Provider::Encryptor.any_instance.should_not_receive(:decrypt)
subject.find(record.id).storage
CryptKeeper.stub_encryption = false
end

it "does not decrypt when stubbing is enabled after model is created" do
record = subject.create!(storage: "testing")
CryptKeeper.stub_encryption = true
CryptKeeper::Provider::Encryptor.any_instance.should_not_receive(:decrypt)
subject.find(record.id).storage
CryptKeeper.stub_encryption = false
end
end

Expand Down

0 comments on commit e643ab0

Please sign in to comment.