Displaying 2 results from an estimated 2 matches for "staff1_person".
2006 Jan 25
2
Testing a model method - private method?
...to test a method in my model:
def html_email
return "<a href=''mailto:" + self.email + "''>" + self.email + "</a>"
end
The method works ok. But when I try to test it:
assert_equal ("<a href=''mailto:" + people(:staff1_person).email +
"''>" + people(:staff1_person).email + "</a>"), @person.html_email
I get a failure:
1) Error:
test_html_email(PersonTest):
NoMethodError: private method `html_email'' called for #<Person:0x256b460>
/Applications/Locomotive/Bundles/...
2006 Apr 05
0
Tests creating output?
...w_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....