Commit 20741341899a795b90d2587468080cb27f68ebb2
1 parent
ac389ef8
Exists in
master
and in
22 other branches
Produce strings considered unsafe for testing
Showing
2 changed files
with
8 additions
and
2 deletions
Show diff stats
test/test_helper.rb
@@ -209,6 +209,12 @@ class ActiveSupport::TestCase | @@ -209,6 +209,12 @@ class ActiveSupport::TestCase | ||
209 | Noosfero::MultiTenancy.stubs(:on?).returns(false) | 209 | Noosfero::MultiTenancy.stubs(:on?).returns(false) |
210 | end | 210 | end |
211 | 211 | ||
212 | + def unsafe(string) | ||
213 | + ret = ActiveSupport::SafeBuffer.new(string) | ||
214 | + ret.instance_eval { @html_safe = false } | ||
215 | + ret | ||
216 | + end | ||
217 | + | ||
212 | end | 218 | end |
213 | 219 | ||
214 | module NoosferoTestHelper | 220 | module NoosferoTestHelper |
test/unit/block_helper_test.rb
@@ -6,8 +6,8 @@ class BlogHelperTest < ActiveSupport::TestCase | @@ -6,8 +6,8 @@ class BlogHelperTest < ActiveSupport::TestCase | ||
6 | include ActionView::Helpers::TagHelper | 6 | include ActionView::Helpers::TagHelper |
7 | 7 | ||
8 | should 'escape title html' do | 8 | should 'escape title html' do |
9 | - assert_no_match /<b>/, block_title('<b>test</b>') | ||
10 | - assert_match /<b>test<\/b>/, block_title('<b>test</b>') | 9 | + assert_no_match /<b>/, block_title(unsafe('<b>test</b>')) |
10 | + assert_match /<b>test<\/b>/, block_title(unsafe('<b>test</b>')) | ||
11 | end | 11 | end |
12 | 12 | ||
13 | end | 13 | end |