diff --git a/app/views/blocks/article.html.erb b/app/views/blocks/article.html.erb index 78e8524..1e16825 100644 --- a/app/views/blocks/article.html.erb +++ b/app/views/blocks/article.html.erb @@ -1,11 +1,11 @@ <%= block_title(block.title) %> <% if block.article %> - <%=h - article_to_html(FilePresenter.for(block.article), + <%= + h(article_to_html(FilePresenter.for(block.article), :gallery_view => false, :inside_block => block, # For Blogs and folders :format => block.visualization_format # For Articles and contents - ) + )) %> <% else %> <%= _('Article not selected yet.') %> diff --git a/test/unit/article_block_test.rb b/test/unit/article_block_test.rb index d76eeae..aaa9072 100644 --- a/test/unit/article_block_test.rb +++ b/test/unit/article_block_test.rb @@ -7,15 +7,6 @@ class ArticleBlockTest < ActiveSupport::TestCase assert_not_equal Block.description, ArticleBlock.description end - should "take article's content" do - block = ArticleBlock.new - article = mock - article.expects(:to_html).returns("Article content") - block.stubs(:article).returns(article) - - assert_match(/Article content/, instance_eval(&block.content)) - end - should 'refer to an article' do profile = create_user('testuser').person article = profile.articles.build(:name => 'test article') @@ -85,6 +76,30 @@ class ArticleBlockTest < ActiveSupport::TestCase assert_equal [a],block.available_articles end + protected + include NoosferoTestHelper + +end + +require 'boxes_helper' +require 'block_helper' + +class ArticleBlockViewTest < ActionView::TestCase + include BoxesHelper + + ActionView::Base.send :include, ApplicationHelper + ActionView::Base.send :include, BlockHelper + + should "take article's content" do + block = ArticleBlock.new + article = mock + article.expects(:to_html).returns("Article content") + block.stubs(:article).returns(article) + ActionView::Base.any_instance.stubs(:block_title).returns("") + + assert_match(/Article content/, render_block_content(block)) + end + should "display empty title if title is blank" do block = ArticleBlock.new article = mock @@ -92,7 +107,7 @@ class ArticleBlockTest < ActiveSupport::TestCase block.expects(:title).returns('') block.stubs(:article).returns(article) - assert_equal "