Commit c250cb47385e31ed6419123c3dd622f116798b17
1 parent
71126773
Exists in
master
and in
29 other branches
ActionItem44: listing e-mail addresses for person
For, only the default e-mail address git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1994 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
13 additions
and
0 deletions
Show diff stats
app/models/person.rb
... | ... | @@ -113,4 +113,9 @@ class Person < Profile |
113 | 113 | |
114 | 114 | has_and_belongs_to_many :favorite_enterprises, :class_name => 'Enterprise', :join_table => 'favorite_enteprises_people' |
115 | 115 | |
116 | + def email_addresses | |
117 | + # TODO for now, only one e-mail address | |
118 | + ['%s@%s' % [self.identifier, self.environment.default_hostname ] ] | |
119 | + end | |
120 | + | |
116 | 121 | end | ... | ... |
test/unit/person_test.rb
... | ... | @@ -273,5 +273,13 @@ class PersonTest < Test::Unit::TestCase |
273 | 273 | AddFriend.create!(:person => p1, :friend => p2) |
274 | 274 | assert p1.already_request_friendship?(p2) |
275 | 275 | end |
276 | + | |
277 | + should 'have e-mail addresses' do | |
278 | + env = Environment.create!(:name => 'sample env', :domains => [Domain.new(:name => 'somedomain.com')]) | |
279 | + person = Person.new(:identifier => 'testuser') | |
280 | + person.expects(:environment).returns(env) | |
281 | + | |
282 | + assert_equal ['testuser@somedomain.com'], person.email_addresses | |
283 | + end | |
276 | 284 | |
277 | 285 | end | ... | ... |