3 # redMine - project management software
4 # Copyright (C) 2006-2007 Jean-Philippe Lang
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 require File.dirname(__FILE__) + '/../test_helper'
22 class WikiTest < ActiveSupport::TestCase
23 fixtures :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions
26 wiki = Wiki.new(:project => Project.find(2))
28 assert_equal 1, wiki.errors.count
30 wiki.start_page = "Start page"
36 @wiki.start_page = "Another start page"
39 assert_equal "Another start page", @wiki.start_page
43 assert_equal 'Page_title_with_CAPITALES', Wiki.titleize('page title with CAPITALES')
44 assert_equal 'テスト', Wiki.titleize('テスト')
52 should "return nil if undefined" do
53 assert_nil @wiki.sidebar
56 should "return a WikiPage if defined" do
57 page = @wiki.pages.new(:title => 'Sidebar')
58 page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar')
61 assert_kind_of WikiPage, @wiki.sidebar
62 assert_equal 'Sidebar', @wiki.sidebar.title