summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-04-29 07:04:23 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-04-29 07:04:23 +0000
commit23e75d87d32a28b9ab5aef7cd80a7980a333bb77 (patch)
treece3aa4c5b495bbc764de714df8a42087e161bcde
parent8a13595c64e8139be06209aea98396d9798c9bef (diff)
downloadredmine-23e75d87d32a28b9ab5aef7cd80a7980a333bb77.tar.gz
redmine-23e75d87d32a28b9ab5aef7cd80a7980a333bb77.zip
Merged r5097 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.1-stable@5569 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/wiki.rb4
-rw-r--r--test/unit/wiki_test.rb5
2 files changed, 6 insertions, 3 deletions
diff --git a/app/models/wiki.rb b/app/models/wiki.rb
index c83bd1922..eb521c99a 100644
--- a/app/models/wiki.rb
+++ b/app/models/wiki.rb
@@ -46,10 +46,10 @@ class Wiki < ActiveRecord::Base
def find_page(title, options = {})
title = start_page if title.blank?
title = Wiki.titleize(title)
- page = pages.first(:conditions => ["LOWER(title) LIKE LOWER(?)", title])
+ page = pages.first(:conditions => ["LOWER(title) = LOWER(?)", title])
if !page && !(options[:with_redirect] == false)
# search for a redirect
- redirect = redirects.first(:conditions => ["LOWER(title) LIKE LOWER(?)", title])
+ redirect = redirects.first(:conditions => ["LOWER(title) = LOWER(?)", title])
page = find_page(redirect.redirects_to, :with_redirect => false) if redirect
end
page
diff --git a/test/unit/wiki_test.rb b/test/unit/wiki_test.rb
index 8fa937c53..10c00820c 100644
--- a/test/unit/wiki_test.rb
+++ b/test/unit/wiki_test.rb
@@ -20,7 +20,7 @@
require File.expand_path('../../test_helper', __FILE__)
class WikiTest < ActiveSupport::TestCase
- fixtures :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions
+ fixtures :projects, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions
def test_create
wiki = Wiki.new(:project => Project.find(2))
@@ -49,6 +49,9 @@ class WikiTest < ActiveSupport::TestCase
page = WikiPage.find(10)
assert_equal page, wiki.find_page('Этика_менеджмента')
+
+ page = WikiPage.generate!(:wiki => wiki, :title => '2009\\02\\09')
+ assert_equal page, wiki.find_page('2009\\02\\09')
end
def test_titleize