From 988af03f79a223f623cc713d5bf885e4f0d094c0 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Fri, 20 Sep 2024 17:24:26 +0700 Subject: [PATCH] Create password_hasher_spec.rb --- .../business/spec/lib/password_hasher_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 global_business/business/spec/lib/password_hasher_spec.rb diff --git a/global_business/business/spec/lib/password_hasher_spec.rb b/global_business/business/spec/lib/password_hasher_spec.rb new file mode 100644 index 000000000..481ac2a40 --- /dev/null +++ b/global_business/business/spec/lib/password_hasher_spec.rb @@ -0,0 +1,19 @@ +require 'rails_helper' + +RSpec.describe PasswordHasher do + describe '#hash' do + it 'hashes the given password' do + password = 'hello world' + hashed_password = PasswordHasher.hash(password) + expect(hashed_password).not_to eq(password) + end + end + + describe '#verify' do + it 'verifies the given password against the hashed password' do + password = 'hello world' + hashed_password = PasswordHasher.hash(password) + expect(PasswordHasher.verify(password, hashed_password)).to be_truthy + end + end +end