Commit ed6f25a584d060330894dad331d62660ce99a99b

Authored by AntonioTerceiro
1 parent bb6b09d4

ActionItem43: allowing override of the title


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1348 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/models/profile_list_block.rb
... ... @@ -37,10 +37,16 @@ class ProfileListBlock < Block
37 37 Kernel.rand(top)
38 38 end
39 39  
  40 + # the title of the block. Probably will be overriden in subclasses.
  41 + def title
  42 + _('People and Groups')
  43 + end
  44 +
40 45 def content
41 46 profiles = self.profiles
  47 + title = self.title
42 48 lambda do
43   - block_title(_('People and Groups')) +
  49 + block_title(title) +
44 50 profiles.map {|item| content_tag('div', profile_image_link(item)) }.join("\n")
45 51 end
46 52 end
... ...
test/unit/profile_list_block_test.rb
... ... @@ -34,7 +34,6 @@ class ProfileListBlockTest < Test::Unit::TestCase
34 34 self.expects(:profile_image_link).with(person3).once
35 35  
36 36 self.expects(:content_tag).returns('<div></div>').at_least_once
37   - self.expects(:_).returns('text').at_least_once
38 37 self.expects(:block_title).returns('block title').at_least_once
39 38  
40 39 assert_kind_of String, instance_eval(&block.content)
... ... @@ -53,9 +52,9 @@ class ProfileListBlockTest &lt; Test::Unit::TestCase
53 52  
54 53 should 'support non-class finders' do
55 54 block = ProfileListBlock.new
56   - profile = create_user('mytestuser').person
57   - block.expects(:profile_finder).returns(profile.members).once
58   - profile.members.expects(:find).with(is_a(Hash)).once
  55 + finder = mock
  56 + block.expects(:profile_finder).returns(finder).once
  57 + finder.expects(:find).with(is_a(Hash)).once
59 58 block.profiles
60 59 end
61 60  
... ...