Commit 7d54b7ccdfc00db75168014a1639d565da74c349
1 parent
895be993
Exists in
master
and in
29 other branches
ActionItem43: tell wheter a profile has members or not
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1341 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
4 changed files
with
22 additions
and
0 deletions
Show diff stats
app/models/organization.rb
@@ -46,4 +46,11 @@ class Organization < Profile | @@ -46,4 +46,11 @@ class Organization < Profile | ||
46 | organization_info | 46 | organization_info |
47 | end | 47 | end |
48 | 48 | ||
49 | + # Yes, organizations have members. | ||
50 | + # | ||
51 | + # Returns <tt>true</tt>. | ||
52 | + def has_members? | ||
53 | + true | ||
54 | + end | ||
55 | + | ||
49 | end | 56 | end |
app/models/profile.rb
@@ -221,4 +221,11 @@ class Profile < ActiveRecord::Base | @@ -221,4 +221,11 @@ class Profile < ActiveRecord::Base | ||
221 | articles.select {|item| item.tags.map(&:name).include?(tag) } | 221 | articles.select {|item| item.tags.map(&:name).include?(tag) } |
222 | end | 222 | end |
223 | 223 | ||
224 | + # Tells whether a specified profile has members or nor. | ||
225 | + # | ||
226 | + # On this class, returns <tt>false</tt> by default. | ||
227 | + def has_members? | ||
228 | + false | ||
229 | + end | ||
230 | + | ||
224 | end | 231 | end |
test/unit/organization_test.rb
@@ -101,4 +101,8 @@ class OrganizationTest < Test::Unit::TestCase | @@ -101,4 +101,8 @@ class OrganizationTest < Test::Unit::TestCase | ||
101 | assert profile.blocks.size > 0 | 101 | assert profile.blocks.size > 0 |
102 | end | 102 | end |
103 | 103 | ||
104 | + should 'have members' do | ||
105 | + assert_equal true, Organization.new.has_members? | ||
106 | + end | ||
107 | + | ||
104 | end | 108 | end |
test/unit/profile_test.rb
@@ -309,6 +309,10 @@ class ProfileTest < Test::Unit::TestCase | @@ -309,6 +309,10 @@ class ProfileTest < Test::Unit::TestCase | ||
309 | assert_kind_of Role, Profile::Roles.member | 309 | assert_kind_of Role, Profile::Roles.member |
310 | end | 310 | end |
311 | 311 | ||
312 | + should 'not have members by default' do | ||
313 | + assert_equal false, Profile.new.has_members? | ||
314 | + end | ||
315 | + | ||
312 | private | 316 | private |
313 | 317 | ||
314 | def assert_invalid_identifier(id) | 318 | def assert_invalid_identifier(id) |