Commit 9ec91997dd98f82df330027c4c999a1fea9ba8c2

Authored by AntonioTerceiro
1 parent fbd9acb5

ActionItem135: making test pass by removing harcoded HTML in model; moved it to …

…the view, where it should be from the beginning



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1099 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/models/organization.rb
... ... @@ -15,13 +15,11 @@ class Organization < Profile
15 15 end
16 16  
17 17 def validation_methodology
18   - methodology = self.validation_info ? self.validation_info.validation_methodology : nil
19   - methodology || ('<em>' + _('(not informed)') + '</em>')
  18 + self.validation_info ? self.validation_info.validation_methodology : nil
20 19 end
21 20  
22 21 def validation_restrictions
23   - restrictions = self.validation_info ? self.validation_info.restrictions : nil
24   - restrictions || ('<em>' + _('(not informed)') + '</em>')
  22 + self.validation_info ? self.validation_info.restrictions : nil
25 23 end
26 24  
27 25 def pending_validations
... ...
app/views/enterprise_registration/select_validator.rhtml
... ... @@ -12,8 +12,8 @@
12 12 <%= radio_button_tag('create_enterprise[target_id]', validator.id) %>
13 13 <%= validator.name %>
14 14  
15   - <%= labelled_form_field(_('Validation Methodology:'), validator.validation_methodology) %>
16   - <%= labelled_form_field(_('Restrictions (if any):'), validator.validation_restrictions) %>
  15 + <%= labelled_form_field(_('Validation Methodology:'), validator.validation_methodology || _("(not informed)")) %>
  16 + <%= labelled_form_field(_('Restrictions (if any):'), validator.validation_restrictions || _("(not informed)")) %>
17 17 </div>
18 18 <% end %>
19 19  
... ...
test/unit/organization_test.rb
... ... @@ -35,7 +35,7 @@ class OrganizationTest &lt; Test::Unit::TestCase
35 35  
36 36 should 'provide validation methodology' do
37 37 org = Organization.new
38   - assert_equal '<em>(not informed)</em>', org.validation_methodology
  38 + assert_nil org.validation_methodology
39 39  
40 40 info = ValidationInfo.new
41 41 info.expects(:validation_methodology).returns('something')
... ... @@ -45,7 +45,7 @@ class OrganizationTest &lt; Test::Unit::TestCase
45 45  
46 46 should 'provide validation restrictions' do
47 47 org = Organization.new
48   - assert_equal '<em>(not informed)</em>', org.validation_restrictions
  48 + assert_nil org.validation_restrictions
49 49  
50 50 info = ValidationInfo.new
51 51 info.expects(:restrictions).returns('something')
... ...