Sha256: ebffe40dc54c200b66864786359847100bf9c5a1d45c5207e54644984c13731b
Contents?: true
Size: 859 Bytes
Versions: 2
Compression:
Stored size: 859 Bytes
Contents
require 'spec_helper' require 'seraph/password_encryptor' RSpec.describe Seraph::PasswordEncryptor do describe '.call' do let(:password) { 'foobar12' } let(:encrypted) { described_class.call(password) } let(:salt) { encrypted.salt } subject(:encrypted_password) { encrypted.to_s } it 'encrypts the password using BCrypt' do expect(encrypted_password).to eq BCrypt::Engine.hash_secret(password, salt) end context 'when pepper is set' do let(:pepper) { '9b8177d1d835fad6cc19b455d41ec64f6dcbe83a1af60eb598973f8fb6e29fb1' } before do Seraph.configure do |config| config.pepper = pepper end end it 'uses the pepper for encrypting the password' do expect(encrypted_password).to eq BCrypt::Engine.hash_secret("#{password}:#{pepper}", salt) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
seraph-0.0.4 | spec/seraph/password_encryptor_spec.rb |
seraph-0.0.3 | spec/seraph/password_encryptor_spec.rb |