@@ -1,87 +1,84 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2013 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 | 27 | :enabled_modules |
|
28 | 28 | |
|
29 |
def test_ |
|
|
29 | def test_show | |
|
30 | 30 | get :show, :project_id => 1 |
|
31 | 31 | assert_response :success |
|
32 | 32 | assert_template 'calendar' |
|
33 | 33 | assert_not_nil assigns(:calendar) |
|
34 | 34 | end |
|
35 | 35 | |
|
36 | def test_show_should_run_custom_queries | |
|
37 | @query = IssueQuery.create!(:name => 'Calendar', :is_public => true) | |
|
38 | ||
|
39 | get :show, :query_id => @query.id | |
|
40 | assert_response :success | |
|
41 | end | |
|
42 | ||
|
36 | 43 | def test_cross_project_calendar |
|
37 | 44 | get :show |
|
38 | 45 | assert_response :success |
|
39 | 46 | assert_template 'calendar' |
|
40 | 47 | assert_not_nil assigns(:calendar) |
|
41 | 48 | end |
|
42 | 49 | |
|
43 | context "GET :show" do | |
|
44 | should "run custom queries" do | |
|
45 | @query = IssueQuery.create!(:name => 'Calendar', :is_public => true) | |
|
46 | ||
|
47 | get :show, :query_id => @query.id | |
|
48 | assert_response :success | |
|
49 | end | |
|
50 | ||
|
51 | end | |
|
52 | ||
|
53 | 50 | def test_week_number_calculation |
|
54 | 51 | Setting.start_of_week = 7 |
|
55 | 52 | |
|
56 | 53 | get :show, :month => '1', :year => '2010' |
|
57 | 54 | assert_response :success |
|
58 | 55 | |
|
59 | 56 | assert_select 'tr' do |
|
60 | 57 | assert_select 'td.week-number', :text => '53' |
|
61 | 58 | assert_select 'td.odd', :text => '27' |
|
62 | 59 | assert_select 'td.even', :text => '2' |
|
63 | 60 | end |
|
64 | 61 | |
|
65 | 62 | assert_select 'tr' do |
|
66 | 63 | assert_select 'td.week-number', :text => '1' |
|
67 | 64 | assert_select 'td.odd', :text => '3' |
|
68 | 65 | assert_select 'td.even', :text => '9' |
|
69 | 66 | end |
|
70 | 67 | |
|
71 | 68 | Setting.start_of_week = 1 |
|
72 | 69 | get :show, :month => '1', :year => '2010' |
|
73 | 70 | assert_response :success |
|
74 | 71 | |
|
75 | 72 | assert_select 'tr' do |
|
76 | 73 | assert_select 'td.week-number', :text => '53' |
|
77 | 74 | assert_select 'td.even', :text => '28' |
|
78 | 75 | assert_select 'td.even', :text => '3' |
|
79 | 76 | end |
|
80 | 77 | |
|
81 | 78 | assert_select 'tr' do |
|
82 | 79 | assert_select 'td.week-number', :text => '1' |
|
83 | 80 | assert_select 'td.even', :text => '4' |
|
84 | 81 | assert_select 'td.even', :text => '10' |
|
85 | 82 | end |
|
86 | 83 | end |
|
87 | 84 | end |
General Comments 0
You need to be logged in to leave comments.
Login now