##// END OF EJS Templates
Rails4: fix "assert_template 'calendar'" fails at CalendarsControllerTest...
Toshi MARUYAMA -
r12525:61b5a44b1ab0
parent child
Show More
@@ -1,84 +1,84
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
28
29 def test_show
29 def test_show
30 get :show, :project_id => 1
30 get :show, :project_id => 1
31 assert_response :success
31 assert_response :success
32 assert_template 'calendar'
32 assert_template :partial => '_calendar'
33 assert_not_nil assigns(:calendar)
33 assert_not_nil assigns(:calendar)
34 end
34 end
35
35
36 def test_show_should_run_custom_queries
36 def test_show_should_run_custom_queries
37 @query = IssueQuery.create!(:name => 'Calendar', :visibility => IssueQuery::VISIBILITY_PUBLIC)
37 @query = IssueQuery.create!(:name => 'Calendar', :visibility => IssueQuery::VISIBILITY_PUBLIC)
38
38
39 get :show, :query_id => @query.id
39 get :show, :query_id => @query.id
40 assert_response :success
40 assert_response :success
41 end
41 end
42
42
43 def test_cross_project_calendar
43 def test_cross_project_calendar
44 get :show
44 get :show
45 assert_response :success
45 assert_response :success
46 assert_template 'calendar'
46 assert_template :partial => '_calendar'
47 assert_not_nil assigns(:calendar)
47 assert_not_nil assigns(:calendar)
48 end
48 end
49
49
50 def test_week_number_calculation
50 def test_week_number_calculation
51 Setting.start_of_week = 7
51 Setting.start_of_week = 7
52
52
53 get :show, :month => '1', :year => '2010'
53 get :show, :month => '1', :year => '2010'
54 assert_response :success
54 assert_response :success
55
55
56 assert_select 'tr' do
56 assert_select 'tr' do
57 assert_select 'td.week-number', :text => '53'
57 assert_select 'td.week-number', :text => '53'
58 assert_select 'td.odd', :text => '27'
58 assert_select 'td.odd', :text => '27'
59 assert_select 'td.even', :text => '2'
59 assert_select 'td.even', :text => '2'
60 end
60 end
61
61
62 assert_select 'tr' do
62 assert_select 'tr' do
63 assert_select 'td.week-number', :text => '1'
63 assert_select 'td.week-number', :text => '1'
64 assert_select 'td.odd', :text => '3'
64 assert_select 'td.odd', :text => '3'
65 assert_select 'td.even', :text => '9'
65 assert_select 'td.even', :text => '9'
66 end
66 end
67
67
68 Setting.start_of_week = 1
68 Setting.start_of_week = 1
69 get :show, :month => '1', :year => '2010'
69 get :show, :month => '1', :year => '2010'
70 assert_response :success
70 assert_response :success
71
71
72 assert_select 'tr' do
72 assert_select 'tr' do
73 assert_select 'td.week-number', :text => '53'
73 assert_select 'td.week-number', :text => '53'
74 assert_select 'td.even', :text => '28'
74 assert_select 'td.even', :text => '28'
75 assert_select 'td.even', :text => '3'
75 assert_select 'td.even', :text => '3'
76 end
76 end
77
77
78 assert_select 'tr' do
78 assert_select 'tr' do
79 assert_select 'td.week-number', :text => '1'
79 assert_select 'td.week-number', :text => '1'
80 assert_select 'td.even', :text => '4'
80 assert_select 'td.even', :text => '4'
81 assert_select 'td.even', :text => '10'
81 assert_select 'td.even', :text => '10'
82 end
82 end
83 end
83 end
84 end
84 end
General Comments 0
You need to be logged in to leave comments. Login now