Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add encryption stubbing #112

Merged
merged 1 commit into from
Apr 13, 2016
Merged

Add encryption stubbing #112

merged 1 commit into from
Apr 13, 2016

Conversation

tfwright
Copy link
Collaborator

Allows stubbing encryption with CryptKeeper.stub_encryption = true

@tfwright tfwright force-pushed the feature/stub-encryption branch 7 times, most recently from d3f5e8c to 2d1fcdd Compare April 13, 2016 15:55
CryptKeeper.stub_encryption = true
CryptKeeper::Provider::Encryptor.any_instance.should_not_receive(:decrypt)
subject.find(record.id).storage
CryptKeeper.stub_encryption = false
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put stub_encryption = false in an after block?

CryptKeeper.stub_encryption = true
record = subject.create!(storage: "testing")
CryptKeeper::Provider::Encryptor.any_instance.should_not_receive(:decrypt)
subject.find(record.id).storage
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than using should_not_receive, how about just asserting that the plaintext of storage is unchanged.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit tricky skirting deserialization, but I suppose it could work. I was following the pattern in other tests.

@jmazzi jmazzi merged commit 0ff5c42 into master Apr 13, 2016
@jmazzi jmazzi deleted the feature/stub-encryption branch April 13, 2016 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants