# find the page with the given title
def find_page(title, options = {})
title = start_page if title.blank?
- title = Wiki.titleize(title).downcase
- page = pages.first(:conditions => ["LOWER(title) LIKE ?", title])
+ title = Wiki.titleize(title)
+ page = pages.first(:conditions => ["LOWER(title) LIKE LOWER(?)", title])
if !page && !(options[:with_redirect] == false)
# search for a redirect
- redirect = redirects.first(:conditions => ["LOWER(title) LIKE ?", title])
+ redirect = redirects.first(:conditions => ["LOWER(title) LIKE LOWER(?)", title])
page = find_page(redirect.redirects_to, :with_redirect => false) if redirect
end
page
assert_equal page, wiki.find_page('Another_page')
assert_equal page, wiki.find_page('Another page')
assert_equal page, wiki.find_page('ANOTHER page')
+
+ page = WikiPage.find(10)
+ assert_equal page, wiki.find_page('Этика_менеджмента')
end
def test_titleize