]> source.dussan.org Git - redmine.git/commitdiff
Rails4: replace hard-coded html with class at ApplicationHelperTest#test_wiki_links_i...
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 5 Feb 2014 04:14:27 +0000 (04:14 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 5 Feb 2014 04:14:27 +0000 (04:14 +0000)
See r12784 comment.

git-svn-id: http://svn.redmine.org/redmine/trunk@12811 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/helpers/application_helper_test.rb

index 1cb72c4359e9f54a23070f18d3f72d8321fcfe3f..4df9087f2784d816596fff9d105d291a172251f9 100644 (file)
@@ -833,13 +833,15 @@ EXPECTED
   end
 
   def test_wiki_links_in_tables
-    to_test = {"|[[Page|Link title]]|[[Other Page|Other title]]|\n|Cell 21|[[Last page]]|" =>
-                 '<tr><td><a href="/projects/ecookbook/wiki/Page" class="wiki-page new">Link title</a></td>' +
-                 '<td><a href="/projects/ecookbook/wiki/Other_Page" class="wiki-page new">Other title</a></td>' +
-                 '</tr><tr><td>Cell 21</td><td><a href="/projects/ecookbook/wiki/Last_page" class="wiki-page new">Last page</a></td></tr>'
-    }
+    text = "|[[Page|Link title]]|[[Other Page|Other title]]|\n|Cell 21|[[Last page]]|"
+    link1 = link_to("Link title", "/projects/ecookbook/wiki/Page", :class => "wiki-page new")
+    link2 = link_to("Other title", "/projects/ecookbook/wiki/Other_Page", :class => "wiki-page new")
+    link3 = link_to("Last page", "/projects/ecookbook/wiki/Last_page", :class => "wiki-page new")
+    result = "<tr><td>#{link1}</td>" +
+               "<td>#{link2}</td>" +
+               "</tr><tr><td>Cell 21</td><td>#{link3}</td></tr>"
     @project = Project.find(1)
-    to_test.each { |text, result| assert_equal "<table>#{result}</table>", textilizable(text).gsub(/[\t\n]/, '') }
+    assert_equal "<table>#{result}</table>", textilizable(text).gsub(/[\t\n]/, '')
   end
 
   def test_text_formatting