diff --git a/app/models/person.rb b/app/models/person.rb
index e18650f..5b9eaa1 100644
--- a/app/models/person.rb
+++ b/app/models/person.rb
@@ -21,9 +21,6 @@ class Person < Profile
def remove_friend(friend)
friends.delete(friend)
end
-
-# has_many :person_friendships
-# has_many :people, :through => :person_friendships, :foreign_key => 'friend_id'
has_one :person_info
diff --git a/app/views/profile/index.rhtml b/app/views/profile/index.rhtml
index 5509a4f..146b232 100644
--- a/app/views/profile/index.rhtml
+++ b/app/views/profile/index.rhtml
@@ -11,9 +11,11 @@
<%# FIXME %>
-
<%= link_to _('Friends'), :action => 'friends' %>
- <%= link_to _('Communities'), :action => 'communities' %>
- <%= link_to _('Enterprises'), :action => 'enterprises' %>
+ <% if profile.kind_of? Person %>
+ <%= link_to _('Friends'), :action => 'friends' %>
+ <%= link_to _('Communities'), :action => 'communities' %>
+ <%= link_to _('Enterprises'), :action => 'enterprises' %>
+ <% end %>
<% if profile.kind_of? Organization %>
<%= link_to _('Members'), :action => 'members' %>
<% end %>
diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb
index eba61b7..5073694 100644
--- a/test/functional/profile_controller_test.rb
+++ b/test/functional/profile_controller_test.rb
@@ -68,4 +68,24 @@ class ProfileControllerTest < Test::Unit::TestCase
assert_no_tag :tag => 'a', :content => 'Join this community'
end
+ should 'dont show enterprises link to enterprise' do
+ ent = Enterprise.create!(:identifier => 'test_enterprise1', :name => 'Test enteprise1')
+ get :index, :profile => ent.identifier
+ assert_tag :tag => 'h2', :content => "#{ent.identifier}'s profile"
+ assert_no_tag :tag => 'a', :content => 'Enterprises', :attributes => { :href => /profile\/#{ent.identifier}\/enterprises$/ }
+ end
+
+ should 'dont show members link to person' do
+ person = create_user('person_1').person
+ get :index, :profile => person.identifier
+ assert_tag :tag => 'h2', :content => "#{person.identifier}'s profile"
+ assert_no_tag :tag => 'a', :content => 'Members', :attributes => { :href => /profile\/#{person.identifier}\/members$/ }
+ end
+
+ should 'show friends link to person' do
+ person = create_user('person_1').person
+ get :index, :profile => person.identifier
+ assert_tag :tag => 'a', :content => 'Friends', :attributes => { :href => /profile\/#{person.identifier}\/friends$/ }
+ end
+
end
--
libgit2 0.21.2