comparison test/functional/wiki_controller_test.rb @ 1295:622f24f53b42 redmine-2.3

Update to Redmine SVN revision 11972 on 2.3-stable branch
author Chris Cannam
date Fri, 14 Jun 2013 09:02:21 +0100
parents 3e4c3460b6ca
children
comparison
equal deleted inserted replaced
1294:3e4c3460b6ca 1295:622f24f53b42
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang 2 # Copyright (C) 2006-2013 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
14 # You should have received a copy of the GNU General Public License 14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software 15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 require File.expand_path('../../test_helper', __FILE__) 18 require File.expand_path('../../test_helper', __FILE__)
19 require 'wiki_controller'
20
21 # Re-raise errors caught by the controller.
22 class WikiController; def rescue_action(e) raise e end; end
23 19
24 class WikiControllerTest < ActionController::TestCase 20 class WikiControllerTest < ActionController::TestCase
25 fixtures :projects, :users, :roles, :members, :member_roles, 21 fixtures :projects, :users, :roles, :members, :member_roles,
26 :enabled_modules, :wikis, :wiki_pages, :wiki_contents, 22 :enabled_modules, :wikis, :wiki_pages, :wiki_contents,
27 :wiki_content_versions, :attachments 23 :wiki_content_versions, :attachments
28 24
29 def setup 25 def setup
30 @controller = WikiController.new
31 @request = ActionController::TestRequest.new
32 @response = ActionController::TestResponse.new
33 User.current = nil 26 User.current = nil
34 end 27 end
35 28
36 def test_show_start_page 29 def test_show_start_page
37 get :show, :project_id => 'ecookbook' 30 get :show, :project_id => 'ecookbook'
58 assert_response :success 51 assert_response :success
59 assert_template 'show' 52 assert_template 'show'
60 assert_tag :tag => 'h1', :content => /Another page/ 53 assert_tag :tag => 'h1', :content => /Another page/
61 # Included page with an inline image 54 # Included page with an inline image
62 assert_tag :tag => 'p', :content => /This is an inline image/ 55 assert_tag :tag => 'p', :content => /This is an inline image/
63 assert_tag :tag => 'img', :attributes => { :src => '/attachments/download/3', 56 assert_tag :tag => 'img', :attributes => { :src => '/attachments/download/3/logo.gif',
64 :alt => 'This is a logo' } 57 :alt => 'This is a logo' }
65 end 58 end
66 59
67 def test_show_old_version 60 def test_show_old_version
68 get :show, :project_id => 'ecookbook', :id => 'CookBook_documentation', :version => '2' 61 get :show, :project_id => 'ecookbook', :id => 'CookBook_documentation', :version => '2'
590 } 583 }
591 584
592 # Line 5 585 # Line 5
593 assert_tag :tag => 'tr', :child => { 586 assert_tag :tag => 'tr', :child => {
594 :tag => 'th', :attributes => {:class => 'line-num'}, :content => '5', :sibling => { 587 :tag => 'th', :attributes => {:class => 'line-num'}, :content => '5', :sibling => {
595 :tag => 'td', :attributes => {:class => 'author'}, :content => /redMine Admin/, :sibling => { 588 :tag => 'td', :attributes => {:class => 'author'}, :content => /Redmine Admin/, :sibling => {
596 :tag => 'td', :content => /Some updated \[\[documentation\]\] here/ 589 :tag => 'td', :content => /Some updated \[\[documentation\]\] here/
597 } 590 }
598 } 591 }
599 } 592 }
600 end 593 end