Commit c054d8c62888a2fc0a1f29b86f75bcbab04604b5

Authored by Rodrigo Souto
2 parents b1e9dfaf 1df7a3b9

Merge commit 'refs/merge-requests/299' of git://gitorious.org/noosfero/noosfero …

…into merge-requests/299
app/helpers/block_helper.rb
... ... @@ -3,7 +3,7 @@ module BlockHelper
3 3 def block_title(title)
4 4 tag_class = 'block-title'
5 5 tag_class += ' empty' if title.empty?
6   - content_tag 'h3', content_tag('span', title), :class => tag_class
  6 + content_tag 'h3', content_tag('span', h(title)), :class => tag_class
7 7 end
8 8  
9 9 end
... ...
test/unit/block_helper_test.rb 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +require File.dirname(__FILE__) + '/../test_helper'
  2 +
  3 +class BlogHelperTest < ActiveSupport::TestCase
  4 +
  5 + include BlockHelper
  6 + include ActionView::Helpers::TagHelper
  7 +
  8 + should 'escape title html' do
  9 + assert_no_match /<b>/, block_title('<b>test</b>')
  10 + assert_match /&lt;b&gt;test&lt;\/b&gt;/, block_title('<b>test</b>')
  11 + end
  12 +
  13 +end
... ...