From 7513eb463106beaae763e72305f2da6bc7eb3893 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Thu, 21 Nov 2013 10:45:42 -0300 Subject: [PATCH] Add alias to profile at context content block --- plugins/context_content/lib/context_content_block.rb | 3 ++- plugins/context_content/test/unit/context_content_block_test.rb | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/context_content/lib/context_content_block.rb b/plugins/context_content/lib/context_content_block.rb index ce2ca40..685fc6a 100644 --- a/plugins/context_content/lib/context_content_block.rb +++ b/plugins/context_content/lib/context_content_block.rb @@ -4,9 +4,10 @@ class ContextContentBlock < Block settings_items :show_image, :type => :boolean, :default => true settings_items :show_parent_content, :type => :boolean, :default => true settings_items :types, :type => Array, :default => ['UploadedFile'] - settings_items :limit, :type => :integer, :default => 6 + alias :profile :owner + include Noosfero::Plugin::HotSpot def self.description diff --git a/plugins/context_content/test/unit/context_content_block_test.rb b/plugins/context_content/test/unit/context_content_block_test.rb index a7a439c..e7cc988 100644 --- a/plugins/context_content/test/unit/context_content_block_test.rb +++ b/plugins/context_content/test/unit/context_content_block_test.rb @@ -164,4 +164,11 @@ class ContextContentBlockTest < ActiveSupport::TestCase instance_eval(&@block.footer) end + should 'return box owner on profile method call' do + profile = fast_create(Community) + box = Box.create(:owner_type => 'Profile', :owner_id => profile.id) + block = ContextContentBlock.create!(:box => box) + assert_equal profile, block.profile + end + end -- libgit2 0.21.2