##// END OF EJS Templates
remove trailing white-spaces from test/unit/lib/redmine/wiki_formatting/macros_test.rb....
Toshi MARUYAMA -
r6669:69b8497ab8d7
parent child
Show More
@@ -1,16 +1,16
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2008 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -22,9 +22,9 class Redmine::WikiFormatting::MacrosTest < ActionView::TestCase
22 include ActionView::Helpers::TextHelper
22 include ActionView::Helpers::TextHelper
23 include ActionView::Helpers::SanitizeHelper
23 include ActionView::Helpers::SanitizeHelper
24 extend ActionView::Helpers::SanitizeHelper::ClassMethods
24 extend ActionView::Helpers::SanitizeHelper::ClassMethods
25
25
26 fixtures :projects, :roles, :enabled_modules, :users,
26 fixtures :projects, :roles, :enabled_modules, :users,
27 :repositories, :changesets,
27 :repositories, :changesets,
28 :trackers, :issue_statuses, :issues,
28 :trackers, :issue_statuses, :issues,
29 :versions, :documents,
29 :versions, :documents,
30 :wikis, :wiki_pages, :wiki_contents,
30 :wikis, :wiki_pages, :wiki_contents,
@@ -35,10 +35,10 class Redmine::WikiFormatting::MacrosTest < ActionView::TestCase
35 super
35 super
36 @project = nil
36 @project = nil
37 end
37 end
38
38
39 def teardown
39 def teardown
40 end
40 end
41
41
42 def test_macro_hello_world
42 def test_macro_hello_world
43 text = "{{hello_world}}"
43 text = "{{hello_world}}"
44 assert textilizable(text).match(/Hello world!/)
44 assert textilizable(text).match(/Hello world!/)
@@ -46,13 +46,13 class Redmine::WikiFormatting::MacrosTest < ActionView::TestCase
46 text = "!{{hello_world}}"
46 text = "!{{hello_world}}"
47 assert_equal '<p>{{hello_world}}</p>', textilizable(text)
47 assert_equal '<p>{{hello_world}}</p>', textilizable(text)
48 end
48 end
49
49
50 def test_macro_include
50 def test_macro_include
51 @project = Project.find(1)
51 @project = Project.find(1)
52 # include a page of the current project wiki
52 # include a page of the current project wiki
53 text = "{{include(Another page)}}"
53 text = "{{include(Another page)}}"
54 assert textilizable(text).match(/This is a link to a ticket/)
54 assert textilizable(text).match(/This is a link to a ticket/)
55
55
56 @project = nil
56 @project = nil
57 # include a page of a specific project wiki
57 # include a page of a specific project wiki
58 text = "{{include(ecookbook:Another page)}}"
58 text = "{{include(ecookbook:Another page)}}"
@@ -64,23 +64,23 class Redmine::WikiFormatting::MacrosTest < ActionView::TestCase
64 text = "{{include(unknowidentifier:somepage)}}"
64 text = "{{include(unknowidentifier:somepage)}}"
65 assert textilizable(text).match(/Page not found/)
65 assert textilizable(text).match(/Page not found/)
66 end
66 end
67
67
68 def test_macro_child_pages
68 def test_macro_child_pages
69 expected = "<p><ul class=\"pages-hierarchy\">\n" +
69 expected = "<p><ul class=\"pages-hierarchy\">\n" +
70 "<li><a href=\"/projects/ecookbook/wiki/Child_1\">Child 1</a></li>\n" +
70 "<li><a href=\"/projects/ecookbook/wiki/Child_1\">Child 1</a></li>\n" +
71 "<li><a href=\"/projects/ecookbook/wiki/Child_2\">Child 2</a></li>\n" +
71 "<li><a href=\"/projects/ecookbook/wiki/Child_2\">Child 2</a></li>\n" +
72 "</ul>\n</p>"
72 "</ul>\n</p>"
73
73
74 @project = Project.find(1)
74 @project = Project.find(1)
75 # child pages of the current wiki page
75 # child pages of the current wiki page
76 assert_equal expected, textilizable("{{child_pages}}", :object => WikiPage.find(2).content)
76 assert_equal expected, textilizable("{{child_pages}}", :object => WikiPage.find(2).content)
77 # child pages of another page
77 # child pages of another page
78 assert_equal expected, textilizable("{{child_pages(Another_page)}}", :object => WikiPage.find(1).content)
78 assert_equal expected, textilizable("{{child_pages(Another_page)}}", :object => WikiPage.find(1).content)
79
79
80 @project = Project.find(2)
80 @project = Project.find(2)
81 assert_equal expected, textilizable("{{child_pages(ecookbook:Another_page)}}", :object => WikiPage.find(1).content)
81 assert_equal expected, textilizable("{{child_pages(ecookbook:Another_page)}}", :object => WikiPage.find(1).content)
82 end
82 end
83
83
84 def test_macro_child_pages_with_option
84 def test_macro_child_pages_with_option
85 expected = "<p><ul class=\"pages-hierarchy\">\n" +
85 expected = "<p><ul class=\"pages-hierarchy\">\n" +
86 "<li><a href=\"/projects/ecookbook/wiki/Another_page\">Another page</a>\n" +
86 "<li><a href=\"/projects/ecookbook/wiki/Another_page\">Another page</a>\n" +
@@ -88,13 +88,13 class Redmine::WikiFormatting::MacrosTest < ActionView::TestCase
88 "<li><a href=\"/projects/ecookbook/wiki/Child_1\">Child 1</a></li>\n" +
88 "<li><a href=\"/projects/ecookbook/wiki/Child_1\">Child 1</a></li>\n" +
89 "<li><a href=\"/projects/ecookbook/wiki/Child_2\">Child 2</a></li>\n" +
89 "<li><a href=\"/projects/ecookbook/wiki/Child_2\">Child 2</a></li>\n" +
90 "</ul>\n</li>\n</ul>\n</p>"
90 "</ul>\n</li>\n</ul>\n</p>"
91
91
92 @project = Project.find(1)
92 @project = Project.find(1)
93 # child pages of the current wiki page
93 # child pages of the current wiki page
94 assert_equal expected, textilizable("{{child_pages(parent=1)}}", :object => WikiPage.find(2).content)
94 assert_equal expected, textilizable("{{child_pages(parent=1)}}", :object => WikiPage.find(2).content)
95 # child pages of another page
95 # child pages of another page
96 assert_equal expected, textilizable("{{child_pages(Another_page, parent=1)}}", :object => WikiPage.find(1).content)
96 assert_equal expected, textilizable("{{child_pages(Another_page, parent=1)}}", :object => WikiPage.find(1).content)
97
97
98 @project = Project.find(2)
98 @project = Project.find(2)
99 assert_equal expected, textilizable("{{child_pages(ecookbook:Another_page, parent=1)}}", :object => WikiPage.find(1).content)
99 assert_equal expected, textilizable("{{child_pages(ecookbook:Another_page, parent=1)}}", :object => WikiPage.find(1).content)
100 end
100 end
General Comments 0
You need to be logged in to leave comments. Login now