Forum: Ruby on Rails Tests creating output?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sean H. (Guest)
on 2006-04-06 00:08
(Received via mailing list)
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
This topic is locked and can not be replied to.