Hi everyone,
I have this code in Person.rb:
def hashed_password(password)
require ''digest/sha1''
require ''base64''
new_password = Digest::SHA1.new
new_password << password
new_password = "{SHA}" <<
Base64.b64encode(new_password.digest).chop
end
And here''s my test:
def test_hashed_passwords_should_be_LDAP_compliant
new_hashed_password = ''{SHA}blahblahblah=''
new_password =
people(:staff1_person).hashed_password(''password'')
assert_equal new_password, new_hashed_password
end
When I run the test, it passes, but it outputs the hash somewhere in
hashed_password:
$ ruby test/unit/person_test.rb
Loaded suite test/unit/person_test
Started
blahblahblah...
Finished in 0.340915 seconds.
3 tests, 20 assertions, 0 failures, 0 errors
$
Why is that happening?
Thanks,
Sean