Commit ab3487d7711b0a5d1ce219e6efd910a0f960b8d2
1 parent
ca7362ba
Exists in
master
and in
29 other branches
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
Showing
7 changed files
with
13 additions
and
16 deletions
Show diff stats
app/controllers/my_profile/profile_editor_controller.rb
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
app/design_blocks/view_article/views/index.rhtml
app/models/person_info.rb
... | ... | @@ -3,7 +3,7 @@ class PersonInfo < 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 < 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 | ... | ... |