obsolete.ChilliProject/test/unit/lib/redmine/wiki_formatting/macros_test.rb

96 lines
3.5 KiB
Ruby
Raw Normal View History

2011-10-29 16:19:11 +04:00
#-- encoding: UTF-8
#-- copyright
# ChiliProject is a project management system.
2011-05-30 22:52:25 +04:00
#
# Copyright (C) 2010-2012 the ChiliProject Team
2011-05-30 22:52:25 +04:00
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
2011-05-30 22:52:25 +04:00
#
# See doc/COPYRIGHT.rdoc for more details.
#++
require File.expand_path('../../../../../test_helper', __FILE__)
class Redmine::WikiFormatting::MacrosTest < HelperTestCase
include ApplicationHelper
include ActionView::Helpers::TextHelper
include ActionView::Helpers::SanitizeHelper
extend ActionView::Helpers::SanitizeHelper::ClassMethods
2011-05-30 22:52:25 +04:00
fixtures :projects, :roles, :enabled_modules, :users,
2011-05-30 22:52:25 +04:00
:repositories, :changesets,
:trackers, :issue_statuses, :issues,
:versions, :documents,
:wikis, :wiki_pages, :wiki_contents,
:boards, :messages,
:attachments
def setup
super
@project = nil
end
2011-05-30 22:52:25 +04:00
def teardown
end
2011-05-30 22:52:25 +04:00
def test_macro_hello_world
text = "{{hello_world}}"
assert textilizable(text).match(/Hello world!/)
end
2011-05-30 22:52:25 +04:00
def test_macro_include
@project = Project.find(1)
# include a page of the current project wiki
text = "{{include(Another page)}}"
assert textilizable(text).match(/This is a link to a ticket/)
2011-05-30 22:52:25 +04:00
@project = nil
# include a page of a specific project wiki
text = "{{include(ecookbook:Another page)}}"
assert textilizable(text).match(/This is a link to a ticket/)
text = "{{include(ecookbook:)}}"
assert textilizable(text).match(/CookBook documentation/)
text = "{{include(unknowidentifier:somepage)}}"
assert textilizable(text).match(/No such page/)
end
2011-05-30 22:52:25 +04:00
def test_macro_child_pages
expected = "<p><ul class=\"pages-hierarchy\">\n" +
Converted routing and urls to follow the Rails REST convention. Patch supplied by commits from Gerrit Kaiser on Github. Existing routes will still work (backwards compatible) but any new urls will be generated using the new routing rules. Changes listed below: * made the URLs for some project tabs and project settings follow the new rails RESTful conventions of /collection/:id/subcollection/:sub_id * prettier URL for project roadmap * more nice project URLs * use GET for filtering form * prettified URLs used on issues tab * custom route for activity atom feeds * prettier repository urls * fixed broken route definition * fixed failing tests for issuecontroller that were hardcoding the url string * more RESTful routes for boards and messages * RESTful routes for wiki pages * RESTful routes for documents * moved old routes that are retained for compatibility to the bottom and grouped them together * added RESTful URIs for issues * RESTfulness for the news section * fixed route order * changed hardcoded URLs in tests * fixed badly written tests * fixed forgotten parameter in routes * changed hardcoded URLS to new scheme * changed project add url to the standard POST to collection * create new issue by POSTing to collection * changed hardcoded URLs in integrations tests * made project add form work again * restful routes for project deletion * prettier routes for project (un)archival * made routes table more readable * fixed note quoting * user routing * fixed bug * always sort by GET * Fixed: cross-project issue list should not show issues of projects for which the issue tracking module was disabled. * prettified URLs used on issues tab * urls for time log * fixed reply routing * eliminate revision query paremeter for diff and entry actions * fixed test failures with hard-coded urls * ensure ajax links always use get * refactored ajax link generation into separate method #1901 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2317 e93f8b46-1217-0410-a6f0-8f06a7374b81
2009-01-26 04:47:51 +03:00
"<li><a href=\"/projects/ecookbook/wiki/Child_1\">Child 1</a></li>\n" +
"<li><a href=\"/projects/ecookbook/wiki/Child_2\">Child 2</a></li>\n" +
"</ul>\n</p>"
2011-05-30 22:52:25 +04:00
@project = Project.find(1)
# child pages of the current wiki page
assert_equal expected, textilizable("{{child_pages}}", :object => WikiPage.find(2).content)
# child pages of another page
assert_equal expected, textilizable("{{child_pages(Another_page)}}", :object => WikiPage.find(1).content)
2011-05-30 22:52:25 +04:00
@project = Project.find(2)
assert_equal expected, textilizable("{{child_pages(ecookbook:Another_page)}}", :object => WikiPage.find(1).content)
end
2011-05-30 22:52:25 +04:00
def test_macro_child_pages_with_option
expected = "<p><ul class=\"pages-hierarchy\">\n" +
Converted routing and urls to follow the Rails REST convention. Patch supplied by commits from Gerrit Kaiser on Github. Existing routes will still work (backwards compatible) but any new urls will be generated using the new routing rules. Changes listed below: * made the URLs for some project tabs and project settings follow the new rails RESTful conventions of /collection/:id/subcollection/:sub_id * prettier URL for project roadmap * more nice project URLs * use GET for filtering form * prettified URLs used on issues tab * custom route for activity atom feeds * prettier repository urls * fixed broken route definition * fixed failing tests for issuecontroller that were hardcoding the url string * more RESTful routes for boards and messages * RESTful routes for wiki pages * RESTful routes for documents * moved old routes that are retained for compatibility to the bottom and grouped them together * added RESTful URIs for issues * RESTfulness for the news section * fixed route order * changed hardcoded URLs in tests * fixed badly written tests * fixed forgotten parameter in routes * changed hardcoded URLS to new scheme * changed project add url to the standard POST to collection * create new issue by POSTing to collection * changed hardcoded URLs in integrations tests * made project add form work again * restful routes for project deletion * prettier routes for project (un)archival * made routes table more readable * fixed note quoting * user routing * fixed bug * always sort by GET * Fixed: cross-project issue list should not show issues of projects for which the issue tracking module was disabled. * prettified URLs used on issues tab * urls for time log * fixed reply routing * eliminate revision query paremeter for diff and entry actions * fixed test failures with hard-coded urls * ensure ajax links always use get * refactored ajax link generation into separate method #1901 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2317 e93f8b46-1217-0410-a6f0-8f06a7374b81
2009-01-26 04:47:51 +03:00
"<li><a href=\"/projects/ecookbook/wiki/Another_page\">Another page</a>\n" +
"<ul class=\"pages-hierarchy\">\n" +
Converted routing and urls to follow the Rails REST convention. Patch supplied by commits from Gerrit Kaiser on Github. Existing routes will still work (backwards compatible) but any new urls will be generated using the new routing rules. Changes listed below: * made the URLs for some project tabs and project settings follow the new rails RESTful conventions of /collection/:id/subcollection/:sub_id * prettier URL for project roadmap * more nice project URLs * use GET for filtering form * prettified URLs used on issues tab * custom route for activity atom feeds * prettier repository urls * fixed broken route definition * fixed failing tests for issuecontroller that were hardcoding the url string * more RESTful routes for boards and messages * RESTful routes for wiki pages * RESTful routes for documents * moved old routes that are retained for compatibility to the bottom and grouped them together * added RESTful URIs for issues * RESTfulness for the news section * fixed route order * changed hardcoded URLs in tests * fixed badly written tests * fixed forgotten parameter in routes * changed hardcoded URLS to new scheme * changed project add url to the standard POST to collection * create new issue by POSTing to collection * changed hardcoded URLs in integrations tests * made project add form work again * restful routes for project deletion * prettier routes for project (un)archival * made routes table more readable * fixed note quoting * user routing * fixed bug * always sort by GET * Fixed: cross-project issue list should not show issues of projects for which the issue tracking module was disabled. * prettified URLs used on issues tab * urls for time log * fixed reply routing * eliminate revision query paremeter for diff and entry actions * fixed test failures with hard-coded urls * ensure ajax links always use get * refactored ajax link generation into separate method #1901 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2317 e93f8b46-1217-0410-a6f0-8f06a7374b81
2009-01-26 04:47:51 +03:00
"<li><a href=\"/projects/ecookbook/wiki/Child_1\">Child 1</a></li>\n" +
"<li><a href=\"/projects/ecookbook/wiki/Child_2\">Child 2</a></li>\n" +
"</ul>\n</li>\n</ul>\n</p>"
2011-05-30 22:52:25 +04:00
@project = Project.find(1)
# child pages of the current wiki page
assert_equal expected, textilizable("{{child_pages(parent=1)}}", :object => WikiPage.find(2).content)
# child pages of another page
assert_equal expected, textilizable("{{child_pages(Another_page, parent=1)}}", :object => WikiPage.find(1).content)
2011-05-30 22:52:25 +04:00
@project = Project.find(2)
assert_equal expected, textilizable("{{child_pages(ecookbook:Another_page, parent=1)}}", :object => WikiPage.find(1).content)
end
end