reidmorrison / symmetric-encryption

Symmetric Encryption for Ruby Projects using OpenSSL

Home Page:https://logger.rocketjob.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Validating for nil is giving false in my tests/Getting Coercible::UnsupportedCoercion: Coercible::Coercer::Object#to_string errors

anwarika opened this issue · comments

Environment

Provide at least:

  • Ruby Version = 2.3.4
  • Symmetric Encryption Version = 4.0

Expected Behavior

I expect the validates :encrypted_value, symmetric_encryption:true to validate nil or '' as true and not false

Actual Behavior

If my value field is nil or '' it returns false in my validation, which fails my tests

Pull Request

In symmetric-encryption-4.0.0\lib\symmetric_encryption.rb file

def self.encrypted? method returns false, but the comments weren't changed to tell me why. If i change this to true, my tests start passing for nil fields.