diff --git a/test/test_helper.rb b/test/test_helper.rb index 699bdc6..8da1a67 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -193,6 +193,18 @@ class Test::Unit::TestCase assert !text.index('<'), "Text '#{text}' expected to be sanitized" end + def assert_tag_in_string(text, options) + doc = HTML::Document.new(text, false, false) + tag = doc.find(options) + assert tag, "expected tag #{options.inspect}, but not found in #{text.inspect}" + end + + def assert_no_tag_in_string(text, options) + doc = HTML::Document.new(text, false, false) + tag = doc.find(options) + assert !tag, "expected no tag #{options.inspect}, but tag found in #{text.inspect}" + end + private def uses_host(name) diff --git a/test/unit/event_test.rb b/test/unit/event_test.rb index 8932b9d..58e99e8 100644 --- a/test/unit/event_test.rb +++ b/test/unit/event_test.rb @@ -163,18 +163,4 @@ class EventTest < ActiveSupport::TestCase assert_no_tag_in_string e.description, :tag => 'script' end - protected - - def assert_tag_in_string(text, options) - doc = HTML::Document.new(text, false, false) - tag = doc.find(options) - assert tag, "expected tag #{options.inspect}, but not found in #{text.inspect}" - end - - def assert_no_tag_in_string(text, options) - doc = HTML::Document.new(text, false, false) - tag = doc.find(options) - assert !tag, "expected no tag #{options.inspect}, but tag found in #{text.inspect}" - end - end -- libgit2 0.21.2