Mercurial > hg > soundsoftware-site
comparison .svn/pristine/ed/ed5bb906160f4429daa38295e07869df8d886c4e.svn-base @ 1517:dffacf8a6908 redmine-2.5
Update to Redmine SVN revision 13367 on 2.5-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:29:00 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1516:b450a9d58aed | 1517:dffacf8a6908 |
---|---|
1 # Redmine - project management software | |
2 # Copyright (C) 2006-2014 Jean-Philippe Lang | |
3 # | |
4 # This program is free software; you can redistribute it and/or | |
5 # modify it under the terms of the GNU General Public License | |
6 # as published by the Free Software Foundation; either version 2 | |
7 # of the License, or (at your option) any later version. | |
8 # | |
9 # This program is distributed in the hope that it will be useful, | |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 # GNU General Public License for more details. | |
13 # | |
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 | |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 | |
18 require File.expand_path('../../test_helper', __FILE__) | |
19 | |
20 class WikisControllerTest < ActionController::TestCase | |
21 fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis | |
22 | |
23 def setup | |
24 User.current = nil | |
25 end | |
26 | |
27 def test_create | |
28 @request.session[:user_id] = 1 | |
29 assert_nil Project.find(3).wiki | |
30 | |
31 assert_difference 'Wiki.count' do | |
32 xhr :post, :edit, :id => 3, :wiki => { :start_page => 'Start page' } | |
33 assert_response :success | |
34 assert_template 'edit' | |
35 assert_equal 'text/javascript', response.content_type | |
36 end | |
37 | |
38 wiki = Project.find(3).wiki | |
39 assert_not_nil wiki | |
40 assert_equal 'Start page', wiki.start_page | |
41 end | |
42 | |
43 def test_create_with_failure | |
44 @request.session[:user_id] = 1 | |
45 | |
46 assert_no_difference 'Wiki.count' do | |
47 xhr :post, :edit, :id => 3, :wiki => { :start_page => '' } | |
48 assert_response :success | |
49 assert_template 'edit' | |
50 assert_equal 'text/javascript', response.content_type | |
51 end | |
52 | |
53 assert_include 'errorExplanation', response.body | |
54 assert_include "Start page #{ESCAPED_CANT} be blank", response.body | |
55 end | |
56 | |
57 def test_update | |
58 @request.session[:user_id] = 1 | |
59 | |
60 assert_no_difference 'Wiki.count' do | |
61 xhr :post, :edit, :id => 1, :wiki => { :start_page => 'Other start page' } | |
62 assert_response :success | |
63 assert_template 'edit' | |
64 assert_equal 'text/javascript', response.content_type | |
65 end | |
66 | |
67 wiki = Project.find(1).wiki | |
68 assert_equal 'Other start page', wiki.start_page | |
69 end | |
70 | |
71 def test_destroy | |
72 @request.session[:user_id] = 1 | |
73 post :destroy, :id => 1, :confirm => 1 | |
74 assert_redirected_to :controller => 'projects', | |
75 :action => 'settings', :id => 'ecookbook', :tab => 'wiki' | |
76 assert_nil Project.find(1).wiki | |
77 end | |
78 | |
79 def test_not_found | |
80 @request.session[:user_id] = 1 | |
81 post :destroy, :id => 999, :confirm => 1 | |
82 assert_response 404 | |
83 end | |
84 end |