Commit b74b1e3275a25fc3ff5179ddb8b08d55c91509ed

Authored by AntonioTerceiro
1 parent f01fa9bc

ActionItem139: adding new implementation of "profile info" block


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1310 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/models/profile_info_block.rb 0 → 100644
... ... @@ -0,0 +1,14 @@
  1 +class ProfileInfoBlock < Block
  2 +
  3 + def self.description
  4 + _('Profile information block')
  5 + end
  6 +
  7 + def content
  8 + user = owner
  9 + lambda do
  10 + render :file => 'account/user_info', :locals => { :user => user }
  11 + end
  12 + end
  13 +
  14 +end
... ...
app/views/blocks/profile_info.rhtml 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +<h2><%= block.owner.name %></h2>
  2 +
  3 +<ul>
  4 + <li><%= _('Since %d') % block.owner.created_at.year %></li>
  5 + <li><%= link_to_homepage _('Homepage'), block.owner.url %></li>
  6 +</ul>
  7 +
... ...
test/unit/profile_info_block_test.rb 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +require File.dirname(__FILE__) + '/../test_helper'
  2 +
  3 +class ProfileInfoBlockTest < Test::Unit::TestCase
  4 +
  5 + def setup
  6 + @profile = create_user('mytestuser').person
  7 +
  8 + @block = ProfileInfoBlock.new
  9 + @profile.boxes.first.blocks << @block
  10 +
  11 + @block.save!
  12 + end
  13 + attr_reader :block, :profile
  14 +
  15 + should 'provide description' do
  16 + assert_not_equal Block.description, ProfileInfoBlock.description
  17 + end
  18 +
  19 + should 'display profile information' do
  20 + self.expects(:render).with(:file => 'blocks/profile_info', :locals => { :block => block})
  21 + instance_eval(& block.content)
  22 + end
  23 +
  24 +end
... ...