Commit ad4f98b3445f288b5fa7be8fa3315481f73b3461
Exists in
master
and in
29 other branches
Merge branch 'stable'
Conflicts: app/helpers/profile_helper.rb app/views/content_viewer/_article_toolbar.rhtml app/views/profile/_common.rhtml app/views/profile/_organization_profile.rhtml app/views/profile/_person_profile.rhtml db/schema.rb public/stylesheets/application.css
Showing
9 changed files
with
91 additions
and
58 deletions
Show diff stats
app/helpers/profile_helper.rb
1 | 1 | module ProfileHelper |
2 | 2 | |
3 | 3 | COMMON_CATEGORIES = ActiveSupport::OrderedHash.new |
4 | - COMMON_CATEGORIES[:content] = [:blogs, :image_galleries, :events, :tags] | |
4 | + COMMON_CATEGORIES[:content] = [:blogs, :image_galleries, :events, :article_tags] | |
5 | 5 | COMMON_CATEGORIES[:interests] = [:interests] |
6 | 6 | COMMON_CATEGORIES[:general] = nil |
7 | 7 | |
... | ... | @@ -41,6 +41,7 @@ module ProfileHelper |
41 | 41 | :birth_date => _('Date of birth'), |
42 | 42 | :created_at => _('Profile created at'), |
43 | 43 | :members_count => _('Members'), |
44 | + :article_tags => _('Tags') | |
44 | 45 | } |
45 | 46 | |
46 | 47 | EXCEPTION = { |
... | ... | @@ -73,14 +74,18 @@ module ProfileHelper |
73 | 74 | return '' |
74 | 75 | end |
75 | 76 | value = begin profile.send(field) rescue nil end |
76 | - if !value.blank? | |
77 | + return '' if value.blank? | |
78 | + if value.kind_of?(Hash) | |
79 | + content = self.send("treat_#{field}", value) | |
80 | + content_tag('tr', content_tag('td', title(field), :class => 'field-name') + content_tag('td', content)) | |
81 | + else | |
77 | 82 | entries = multiple ? value : [] << value |
78 | 83 | entries.map do |entry| |
79 | 84 | content = self.send("treat_#{field}", entry) |
80 | - content_tag('tr', content_tag('td', title(field, entry), :class => 'field-name') + content_tag('td', content)) | |
85 | + unless content.blank? | |
86 | + content_tag('tr', content_tag('td', title(field, entry), :class => 'field-name') + content_tag('td', content)) | |
87 | + end | |
81 | 88 | end.join("\n") |
82 | - else | |
83 | - '' | |
84 | 89 | end |
85 | 90 | end |
86 | 91 | |
... | ... | @@ -142,7 +147,7 @@ module ProfileHelper |
142 | 147 | link_to events.published.count, :controller => 'events', :action => 'events' |
143 | 148 | end |
144 | 149 | |
145 | - def treat_tags(tags) | |
150 | + def treat_article_tags(tags) | |
146 | 151 | tag_cloud @tags, :id, { :action => 'tags' }, :max_size => 18, :min_size => 10 |
147 | 152 | end |
148 | 153 | ... | ... |
app/models/external_feed.rb
... | ... | @@ -13,6 +13,7 @@ class ExternalFeed < ActiveRecord::Base |
13 | 13 | attr_accessible :address, :enabled |
14 | 14 | |
15 | 15 | def add_item(title, link, date, content) |
16 | + return if content.blank? | |
16 | 17 | doc = Hpricot(content) |
17 | 18 | doc.search('*').each do |p| |
18 | 19 | if p.instance_of? Hpricot::Elem | ... | ... |
db/migrate/20140708121356_index_articles_filtered_fields.rb
1 | 1 | class IndexArticlesFilteredFields < ActiveRecord::Migration |
2 | 2 | def self.up |
3 | 3 | %w[articles article_versions].each do |table| |
4 | - add_index table, [:path] | |
5 | - add_index table, [:path, :profile_id] | |
4 | + add_index table.to_sym, [:path] | |
5 | + add_index table.to_sym, [:path, :profile_id] | |
6 | 6 | end |
7 | 7 | add_index :articles, [:type] |
8 | 8 | add_index :articles, [:type, :parent_id] | ... | ... |
db/migrate/20140709212646_add_spam_comments_counter_cache_to_articles.rb
... | ... | @@ -2,7 +2,10 @@ class AddSpamCommentsCounterCacheToArticles < ActiveRecord::Migration |
2 | 2 | def self.up |
3 | 3 | add_column :articles, :spam_comments_count, :integer, :default => 0 |
4 | 4 | add_column :article_versions, :spam_comments_count, :integer, :default => 0 |
5 | - execute "update articles set spam_comments_count = (select count(*) from comments where comments.source_id = articles.id and comments.source_type = 'Article' and comments.spam = 't');" | |
5 | + | |
6 | + execute("SELECT comments.source_id as source_id, count(comments.id) as comments_count FROM comments LEFT OUTER JOIN articles ON articles.id = source_id WHERE comments.source_type = 'Article' AND comments.spam = 't' GROUP BY comments.source_id;").each do |data| | |
7 | + execute("UPDATE articles SET spam_comments_count = '#{data['comments_count']}' WHERE id = #{data['source_id']}") | |
8 | + end | |
6 | 9 | end |
7 | 10 | |
8 | 11 | def self.down | ... | ... |
db/migrate/20140709224246_create_real_relation_between_article_and_author.rb
... | ... | @@ -4,8 +4,10 @@ class CreateRealRelationBetweenArticleAndAuthor < ActiveRecord::Migration |
4 | 4 | add_column :article_versions, :author_id, :integer |
5 | 5 | |
6 | 6 | # Set article's author as the first version's last_changed_by_id. |
7 | - execute "update articles set author_id = (select article_versions.last_changed_by_id from article_versions where article_versions.article_id = articles.id and article_versions.version = 1 limit 1)" | |
8 | - end | |
7 | + execute("UPDATE article_versions SET author_id = last_changed_by_id") | |
8 | + | |
9 | + execute("UPDATE articles SET author_id = article_versions.author_id FROM article_versions WHERE article_versions.article_id = articles.id AND article_versions.version = 1") | |
10 | + end | |
9 | 11 | |
10 | 12 | def self.down |
11 | 13 | remove_column :articles, :author_id | ... | ... |
db/migrate/20140724180943_add_index_to_blog_posts_sort.rb
1 | 1 | class AddIndexToBlogPostsSort < ActiveRecord::Migration |
2 | 2 | def self.up |
3 | 3 | %w[articles article_versions].each do |table| |
4 | - add_index table, [:published_at, :id] | |
4 | + add_index table.to_sym, [:published_at, :id] | |
5 | 5 | end |
6 | 6 | end |
7 | 7 | |
8 | 8 | def self.down |
9 | 9 | %w[articles article_versions].each do |table| |
10 | - remove_index table, [:published_at, :id] | |
10 | + remove_index table.to_sym, [:published_at, :id] | |
11 | 11 | end |
12 | 12 | end |
13 | 13 | end | ... | ... |
features/profile_tags.feature
... | ... | @@ -1,20 +0,0 @@ |
1 | -Feature: profile tags | |
2 | - As a Noosfero user | |
3 | - I want to to view content tagged | |
4 | - So that I can follow the subjects I care about | |
5 | - | |
6 | - Background: | |
7 | - Given the following users | |
8 | - | login | | |
9 | - | terceiro | | |
10 | - And the following articles | |
11 | - | owner | name | body | tag_list | | |
12 | - | terceiro | text 1 | text 1 content | tag1, tag2 | | |
13 | - | terceiro | text 2 | text 2 content | tag1, tag3 | | |
14 | - | |
15 | - Scenario: tag feed | |
16 | - When I go to terceiro's profile | |
17 | - And I follow "tag1" | |
18 | - And I follow "Feed for this tag" | |
19 | - Then I should see "text 1" | |
20 | - And I should see "text 2" |
test/functional/profile_controller_test.rb
... | ... | @@ -98,8 +98,9 @@ class ProfileControllerTest < ActionController::TestCase |
98 | 98 | |
99 | 99 | should 'show friends link to person' do |
100 | 100 | person = create_user('person_1').person |
101 | + person.add_friend(profile) | |
101 | 102 | get :index, :profile => person.identifier |
102 | - assert_tag :tag => 'a', :content => /#{profile.friends.count}/, :attributes => { :href => /profile\/#{person.identifier}\/friends$/ } | |
103 | + assert_tag :tag => 'a', :content => /#{person.friends.count}/, :attributes => { :href => /profile\/#{person.identifier}\/friends$/ } | |
103 | 104 | end |
104 | 105 | |
105 | 106 | should 'display tag for profile' do |
... | ... | @@ -221,6 +222,7 @@ class ProfileControllerTest < ActionController::TestCase |
221 | 222 | |
222 | 223 | should 'display "Products" link for enterprise' do |
223 | 224 | ent = fast_create(Enterprise, :name => 'my test enterprise', :identifier => 'my-test-enterprise', :enabled => false) |
225 | + product = fast_create(Product, :profile_id => ent.id) | |
224 | 226 | |
225 | 227 | get :index, :profile => 'my-test-enterprise' |
226 | 228 | assert_tag :tag => 'a', :attributes => { :href => '/catalog/my-test-enterprise'}, :content => /Products\/Services/ |
... | ... | @@ -488,6 +490,14 @@ class ProfileControllerTest < ActionController::TestCase |
488 | 490 | assert_tag :tag => 'a', :content => 'One picture', :attributes => { :href => /\/testuser\/gallery/ } |
489 | 491 | end |
490 | 492 | |
493 | + should 'show tags in index' do | |
494 | + article = create(Article, :name => 'Published at', :profile_id => profile.id, :tag_list => ['tag1']) | |
495 | + | |
496 | + get :index, :profile => profile.identifier | |
497 | + | |
498 | + assert_tag :tag => 'a', :content => 'tag1', :attributes => { :href => /profile\/#{profile.identifier}\/tags\/tag1$/ } | |
499 | + end | |
500 | + | |
491 | 501 | should 'show description of orgarnization' do |
492 | 502 | login_as(@profile.identifier) |
493 | 503 | ent = fast_create(Enterprise) |
... | ... | @@ -1057,8 +1067,16 @@ class ProfileControllerTest < ActionController::TestCase |
1057 | 1067 | atn = fast_create(ActionTrackerNotification, :profile_id => profile.id, :action_tracker_id => at.id) |
1058 | 1068 | get :index, :profile => person.identifier |
1059 | 1069 | assert_no_tag :tag => 'div', :attributes => {:id => 'profile-network'} |
1070 | + end | |
1071 | + | |
1072 | + should "show the network activity if the viewer follows the profile" do | |
1073 | + login_as(profile.identifier) | |
1074 | + person = fast_create(Person) | |
1075 | + at = fast_create(ActionTracker::Record, :user_id => person.id) | |
1076 | + atn = fast_create(ActionTrackerNotification, :profile_id => profile.id, :action_tracker_id => at.id) | |
1060 | 1077 | |
1061 | 1078 | person.add_friend(profile) |
1079 | + profile.add_friend(person) | |
1062 | 1080 | get :index, :profile => person.identifier |
1063 | 1081 | assert_tag :tag => 'div', :attributes => {:id => 'profile-network'} |
1064 | 1082 | end |
... | ... | @@ -1077,8 +1095,16 @@ class ProfileControllerTest < ActionController::TestCase |
1077 | 1095 | scrap = fast_create(Scrap, :sender_id => person.id, :receiver_id => profile.id) |
1078 | 1096 | get :index, :profile => person.identifier |
1079 | 1097 | assert_no_tag :tag => 'div', :attributes => {:id => 'leave_scrap'}, :descendant => { :tag => 'input', :attributes => {:value => 'Share'} } |
1098 | + end | |
1099 | + | |
1100 | + should "show the scrap area on wall if the user follows the user" do | |
1101 | + login_as(profile.identifier) | |
1102 | + person = fast_create(Person) | |
1103 | + scrap = fast_create(Scrap, :sender_id => person.id, :receiver_id => profile.id) | |
1080 | 1104 | |
1081 | 1105 | person.add_friend(profile) |
1106 | + profile.add_friend(person) | |
1107 | + | |
1082 | 1108 | get :index, :profile => person.identifier |
1083 | 1109 | assert_tag :tag => 'div', :attributes => {:id => 'leave_scrap'}, :descendant => { :tag => 'input', :attributes => {:value => 'Share'} } |
1084 | 1110 | end |
... | ... | @@ -1438,9 +1464,9 @@ class ProfileControllerTest < ActionController::TestCase |
1438 | 1464 | viewed.data = { :sex => 'male', :fields_privacy => { 'sex' => 'public', 'birth_date' => 'public' } } |
1439 | 1465 | viewed.save! |
1440 | 1466 | get :index, :profile => viewed.identifier |
1441 | - assert_tag :tag => 'td', :content => 'Sex:' | |
1467 | + assert_tag :tag => 'td', :content => 'Sex' | |
1442 | 1468 | assert_tag :tag => 'td', :content => 'Male' |
1443 | - assert_tag :tag => 'td', :content => 'Date of birth:' | |
1469 | + assert_tag :tag => 'td', :content => 'Date of birth' | |
1444 | 1470 | assert_tag :tag => 'td', :content => 'August 26, 1990' |
1445 | 1471 | end |
1446 | 1472 | |
... | ... | @@ -1452,9 +1478,9 @@ class ProfileControllerTest < ActionController::TestCase |
1452 | 1478 | viewed.data = { :sex => 'male', :fields_privacy => { 'sex' => 'public' } } |
1453 | 1479 | viewed.save! |
1454 | 1480 | get :index, :profile => viewed.identifier |
1455 | - assert_tag :tag => 'td', :content => 'Sex:' | |
1481 | + assert_tag :tag => 'td', :content => 'Sex' | |
1456 | 1482 | assert_tag :tag => 'td', :content => 'Male' |
1457 | - assert_no_tag :tag => 'td', :content => 'Date of birth:' | |
1483 | + assert_no_tag :tag => 'td', :content => 'Date of birth' | |
1458 | 1484 | assert_no_tag :tag => 'td', :content => 'August 26, 1990' |
1459 | 1485 | end |
1460 | 1486 | |
... | ... | @@ -1468,9 +1494,9 @@ class ProfileControllerTest < ActionController::TestCase |
1468 | 1494 | strange = create_user('person_2').person |
1469 | 1495 | login_as(strange.identifier) |
1470 | 1496 | get :index, :profile => viewed.identifier |
1471 | - assert_tag :tag => 'td', :content => 'Sex:' | |
1497 | + assert_tag :tag => 'td', :content => 'Sex' | |
1472 | 1498 | assert_tag :tag => 'td', :content => 'Male' |
1473 | - assert_no_tag :tag => 'td', :content => 'Date of birth:' | |
1499 | + assert_no_tag :tag => 'td', :content => 'Date of birth' | |
1474 | 1500 | assert_no_tag :tag => 'td', :content => 'August 26, 1990' |
1475 | 1501 | end |
1476 | 1502 | |
... | ... | @@ -1485,9 +1511,9 @@ class ProfileControllerTest < ActionController::TestCase |
1485 | 1511 | Person.any_instance.stubs(:is_a_friend?).returns(true) |
1486 | 1512 | login_as(friend.identifier) |
1487 | 1513 | get :index, :profile => viewed.identifier |
1488 | - assert_tag :tag => 'td', :content => 'Sex:' | |
1514 | + assert_tag :tag => 'td', :content => 'Sex' | |
1489 | 1515 | assert_tag :tag => 'td', :content => 'Male' |
1490 | - assert_tag :tag => 'td', :content => 'Date of birth:' | |
1516 | + assert_tag :tag => 'td', :content => 'Date of birth' | |
1491 | 1517 | assert_tag :tag => 'td', :content => 'August 26, 1990' |
1492 | 1518 | end |
1493 | 1519 | |
... | ... | @@ -1500,9 +1526,9 @@ class ProfileControllerTest < ActionController::TestCase |
1500 | 1526 | viewed.save! |
1501 | 1527 | login_as(viewed.identifier) |
1502 | 1528 | get :index, :profile => viewed.identifier |
1503 | - assert_tag :tag => 'td', :content => 'Sex:' | |
1529 | + assert_tag :tag => 'td', :content => 'Sex' | |
1504 | 1530 | assert_tag :tag => 'td', :content => 'Male' |
1505 | - assert_tag :tag => 'td', :content => 'Date of birth:' | |
1531 | + assert_tag :tag => 'td', :content => 'Date of birth' | |
1506 | 1532 | assert_tag :tag => 'td', :content => 'August 26, 1990' |
1507 | 1533 | end |
1508 | 1534 | |
... | ... | @@ -1515,7 +1541,7 @@ class ProfileControllerTest < ActionController::TestCase |
1515 | 1541 | login_as(strange.identifier) |
1516 | 1542 | get :index, :profile => viewed.identifier |
1517 | 1543 | assert_tag :tag => 'th', :content => 'Contact' |
1518 | - assert_tag :tag => 'td', :content => 'e-Mail:' | |
1544 | + assert_tag :tag => 'td', :content => 'e-Mail' | |
1519 | 1545 | end |
1520 | 1546 | |
1521 | 1547 | should 'show contact to friend' do |
... | ... | @@ -1528,7 +1554,7 @@ class ProfileControllerTest < ActionController::TestCase |
1528 | 1554 | login_as(friend.identifier) |
1529 | 1555 | get :index, :profile => viewed.identifier |
1530 | 1556 | assert_tag :tag => 'th', :content => 'Contact' |
1531 | - assert_tag :tag => 'td', :content => 'e-Mail:' | |
1557 | + assert_tag :tag => 'td', :content => 'e-Mail' | |
1532 | 1558 | end |
1533 | 1559 | |
1534 | 1560 | should 'show contact to self' do |
... | ... | @@ -1539,7 +1565,7 @@ class ProfileControllerTest < ActionController::TestCase |
1539 | 1565 | login_as(viewed.identifier) |
1540 | 1566 | get :index, :profile => viewed.identifier |
1541 | 1567 | assert_tag :tag => 'th', :content => 'Contact' |
1542 | - assert_tag :tag => 'td', :content => 'e-Mail:' | |
1568 | + assert_tag :tag => 'td', :content => 'e-Mail' | |
1543 | 1569 | end |
1544 | 1570 | |
1545 | 1571 | should 'not show contact to non friend' do |
... | ... | @@ -1551,7 +1577,7 @@ class ProfileControllerTest < ActionController::TestCase |
1551 | 1577 | login_as(strange.identifier) |
1552 | 1578 | get :index, :profile => viewed.identifier |
1553 | 1579 | assert_no_tag :tag => 'th', :content => 'Contact' |
1554 | - assert_no_tag :tag => 'td', :content => 'e-Mail:' | |
1580 | + assert_no_tag :tag => 'td', :content => 'e-Mail' | |
1555 | 1581 | end |
1556 | 1582 | |
1557 | 1583 | should 'show contact to friend even if private' do |
... | ... | @@ -1564,7 +1590,7 @@ class ProfileControllerTest < ActionController::TestCase |
1564 | 1590 | login_as(friend.identifier) |
1565 | 1591 | get :index, :profile => viewed.identifier |
1566 | 1592 | assert_tag :tag => 'th', :content => 'Contact' |
1567 | - assert_tag :tag => 'td', :content => 'e-Mail:' | |
1593 | + assert_tag :tag => 'td', :content => 'e-Mail' | |
1568 | 1594 | end |
1569 | 1595 | |
1570 | 1596 | should 'show contact to self even if private' do |
... | ... | @@ -1575,7 +1601,7 @@ class ProfileControllerTest < ActionController::TestCase |
1575 | 1601 | login_as(viewed.identifier) |
1576 | 1602 | get :index, :profile => viewed.identifier |
1577 | 1603 | assert_tag :tag => 'th', :content => 'Contact' |
1578 | - assert_tag :tag => 'td', :content => 'e-Mail:' | |
1604 | + assert_tag :tag => 'td', :content => 'e-Mail' | |
1579 | 1605 | end |
1580 | 1606 | |
1581 | 1607 | should 'not display list of communities to manage on menu by default' do |
... | ... | @@ -1683,22 +1709,28 @@ class ProfileControllerTest < ActionController::TestCase |
1683 | 1709 | |
1684 | 1710 | should 'show enterprises field if enterprises are enabled on environment' do |
1685 | 1711 | person = fast_create(Person) |
1712 | + enterprise = fast_create(Enterprise) | |
1713 | + enterprise.add_admin person | |
1686 | 1714 | environment = person.environment |
1687 | 1715 | environment.disable('disable_asset_enterprises') |
1688 | 1716 | environment.save! |
1689 | 1717 | |
1690 | 1718 | get :index, :profile => person.identifier |
1691 | - assert_tag :tag => 'tr', :attributes => { :id => "person-profile-network-enterprises" } | |
1719 | + assert_tag :tag => 'td', :content => 'Enterprises' | |
1720 | + assert_tag :tag => 'td', :descendant => { :tag => 'a', :content => /#{person.enterprises.count}/, :attributes => { :href => /profile\/#{person.identifier}\/enterprises$/ }} | |
1692 | 1721 | end |
1693 | 1722 | |
1694 | 1723 | should 'not show enterprises field if enterprises are disabled on environment' do |
1695 | 1724 | person = fast_create(Person) |
1725 | + enterprise = fast_create(Enterprise) | |
1726 | + enterprise.add_admin person | |
1696 | 1727 | environment = person.environment |
1697 | 1728 | environment.enable('disable_asset_enterprises') |
1698 | 1729 | environment.save! |
1699 | 1730 | |
1700 | 1731 | get :index, :profile => person.identifier |
1701 | - assert_no_tag :tag => 'tr', :attributes => { :id => "person-profile-network-enterprises" } | |
1732 | + assert_no_tag :tag => 'td', :content => 'Enterprises' | |
1733 | + assert_no_tag :tag => 'td', :descendant => { :tag => 'a', :content => /#{person.enterprises.count}/, :attributes => { :href => /profile\/#{person.identifier}\/enterprises$/ }} | |
1702 | 1734 | end |
1703 | 1735 | |
1704 | 1736 | end | ... | ... |
test/unit/profile_helper_test.rb
... | ... | @@ -17,45 +17,55 @@ class ProfileHelperTest < ActiveSupport::TestCase |
17 | 17 | self.stubs(:user).returns(nil) |
18 | 18 | profile.expects(:may_display_field_to?).returns(true) |
19 | 19 | profile.expects(:field).returns('value') |
20 | - assert_match /Title.*value/, display_field('Title', profile, 'field') | |
20 | + expects(:title).with(:field, anything).returns('Title') | |
21 | + assert_match /Title.*value/, display_field(:field) | |
21 | 22 | end |
22 | 23 | |
23 | 24 | should 'not display field if may not display it and not forced' do |
24 | 25 | self.stubs(:user).returns(nil) |
25 | 26 | profile.expects(:may_display_field_to?).returns(false) |
26 | - assert_equal '', display_field('Title', profile, 'field') | |
27 | + profile.expects(:field).never | |
28 | + assert_equal '', display_field(:field) | |
27 | 29 | end |
28 | 30 | |
29 | 31 | should 'display field if may not display it but is forced' do |
30 | 32 | self.stubs(:user).returns(nil) |
31 | 33 | profile.stubs(:may_display_field_to?).returns(false) |
34 | + profile.stubs(:kind_of?).with(Person).returns(:person) | |
35 | + FORCE.merge!({:person => [:field]}) | |
32 | 36 | profile.expects(:field).returns('value') |
33 | - assert_match /Title.*value/, display_field('Title', profile, 'field', true) | |
37 | + expects(:title).with(:field, anything).returns('Title') | |
38 | + assert_match /Title.*value/, display_field(:field) | |
34 | 39 | end |
35 | 40 | |
36 | 41 | should 'display work info if at least one of the fields should be displayed' do |
37 | 42 | self.stubs(:user).returns(nil) |
38 | 43 | profile.stubs(:may_display_field_to?).with(:organization, nil).returns(true) |
39 | 44 | profile.stubs(:may_display_field_to?).with(:organization_website, nil).returns(false) |
45 | + profile.stubs(:may_display_field_to?).with(:professional_activity, nil).returns(false) | |
46 | + profile.stubs(:kind_of?).with(Person).returns(:person) | |
40 | 47 | profile.expects(:organization).returns('Organization Name') |
41 | 48 | profile.expects(:organization_website).never |
42 | - assert_match /Work.*Organization Name/, display_work_info(profile) | |
49 | + profile.expects(:professional_activity).never | |
50 | + assert_match /Work.*Organization Name/, display_work | |
43 | 51 | end |
44 | 52 | |
45 | 53 | should 'not display work info if none of the fields should be displayed' do |
46 | 54 | self.stubs(:user).returns(nil) |
47 | 55 | profile.stubs(:may_display_field_to?).returns(false) |
56 | + profile.stubs(:kind_of?).with(Person).returns(:person) | |
48 | 57 | profile.expects(:organization).never |
49 | 58 | profile.expects(:organization_website).never |
50 | - assert_equal '', display_work_info(profile) | |
59 | + assert_equal '', display_work | |
51 | 60 | end |
52 | 61 | |
53 | 62 | should 'display work info if both fields should be displayed' do |
54 | 63 | self.stubs(:user).returns(nil) |
55 | 64 | profile.stubs(:may_display_field_to?).returns(true) |
65 | + profile.stubs(:kind_of?).with(Person).returns(:person) | |
56 | 66 | profile.expects(:organization).returns('Organization Name') |
57 | 67 | profile.expects(:organization_website).returns('') |
58 | - assert_match /Work.*Organization Name/, display_work_info(profile) | |
68 | + assert_match /Work.*Organization Name/, display_work | |
59 | 69 | end |
60 | 70 | |
61 | 71 | end | ... | ... |