@@ -1,85 +1,90 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2014 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | require File.expand_path('../../test_helper', __FILE__) |
|
19 | 19 | |
|
20 | 20 | class CalendarsControllerTest < ActionController::TestCase |
|
21 | 21 | fixtures :projects, |
|
22 | 22 | :trackers, |
|
23 | 23 | :projects_trackers, |
|
24 | 24 | :roles, |
|
25 | 25 | :member_roles, |
|
26 | 26 | :members, |
|
27 | :enabled_modules | |
|
27 | :enabled_modules, | |
|
28 | :issues, | |
|
29 | :issue_statuses, | |
|
30 | :issue_relations, | |
|
31 | :issue_categories, | |
|
32 | :enumerations | |
|
28 | 33 | |
|
29 | 34 | def test_show |
|
30 | 35 | get :show, :project_id => 1 |
|
31 | 36 | assert_response :success |
|
32 | 37 | assert_template :partial => '_calendar' |
|
33 | 38 | assert_not_nil assigns(:calendar) |
|
34 | 39 | end |
|
35 | 40 | |
|
36 | 41 | def test_show_should_run_custom_queries |
|
37 | 42 | @query = IssueQuery.create!(:name => 'Calendar', :visibility => IssueQuery::VISIBILITY_PUBLIC) |
|
38 | 43 | |
|
39 | 44 | get :show, :query_id => @query.id |
|
40 | 45 | assert_response :success |
|
41 | 46 | end |
|
42 | 47 | |
|
43 | 48 | def test_cross_project_calendar |
|
44 | 49 | get :show |
|
45 | 50 | assert_response :success |
|
46 | 51 | assert_template :partial => '_calendar' |
|
47 | 52 | assert_not_nil assigns(:calendar) |
|
48 | 53 | end |
|
49 | 54 | |
|
50 | 55 | def test_week_number_calculation |
|
51 | 56 | with_settings :start_of_week => 7 do |
|
52 | 57 | get :show, :month => '1', :year => '2010' |
|
53 | 58 | assert_response :success |
|
54 | 59 | end |
|
55 | 60 | |
|
56 | 61 | assert_select 'tr' do |
|
57 | 62 | assert_select 'td.week-number', :text => '53' |
|
58 | 63 | assert_select 'td.odd', :text => '27' |
|
59 | 64 | assert_select 'td.even', :text => '2' |
|
60 | 65 | end |
|
61 | 66 | |
|
62 | 67 | assert_select 'tr' do |
|
63 | 68 | assert_select 'td.week-number', :text => '1' |
|
64 | 69 | assert_select 'td.odd', :text => '3' |
|
65 | 70 | assert_select 'td.even', :text => '9' |
|
66 | 71 | end |
|
67 | 72 | |
|
68 | 73 | with_settings :start_of_week => 1 do |
|
69 | 74 | get :show, :month => '1', :year => '2010' |
|
70 | 75 | assert_response :success |
|
71 | 76 | end |
|
72 | 77 | |
|
73 | 78 | assert_select 'tr' do |
|
74 | 79 | assert_select 'td.week-number', :text => '53' |
|
75 | 80 | assert_select 'td.even', :text => '28' |
|
76 | 81 | assert_select 'td.even', :text => '3' |
|
77 | 82 | end |
|
78 | 83 | |
|
79 | 84 | assert_select 'tr' do |
|
80 | 85 | assert_select 'td.week-number', :text => '1' |
|
81 | 86 | assert_select 'td.even', :text => '4' |
|
82 | 87 | assert_select 'td.even', :text => '10' |
|
83 | 88 | end |
|
84 | 89 | end |
|
85 | 90 | end |
General Comments 0
You need to be logged in to leave comments.
Login now