After assigning nil to an encrypted attribute, the return value for the attribute is still the previous value.
example of failing test
it "allows dirty attributes to be unset" do
person = LazySinglePerson.create!(ssn: "123-45-6789")
person.ssn = nil
expect(person.ssn).to be_nil
end
result
-
Vault::Rails lazy single decrypt allows dirty attributes to be unset
Failure/Error: expect(person.ssn).to be_nil
expected: nil
got: "123-45-6789"
./spec/integration/rails_spec.rb:327:in `block (3 levels) in <top (required)>'