From 96abae0a3076615c8c6005ea392aedf145a95e7a Mon Sep 17 00:00:00 2001 From: Dmitrii Golub Date: Fri, 12 May 2017 00:15:55 +0300 Subject: [PATCH] fix test in models/two_factor_authenticatable_spec.rb --- .../models/two_factor_authenticatable_spec.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/lib/two_factor_authentication/models/two_factor_authenticatable_spec.rb b/spec/lib/two_factor_authentication/models/two_factor_authenticatable_spec.rb index 272d0cf..05fb72d 100644 --- a/spec/lib/two_factor_authentication/models/two_factor_authenticatable_spec.rb +++ b/spec/lib/two_factor_authentication/models/two_factor_authenticatable_spec.rb @@ -280,16 +280,20 @@ describe Devise::Models::TwoFactorAuthenticatable do to raise_error ArgumentError end - it 'passes in the correct options to Encryptor' do + it 'passes in the correct options to Encryptor. + We test here output of + Devise::Models::TwoFactorAuthenticatable::EncryptionInstanceMethods.encryption_options_for' do instance.otp_secret_key = 'testing' iv = instance.encrypted_otp_secret_key_iv salt = instance.encrypted_otp_secret_key_salt + # it's important here to put the same crypto algorithm from that method encrypted = Encryptor.encrypt( value: 'testing', key: Devise.otp_secret_encryption_key, iv: iv.unpack('m').first, - salt: salt.unpack('m').first + salt: salt.unpack('m').first, + algorithm: 'aes-256-cbc' ) expect(instance.encrypted_otp_secret_key).to eq [encrypted].pack('m')