Commit 20741341899a795b90d2587468080cb27f68ebb2
1 parent
ac389ef8
Exists in
master
and in
29 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 | 209 | Noosfero::MultiTenancy.stubs(:on?).returns(false) |
| 210 | 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 | 218 | end |
| 213 | 219 | |
| 214 | 220 | module NoosferoTestHelper | ... | ... |
test/unit/block_helper_test.rb
| ... | ... | @@ -6,8 +6,8 @@ class BlogHelperTest < ActiveSupport::TestCase |
| 6 | 6 | include ActionView::Helpers::TagHelper |
| 7 | 7 | |
| 8 | 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 | 11 | end |
| 12 | 12 | |
| 13 | 13 | end | ... | ... |