@@ -1,85 +1,90 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2014 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2014 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. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
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 |
|
19 | |||
20 | class CalendarsControllerTest < ActionController::TestCase |
|
20 | class CalendarsControllerTest < ActionController::TestCase | |
21 | fixtures :projects, |
|
21 | fixtures :projects, | |
22 | :trackers, |
|
22 | :trackers, | |
23 | :projects_trackers, |
|
23 | :projects_trackers, | |
24 | :roles, |
|
24 | :roles, | |
25 | :member_roles, |
|
25 | :member_roles, | |
26 | :members, |
|
26 | :members, | |
27 | :enabled_modules |
|
27 | :enabled_modules, | |
|
28 | :issues, | |||
|
29 | :issue_statuses, | |||
|
30 | :issue_relations, | |||
|
31 | :issue_categories, | |||
|
32 | :enumerations | |||
28 |
|
33 | |||
29 | def test_show |
|
34 | def test_show | |
30 | get :show, :project_id => 1 |
|
35 | get :show, :project_id => 1 | |
31 | assert_response :success |
|
36 | assert_response :success | |
32 | assert_template :partial => '_calendar' |
|
37 | assert_template :partial => '_calendar' | |
33 | assert_not_nil assigns(:calendar) |
|
38 | assert_not_nil assigns(:calendar) | |
34 | end |
|
39 | end | |
35 |
|
40 | |||
36 | def test_show_should_run_custom_queries |
|
41 | def test_show_should_run_custom_queries | |
37 | @query = IssueQuery.create!(:name => 'Calendar', :visibility => IssueQuery::VISIBILITY_PUBLIC) |
|
42 | @query = IssueQuery.create!(:name => 'Calendar', :visibility => IssueQuery::VISIBILITY_PUBLIC) | |
38 |
|
43 | |||
39 | get :show, :query_id => @query.id |
|
44 | get :show, :query_id => @query.id | |
40 | assert_response :success |
|
45 | assert_response :success | |
41 | end |
|
46 | end | |
42 |
|
47 | |||
43 | def test_cross_project_calendar |
|
48 | def test_cross_project_calendar | |
44 | get :show |
|
49 | get :show | |
45 | assert_response :success |
|
50 | assert_response :success | |
46 | assert_template :partial => '_calendar' |
|
51 | assert_template :partial => '_calendar' | |
47 | assert_not_nil assigns(:calendar) |
|
52 | assert_not_nil assigns(:calendar) | |
48 | end |
|
53 | end | |
49 |
|
54 | |||
50 | def test_week_number_calculation |
|
55 | def test_week_number_calculation | |
51 | with_settings :start_of_week => 7 do |
|
56 | with_settings :start_of_week => 7 do | |
52 | get :show, :month => '1', :year => '2010' |
|
57 | get :show, :month => '1', :year => '2010' | |
53 | assert_response :success |
|
58 | assert_response :success | |
54 | end |
|
59 | end | |
55 |
|
60 | |||
56 | assert_select 'tr' do |
|
61 | assert_select 'tr' do | |
57 | assert_select 'td.week-number', :text => '53' |
|
62 | assert_select 'td.week-number', :text => '53' | |
58 | assert_select 'td.odd', :text => '27' |
|
63 | assert_select 'td.odd', :text => '27' | |
59 | assert_select 'td.even', :text => '2' |
|
64 | assert_select 'td.even', :text => '2' | |
60 | end |
|
65 | end | |
61 |
|
66 | |||
62 | assert_select 'tr' do |
|
67 | assert_select 'tr' do | |
63 | assert_select 'td.week-number', :text => '1' |
|
68 | assert_select 'td.week-number', :text => '1' | |
64 | assert_select 'td.odd', :text => '3' |
|
69 | assert_select 'td.odd', :text => '3' | |
65 | assert_select 'td.even', :text => '9' |
|
70 | assert_select 'td.even', :text => '9' | |
66 | end |
|
71 | end | |
67 |
|
72 | |||
68 | with_settings :start_of_week => 1 do |
|
73 | with_settings :start_of_week => 1 do | |
69 | get :show, :month => '1', :year => '2010' |
|
74 | get :show, :month => '1', :year => '2010' | |
70 | assert_response :success |
|
75 | assert_response :success | |
71 | end |
|
76 | end | |
72 |
|
77 | |||
73 | assert_select 'tr' do |
|
78 | assert_select 'tr' do | |
74 | assert_select 'td.week-number', :text => '53' |
|
79 | assert_select 'td.week-number', :text => '53' | |
75 | assert_select 'td.even', :text => '28' |
|
80 | assert_select 'td.even', :text => '28' | |
76 | assert_select 'td.even', :text => '3' |
|
81 | assert_select 'td.even', :text => '3' | |
77 | end |
|
82 | end | |
78 |
|
83 | |||
79 | assert_select 'tr' do |
|
84 | assert_select 'tr' do | |
80 | assert_select 'td.week-number', :text => '1' |
|
85 | assert_select 'td.week-number', :text => '1' | |
81 | assert_select 'td.even', :text => '4' |
|
86 | assert_select 'td.even', :text => '4' | |
82 | assert_select 'td.even', :text => '10' |
|
87 | assert_select 'td.even', :text => '10' | |
83 | end |
|
88 | end | |
84 | end |
|
89 | end | |
85 | end |
|
90 | end |
General Comments 0
You need to be logged in to leave comments.
Login now