Commit 68acfa9ba279d9cad7392a350e9e007bf310c5a3
1 parent
c05f52ba
Exists in
staging
and in
42 other branches
ActionItem276: added functional tests to profile controller
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1664 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
25 additions
and
6 deletions
Show diff stats
app/models/person.rb
app/views/profile/index.rhtml
... | ... | @@ -11,9 +11,11 @@ |
11 | 11 | </li> |
12 | 12 | |
13 | 13 | <%# FIXME %> |
14 | - <li><%= link_to _('Friends'), :action => 'friends' %></li> | |
15 | - <li><%= link_to _('Communities'), :action => 'communities' %></li> | |
16 | - <li><%= link_to _('Enterprises'), :action => 'enterprises' %></li> | |
14 | + <% if profile.kind_of? Person %> | |
15 | + <li><%= link_to _('Friends'), :action => 'friends' %></li> | |
16 | + <li><%= link_to _('Communities'), :action => 'communities' %></li> | |
17 | + <li><%= link_to _('Enterprises'), :action => 'enterprises' %></li> | |
18 | + <% end %> | |
17 | 19 | <% if profile.kind_of? Organization %> |
18 | 20 | <li><%= link_to _('Members'), :action => 'members' %></li> |
19 | 21 | <% end %> | ... | ... |
test/functional/profile_controller_test.rb
... | ... | @@ -68,4 +68,24 @@ class ProfileControllerTest < Test::Unit::TestCase |
68 | 68 | assert_no_tag :tag => 'a', :content => 'Join this community' |
69 | 69 | end |
70 | 70 | |
71 | + should 'dont show enterprises link to enterprise' do | |
72 | + ent = Enterprise.create!(:identifier => 'test_enterprise1', :name => 'Test enteprise1') | |
73 | + get :index, :profile => ent.identifier | |
74 | + assert_tag :tag => 'h2', :content => "#{ent.identifier}'s profile" | |
75 | + assert_no_tag :tag => 'a', :content => 'Enterprises', :attributes => { :href => /profile\/#{ent.identifier}\/enterprises$/ } | |
76 | + end | |
77 | + | |
78 | + should 'dont show members link to person' do | |
79 | + person = create_user('person_1').person | |
80 | + get :index, :profile => person.identifier | |
81 | + assert_tag :tag => 'h2', :content => "#{person.identifier}'s profile" | |
82 | + assert_no_tag :tag => 'a', :content => 'Members', :attributes => { :href => /profile\/#{person.identifier}\/members$/ } | |
83 | + end | |
84 | + | |
85 | + should 'show friends link to person' do | |
86 | + person = create_user('person_1').person | |
87 | + get :index, :profile => person.identifier | |
88 | + assert_tag :tag => 'a', :content => 'Friends', :attributes => { :href => /profile\/#{person.identifier}\/friends$/ } | |
89 | + end | |
90 | + | |
71 | 91 | end | ... | ... |