Commit fe8de99e90ab7bdb048047da236b74de57622c72
1 parent
11637395
Exists in
master
and in
29 other branches
ActionItem629: Debian etch porting
in ruby 1.8.6 Array and Hash don't not have a method 'count'. Using 'size' intead git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2375 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
9 additions
and
9 deletions
Show diff stats
app/models/my_network_block.rb
@@ -14,10 +14,10 @@ class MyNetworkBlock < Block | @@ -14,10 +14,10 @@ class MyNetworkBlock < Block | ||
14 | block_title(title) + | 14 | block_title(title) + |
15 | content_tag( | 15 | content_tag( |
16 | 'ul', | 16 | 'ul', |
17 | - content_tag('li', link_to(n_( 'One article published', '%d articles published', owner.articles.count) % owner.articles.count, owner.public_profile_url.merge(:action => 'sitemap') )) + | ||
18 | - content_tag('li', link_to(n__('One friend', '%d friends', owner.friends.count) % owner.friends.count, owner.public_profile_url.merge(:action => 'friends'))) + | ||
19 | - content_tag('li', link_to(n__('One community', '%d communities', owner.communities.count) % owner.communities.count, owner.public_profile_url.merge(:action => 'communities'))) + | ||
20 | - content_tag('li', link_to(n_('One tag', '%d tags', owner.tags.count) % owner.tags.count, owner.public_profile_url.merge(:action => 'tags'))) | 17 | + content_tag('li', link_to(n_( 'One article published', '%d articles published', owner.articles.size) % owner.articles.size, owner.public_profile_url.merge(:action => 'sitemap') )) + |
18 | + content_tag('li', link_to(n__('One friend', '%d friends', owner.friends.size) % owner.friends.size, owner.public_profile_url.merge(:action => 'friends'))) + | ||
19 | + content_tag('li', link_to(n__('One community', '%d communities', owner.communities.size) % owner.communities.size, owner.public_profile_url.merge(:action => 'communities'))) + | ||
20 | + content_tag('li', link_to(n_('One tag', '%d tags', owner.tags.size) % owner.tags.size, owner.public_profile_url.merge(:action => 'tags'))) | ||
21 | ) | 21 | ) |
22 | end | 22 | end |
23 | 23 |
test/unit/my_network_block_test.rb
@@ -23,7 +23,7 @@ class MyNetworkBlockTest < ActiveSupport::TestCase | @@ -23,7 +23,7 @@ class MyNetworkBlockTest < ActiveSupport::TestCase | ||
23 | mock_articles = mock | 23 | mock_articles = mock |
24 | owner.stubs(:articles).returns(mock_articles) | 24 | owner.stubs(:articles).returns(mock_articles) |
25 | owner.stubs(:tags).returns({}) # don't let tags call articles | 25 | owner.stubs(:tags).returns({}) # don't let tags call articles |
26 | - mock_articles.stubs(:count).returns(5) | 26 | + mock_articles.stubs(:size).returns(5) |
27 | 27 | ||
28 | assert_tag_in_string block.content, :tag => 'li', :descendant => { :tag => 'a', :content => '5 articles published', :attributes => { :href => /\/profile\/testuser\/sitemap$/ } } | 28 | assert_tag_in_string block.content, :tag => 'li', :descendant => { :tag => 'a', :content => '5 articles published', :attributes => { :href => /\/profile\/testuser\/sitemap$/ } } |
29 | end | 29 | end |
@@ -31,7 +31,7 @@ class MyNetworkBlockTest < ActiveSupport::TestCase | @@ -31,7 +31,7 @@ class MyNetworkBlockTest < ActiveSupport::TestCase | ||
31 | should 'count friends' do | 31 | should 'count friends' do |
32 | mock_friends = mock | 32 | mock_friends = mock |
33 | owner.stubs(:friends).returns(mock_friends) | 33 | owner.stubs(:friends).returns(mock_friends) |
34 | - mock_friends.stubs(:count).returns(8) | 34 | + mock_friends.stubs(:size).returns(8) |
35 | 35 | ||
36 | assert_tag_in_string block.content, :tag => 'li', :descendant => { :tag => 'a', :content => '8 friends', :attributes => { :href => /\profile\/testuser\/friends/ }} | 36 | assert_tag_in_string block.content, :tag => 'li', :descendant => { :tag => 'a', :content => '8 friends', :attributes => { :href => /\profile\/testuser\/friends/ }} |
37 | end | 37 | end |
@@ -39,7 +39,7 @@ class MyNetworkBlockTest < ActiveSupport::TestCase | @@ -39,7 +39,7 @@ class MyNetworkBlockTest < ActiveSupport::TestCase | ||
39 | should 'count communities' do | 39 | should 'count communities' do |
40 | mock_communities = mock | 40 | mock_communities = mock |
41 | owner.stubs(:communities).returns(mock_communities) | 41 | owner.stubs(:communities).returns(mock_communities) |
42 | - mock_communities.stubs(:count).returns(23) | 42 | + mock_communities.stubs(:size).returns(23) |
43 | 43 | ||
44 | assert_tag_in_string block.content, :tag => 'li', :descendant => { :tag => 'a', :content => '23 communities', :attributes => { :href => /\profile\/testuser\/communities/ }} | 44 | assert_tag_in_string block.content, :tag => 'li', :descendant => { :tag => 'a', :content => '23 communities', :attributes => { :href => /\profile\/testuser\/communities/ }} |
45 | end | 45 | end |
@@ -47,7 +47,7 @@ class MyNetworkBlockTest < ActiveSupport::TestCase | @@ -47,7 +47,7 @@ class MyNetworkBlockTest < ActiveSupport::TestCase | ||
47 | should 'count tags' do | 47 | should 'count tags' do |
48 | mock_tags = mock | 48 | mock_tags = mock |
49 | owner.stubs(:tags).returns(mock_tags) | 49 | owner.stubs(:tags).returns(mock_tags) |
50 | - mock_tags.stubs(:count).returns(436) | 50 | + mock_tags.stubs(:size).returns(436) |
51 | 51 | ||
52 | assert_tag_in_string block.content, :tag => 'li', :descendant => { :tag => 'a', :content => '436 tags', :attributes => { :href => /\profile\/testuser\/tags/ }} | 52 | assert_tag_in_string block.content, :tag => 'li', :descendant => { :tag => 'a', :content => '436 tags', :attributes => { :href => /\profile\/testuser\/tags/ }} |
53 | end | 53 | end |
test/unit/profile_test.rb
@@ -318,7 +318,7 @@ class ProfileTest < Test::Unit::TestCase | @@ -318,7 +318,7 @@ class ProfileTest < Test::Unit::TestCase | ||
318 | end | 318 | end |
319 | 319 | ||
320 | should 'provide tag count' do | 320 | should 'provide tag count' do |
321 | - assert_equal 0, Profile.new.tags.count | 321 | + assert_equal 0, Profile.new.tags.size |
322 | end | 322 | end |
323 | 323 | ||
324 | should 'have administator role' do | 324 | should 'have administator role' do |