842 |
842 |
end
|
843 |
843 |
end
|
844 |
844 |
|
|
845 |
def test_wiki_links_with_special_characters_in_project_name
|
|
846 |
User.current = User.find_by_login('jsmith')
|
|
847 |
|
|
848 |
another_project = Project.find(1) # eCookbook
|
|
849 |
another_project.name = "[foo]#{another_project.name}"
|
|
850 |
another_project.save
|
|
851 |
|
|
852 |
page = another_project.wiki.find_page('Another page')
|
|
853 |
page.title = "[bar]#{page.title}"
|
|
854 |
page.save
|
|
855 |
|
|
856 |
to_test = {
|
|
857 |
'[[[foo]eCookbook:]]' =>
|
|
858 |
link_to("[foo]eCookbook",
|
|
859 |
"/projects/ecookbook/wiki",
|
|
860 |
:class => "wiki-page"),
|
|
861 |
'[[[foo]eCookbook:CookBook documentation]]' =>
|
|
862 |
link_to("CookBook documentation",
|
|
863 |
"/projects/ecookbook/wiki/CookBook_documentation",
|
|
864 |
:class => "wiki-page"),
|
|
865 |
'[[[foo]eCookbook:[bar]Another page]]' =>
|
|
866 |
link_to("[bar]Another page",
|
|
867 |
"/projects/ecookbook/wiki/%5Bbar%5DAnother_page",
|
|
868 |
:class => "wiki-page"),
|
|
869 |
'[[[foo]eCookbook:Unknown page]]' =>
|
|
870 |
link_to("Unknown page",
|
|
871 |
"/projects/ecookbook/wiki/Unknown_page",
|
|
872 |
:class => "wiki-page new"),
|
|
873 |
'[[[foo]eCookbook:[baz]Unknown page]]' =>
|
|
874 |
link_to("[baz]Unknown page",
|
|
875 |
"/projects/ecookbook/wiki/%5Bbaz%5DUnknown_page",
|
|
876 |
:class => "wiki-page new"),
|
|
877 |
}
|
|
878 |
@project = Project.find(2) # OnlineStore
|
|
879 |
with_settings :text_formatting => 'textile' do
|
|
880 |
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
|
|
881 |
end
|
|
882 |
with_settings :text_formatting => 'markdown' do
|
|
883 |
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text).strip }
|
|
884 |
end
|
|
885 |
end
|
845 |
886 |
|
846 |
887 |
def test_wiki_links_within_local_file_generation_context
|
847 |
888 |
to_test = {
|
... | ... | |
1784 |
1825 |
link_to("broken > more",
|
1785 |
1826 |
"/projects/ecookbook/wiki/Broken_%3E_more",
|
1786 |
1827 |
:class => "wiki-page new"),
|
|
1828 |
'[[[foo]Including [square brackets] in wiki title]]' =>
|
|
1829 |
link_to("[foo]Including [square brackets] in wiki title",
|
|
1830 |
"/projects/ecookbook/wiki/%5Bfoo%5DIncluding_%5Bsquare_brackets%5D_in_wiki_title",
|
|
1831 |
:class => "wiki-page new"),
|
1787 |
1832 |
}
|
1788 |
1833 |
end
|
1789 |
1834 |
|