File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 54
54
end
55
55
end
56
56
57
+
57
58
context "Encryption and Decryption" do
58
59
let ( :plain_text ) { 'plain_text' }
59
60
let ( :cipher_text ) { 'tooltxet_nialp' }
104
105
expect_any_instance_of ( CryptKeeper ::Provider ::Encryptor ) . to_not receive ( :decrypt )
105
106
subject . find ( record . id ) . storage
106
107
end
108
+
109
+ context "with a binary database field" do
110
+ subject { create_encrypted_model :storage_binary , passphrase : 'tool' , encryptor : :encryptor }
111
+
112
+ it "encrypts the data" do
113
+ expect_any_instance_of ( CryptKeeper ::Provider ::Encryptor ) . to receive ( :encrypt ) . with ( 'testing' )
114
+ subject . create! ( storage_binary : 'testing' )
115
+ end
116
+
117
+ it "decrypts the data" do
118
+ record = subject . create! ( storage_binary : 'testing' )
119
+ expect_any_instance_of ( CryptKeeper ::Provider ::Encryptor ) . to receive ( :decrypt ) . at_least ( 1 ) . times . with ( 'toolgnitset' )
120
+ subject . find ( record . id ) . storage_binary
121
+ end
122
+ end
107
123
end
108
124
109
125
context "Search" do
You can’t perform that action at this time.
0 commit comments