comparison test/unit/wiki_test.rb @ 1464:261b3d9a4903 redmine-2.4

Update to Redmine 2.4 branch rev 12663
author Chris Cannam
date Tue, 14 Jan 2014 14:37:42 +0000
parents 433d4f72a19b
children 51364c0cd58f e248c7af89ec
comparison
equal deleted inserted replaced
1296:038ba2d95de8 1464:261b3d9a4903
1 # encoding: utf-8 1 # encoding: utf-8
2 # 2 #
3 # Redmine - project management software 3 # Redmine - project management software
4 # Copyright (C) 2006-2012 Jean-Philippe Lang 4 # Copyright (C) 2006-2013 Jean-Philippe Lang
5 # 5 #
6 # This program is free software; you can redistribute it and/or 6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License 7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2 8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version. 9 # of the License, or (at your option) any later version.
82 ja_test.force_encoding('UTF-8') if ja_test.respond_to?(:force_encoding) 82 ja_test.force_encoding('UTF-8') if ja_test.respond_to?(:force_encoding)
83 assert_equal 'Page_title_with_CAPITALES', Wiki.titleize('page title with CAPITALES') 83 assert_equal 'Page_title_with_CAPITALES', Wiki.titleize('page title with CAPITALES')
84 assert_equal ja_test, Wiki.titleize(ja_test) 84 assert_equal ja_test, Wiki.titleize(ja_test)
85 end 85 end
86 86
87 context "#sidebar" do 87 def test_sidebar_should_return_nil_if_undefined
88 setup do 88 @wiki = Wiki.find(1)
89 @wiki = Wiki.find(1) 89 assert_nil @wiki.sidebar
90 end 90 end
91 91
92 should "return nil if undefined" do 92 def test_sidebar_should_return_a_wiki_page_if_defined
93 assert_nil @wiki.sidebar 93 @wiki = Wiki.find(1)
94 end 94 page = @wiki.pages.new(:title => 'Sidebar')
95 page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar')
96 page.save!
95 97
96 should "return a WikiPage if defined" do 98 assert_kind_of WikiPage, @wiki.sidebar
97 page = @wiki.pages.new(:title => 'Sidebar') 99 assert_equal 'Sidebar', @wiki.sidebar.title
98 page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar')
99 page.save!
100
101 assert_kind_of WikiPage, @wiki.sidebar
102 assert_equal 'Sidebar', @wiki.sidebar.title
103 end
104 end 100 end
105 end 101 end