Commit ab3487d7711b0a5d1ce219e6efd910a0f960b8d2

Authored by MoisesMachado
1 parent ca7362ba

ActionItem135: fixed a test on the person info summary

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1086 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/my_profile/profile_editor_controller.rb
... ... @@ -12,6 +12,7 @@ class ProfileEditorController < MyProfileController
12 12 FavoriteLinksProfile
13 13 ListBlock
14 14 ProfileInfoBlock
  15 + ViewArticle
15 16 ]
16 17 end
17 18  
... ...
app/design_blocks/view_article/controllers/view_article_controller.rb
... ... @@ -38,6 +38,7 @@ class ViewArticleController < ApplicationController
38 38 ###########################
39 39  
40 40 def edit
  41 + @articles = @profile.articles
41 42 design_render_on_edit
42 43 end
43 44  
... ... @@ -46,5 +47,4 @@ class ViewArticleController < ApplicationController
46 47 design_render_on_edit :nothing => true
47 48 end
48 49  
49   -
50 50 end
... ...
app/design_blocks/view_article/models/view_article.rb
... ... @@ -12,20 +12,16 @@ class ViewArticle < Design::Block
12 12 'ViewArticle'
13 13 end
14 14  
15   - def page
16   - self.settings[:page]
  15 + def article_id
  16 + self.settings[:article_id]
17 17 end
18   -
19   - def page= value
20   - self.settings[:page] = value
21   - end
22   -
23   - def profile
24   - self.settings[:page]
  18 +
  19 + def article_id= value
  20 + self.settings[:article_id] = value
25 21 end
26 22  
27   - def profile= value
28   - self.settings[:page] = value
  23 + def article
  24 + Article.find(article_id) if article_id
29 25 end
30 26  
31 27 end
... ...
app/design_blocks/view_article/views/edit.rhtml
... ... @@ -8,7 +8,7 @@
8 8  
9 9 <p>
10 10 <label for="design_block_page"> <%= _("Page to show") %> </label>
11   - <%= text_field 'design_block', 'page'%>
  11 + <%= select 'design_block', 'article_id', @articles.map{|a|[a.full_name, a.id]} %>
12 12 </p>
13 13  
14 14 <%= submit_tag _('Save') %>
... ...
app/design_blocks/view_article/views/index.rhtml
1   -<%= render_component(:controller => 'content_viewer', :action => 'view_page', :params => {:profile => @profile.identifier, :page => [@design_block.page], :no_layout => true}) %>
  1 +<%= @design_block.article.to_html if @design_block.article %>
... ...
app/models/person_info.rb
... ... @@ -3,7 +3,7 @@ class PersonInfo &lt; ActiveRecord::Base
3 3 belongs_to :person
4 4  
5 5 def summary
6   - ['name', 'sex', 'birth_date', 'address', 'city', 'state', 'country'].map do |col|
  6 + ['name', 'contact_information', 'sex', 'birth_date', 'address', 'city', 'state', 'country'].map do |col|
7 7 [ PersonInfo.columns_hash[col] && PersonInfo.columns_hash[col].human_name, self.send(col) ]
8 8 end
9 9 end
... ...
test/unit/person_info_test.rb
... ... @@ -20,7 +20,7 @@ class PersonInfoTest &lt; Test::Unit::TestCase
20 20 summary = person_info.summary
21 21 assert(summary.any? { |line| line[1] == 'person name' })
22 22 assert(summary.any? { |line| line[1] == 'my address' })
23   - assert(summary.any? { |line| line[1] == 'my contact information' })
  23 + assert(summary.any? { |line| line[1] == 'my contact information' }, "summary (#{summary.map{|l| l[1] }.compact.join("; ")}) do not contain 'my contact informatidon'")
24 24 end
25 25  
26 26 end
... ...