summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-03-12 15:17:53 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-03-12 15:17:53 +0000
commit7adf05810a192107e74348ec24fea0297cb9c026 (patch)
treee69298b2ae39d69d3b9e7515cdb9948283b217fd /test
parent054ff0db8ee77fba9c61f38257be997b6d9ba7a3 (diff)
downloadredmine-7adf05810a192107e74348ec24fea0297cb9c026.tar.gz
redmine-7adf05810a192107e74348ec24fea0297cb9c026.zip
Refactors textile formatting tests.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3568 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb31
1 files changed, 15 insertions, 16 deletions
diff --git a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
index 66e588ffb..e34c273b3 100644
--- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
+++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
@@ -33,7 +33,7 @@ class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase
}
def test_modifiers
- to_test = {
+ assert_html_output(
'*bold*' => '<strong>bold</strong>',
'before *bold*' => 'before <strong>bold</strong>',
'*bold* after' => '<strong>bold</strong> after',
@@ -43,11 +43,8 @@ class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase
'*two* *words*' => '<strong>two</strong> <strong>words</strong>',
'*(two)* *(words)*' => '<strong>(two)</strong> <strong>(words)</strong>',
# with class
- '*(foo)two words*' => '<strong class="foo">two words</strong>',
- }
- to_test.each do |text, expected|
- assert_equal "<p>#{expected}</p>", @formatter.new(text).to_html
- end
+ '*(foo)two words*' => '<strong class="foo">two words</strong>'
+ )
end
def test_modifiers_combination
@@ -56,25 +53,27 @@ class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase
next if m1 == m2
text = "#{m2}#{m1}Phrase modifiers#{m1}#{m2}"
html = "<p><#{tag2}><#{tag1}>Phrase modifiers</#{tag1}></#{tag2}></p>"
- assert_equal html, @formatter.new(text).to_html
+ assert_html_output text => html
end
end
end
def test_inline_code
- to_test = {
+ assert_html_output(
'this is @some code@' => 'this is <code>some code</code>',
- '@<Location /redmine>@' => '<code>&lt;Location /redmine&gt;</code>',
- }
- to_test.each do |text, expected|
- assert_equal "<p>#{expected}</p>", @formatter.new(text).to_html
- end
+ '@<Location /redmine>@' => '<code>&lt;Location /redmine&gt;</code>'
+ )
end
def test_escaping
- to_test = {
- 'this is a <script>' => 'this is a &lt;script&gt;',
- }
+ assert_html_output(
+ 'this is a <script>' => 'this is a &lt;script&gt;'
+ )
+ end
+
+ private
+
+ def assert_html_output(to_test)
to_test.each do |text, expected|
assert_equal "<p>#{expected}</p>", @formatter.new(text).to_html
end