summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/wiki_controller_test.rb7
-rw-r--r--test/unit/wiki_test.rb33
2 files changed, 35 insertions, 5 deletions
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb
index 397018f54..9303d23fe 100644
--- a/test/functional/wiki_controller_test.rb
+++ b/test/functional/wiki_controller_test.rb
@@ -55,6 +55,13 @@ class WikiControllerTest < ActionController::TestCase
:alt => 'This is a logo' }
end
+ def test_show_redirected_page
+ WikiRedirect.create!(:wiki_id => 1, :title => 'Old_title', :redirects_to => 'Another_page')
+
+ get :show, :project_id => 'ecookbook', :id => 'Old_title'
+ assert_redirected_to '/projects/ecookbook/wiki/Another_page'
+ end
+
def test_show_with_sidebar
page = Project.find(1).wiki.pages.new(:title => 'Sidebar')
page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar')
diff --git a/test/unit/wiki_test.rb b/test/unit/wiki_test.rb
index 10c00820c..b248a7e7a 100644
--- a/test/unit/wiki_test.rb
+++ b/test/unit/wiki_test.rb
@@ -1,7 +1,7 @@
# encoding: utf-8
#
-# redMine - project management software
-# Copyright (C) 2006-2007 Jean-Philippe Lang
+# Redmine - project management software
+# Copyright (C) 2006-2011 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -39,21 +39,44 @@ class WikiTest < ActiveSupport::TestCase
assert_equal "Another start page", @wiki.start_page
end
- def test_find_page
+ def test_find_page_should_not_be_case_sensitive
wiki = Wiki.find(1)
page = WikiPage.find(2)
assert_equal page, wiki.find_page('Another_page')
assert_equal page, wiki.find_page('Another page')
assert_equal page, wiki.find_page('ANOTHER page')
-
+ end
+
+ def test_find_page_with_cyrillic_characters
+ wiki = Wiki.find(1)
page = WikiPage.find(10)
assert_equal page, wiki.find_page('Этика_менеджмента')
-
+ end
+
+ def test_find_page_with_backslashes
+ wiki = Wiki.find(1)
page = WikiPage.generate!(:wiki => wiki, :title => '2009\\02\\09')
assert_equal page, wiki.find_page('2009\\02\\09')
end
+ def test_find_page_without_redirect
+ wiki = Wiki.find(1)
+ page = wiki.find_page('Another_page')
+ assert_not_nil page
+ assert_equal 'Another_page', page.title
+ assert_equal false, wiki.page_found_with_redirect?
+ end
+
+ def test_find_page_with_redirect
+ wiki = Wiki.find(1)
+ WikiRedirect.create!(:wiki => wiki, :title => 'Old_title', :redirects_to => 'Another_page')
+ page = wiki.find_page('Old_title')
+ assert_not_nil page
+ assert_equal 'Another_page', page.title
+ assert_equal true, wiki.page_found_with_redirect?
+ end
+
def test_titleize
assert_equal 'Page_title_with_CAPITALES', Wiki.titleize('page title with CAPITALES')
assert_equal 'テスト', Wiki.titleize('テスト')