diff --git a/plugins/profile_members_headlines/lib/profile_members_headlines_block.rb b/plugins/profile_members_headlines/lib/profile_members_headlines_block.rb index c3d6c01..a687dd7 100644 --- a/plugins/profile_members_headlines/lib/profile_members_headlines_block.rb +++ b/plugins/profile_members_headlines/lib/profile_members_headlines_block.rb @@ -35,12 +35,4 @@ class ProfileMembersHeadlinesBlock < Block result.select{ |p| p.has_headline? }.slice(0..limit-1) end - def content(args={}) - block = self - members = authors_list - proc do - render :file => 'blocks/headlines', :locals => { :block => block, :members => members } - end - end - end diff --git a/plugins/profile_members_headlines/test/unit/profile_members_headlines_block_test.rb b/plugins/profile_members_headlines/test/unit/profile_members_headlines_block_test.rb index 6d05d84..96df07c 100644 --- a/plugins/profile_members_headlines/test/unit/profile_members_headlines_block_test.rb +++ b/plugins/profile_members_headlines/test/unit/profile_members_headlines_block_test.rb @@ -1,8 +1,10 @@ require 'test_helper' +require 'boxes_helper' class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase include Noosfero::Plugin::HotSpot + include BoxesHelper def setup @environment = fast_create(Environment) @@ -32,8 +34,8 @@ class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase block = ProfileMembersHeadlinesBlock.create block.stubs(:owner).returns(community) - self.expects(:render).with(:file => 'blocks/headlines', :locals => { :block => block, :members => []}).returns('file-without-authors-and-headlines') - assert_equal 'file-without-authors-and-headlines', instance_eval(&block.content) + self.expects(:render).with(:template => 'blocks/profile_members_headlines', :locals => { :block => block }).returns('file-without-authors-and-headlines') + assert_equal 'file-without-authors-and-headlines', render_block_content(block) end should 'display headlines file' do @@ -41,8 +43,8 @@ class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase block.stubs(:owner).returns(community) blog = fast_create(Blog, :profile_id => member1.id) post = fast_create(TinyMceArticle, :name => 'headlines', :profile_id => member1.id, :parent_id => blog.id) - self.expects(:render).with(:file => 'blocks/headlines', :locals => { :block => block, :members => []}).returns('file-with-authors-and-headlines') - assert_equal 'file-with-authors-and-headlines', instance_eval(&block.content) + self.expects(:render).with(:template => 'blocks/profile_members_headlines', :locals => { :block => block }).returns('file-with-authors-and-headlines') + assert_equal 'file-with-authors-and-headlines', render_block_content(block) end should 'select only authors with articles and selected roles to display' do diff --git a/plugins/profile_members_headlines/views/blocks/headlines.html.erb b/plugins/profile_members_headlines/views/blocks/headlines.html.erb deleted file mode 100644 index 342f5bf..0000000 --- a/plugins/profile_members_headlines/views/blocks/headlines.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -<%= block_title(block.title, block.subtitle) %> - -<% unless members.empty? %> -