comparison .svn/pristine/b5/b56a8e43fdd2558ce06b9e0aaade0e6568e56fc6.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 CalendarsControllerTest < ActionController::TestCase
21 fixtures :projects,
22 :trackers,
23 :projects_trackers,
24 :roles,
25 :member_roles,
26 :members,
27 :enabled_modules
28
29 def test_show
30 get :show, :project_id => 1
31 assert_response :success
32 assert_template :partial => '_calendar'
33 assert_not_nil assigns(:calendar)
34 end
35
36 def test_show_should_run_custom_queries
37 @query = IssueQuery.create!(:name => 'Calendar', :visibility => IssueQuery::VISIBILITY_PUBLIC)
38
39 get :show, :query_id => @query.id
40 assert_response :success
41 end
42
43 def test_cross_project_calendar
44 get :show
45 assert_response :success
46 assert_template :partial => '_calendar'
47 assert_not_nil assigns(:calendar)
48 end
49
50 def test_week_number_calculation
51 Setting.start_of_week = 7
52
53 get :show, :month => '1', :year => '2010'
54 assert_response :success
55
56 assert_select 'tr' do
57 assert_select 'td.week-number', :text => '53'
58 assert_select 'td.odd', :text => '27'
59 assert_select 'td.even', :text => '2'
60 end
61
62 assert_select 'tr' do
63 assert_select 'td.week-number', :text => '1'
64 assert_select 'td.odd', :text => '3'
65 assert_select 'td.even', :text => '9'
66 end
67
68 Setting.start_of_week = 1
69 get :show, :month => '1', :year => '2010'
70 assert_response :success
71
72 assert_select 'tr' do
73 assert_select 'td.week-number', :text => '53'
74 assert_select 'td.even', :text => '28'
75 assert_select 'td.even', :text => '3'
76 end
77
78 assert_select 'tr' do
79 assert_select 'td.week-number', :text => '1'
80 assert_select 'td.even', :text => '4'
81 assert_select 'td.even', :text => '10'
82 end
83 end
84 end