Commit abc262e15b5af4e5029e1affb35caf07d14a8724

Authored by Daniela Feitosa
1 parent 877d26ae

Fixed failing tests

app/views/contact/new.rhtml
1   -<h1><%= _('Send an e-mail to administrators') %></h1>
  1 +<% if profile.person? %>
  2 + <h1><%= _('Send an e-mail to %s') % profile.name %></h1>
  3 +<% else %>
  4 + <h1><%= _('Send an e-mail to administrators') %></h1>
2 5  
3   -<div class='tooltip'><%= _("The e-mail will be sent to the administrator of community '%s'") % profile.name %></div>
  6 + <div class='tooltip'><%= _("The e-mail will be sent to the administrators of community '%s'") % profile.name %></div>
  7 +<% end %>
4 8  
5 9 <%= error_messages_for 'contact' %>
6 10  
... ...
test/functional/contact_controller_test.rb
... ... @@ -25,9 +25,24 @@ class ContactControllerTest &lt; ActionController::TestCase
25 25 assert_response :success
26 26 end
27 27  
28   - should 'display destinatary name in title' do
  28 + should 'display destinatary name in title if profile is a person' do
  29 + get :new, :profile => profile.identifier
  30 + assert_tag :tag => 'h1', :content => /Send.*#{profile.name}/
  31 + end
  32 +
  33 + should 'display administrators in title if profile is an organization' do
29 34 get :new, :profile => enterprise.identifier
30   - assert_tag :tag => 'h1', :content => /Send.*#{enterprise.name}/
  35 + assert_tag :tag => 'h1', :content => /Send.*administrators/
  36 + end
  37 +
  38 + should 'display profile name in tooltip if profile is an organization' do
  39 + get :new, :profile => enterprise.identifier
  40 + assert_tag :tag => 'div', :content => /administrators.*#{enterprise.name}/, :attributes => {:class => 'tooltip'}
  41 + end
  42 +
  43 + should 'not display tooltip if profile is a person' do
  44 + get :new, :profile => profile.identifier
  45 + assert_no_tag :tag => 'div', :attributes => {:class => 'tooltip'}
31 46 end
32 47  
33 48 should 'add form to create contact via post' do
... ...