##// END OF EJS Templates
Removed some shoulda context....
Jean-Philippe Lang -
r11209:b0de1b1908d9
parent child
Show More
@@ -1,87 +1,84
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2013 Jean-Philippe Lang
2 # Copyright (C) 2006-2013 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_calendar
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 '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
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 def test_cross_project_calendar
43 def test_cross_project_calendar
37 get :show
44 get :show
38 assert_response :success
45 assert_response :success
39 assert_template 'calendar'
46 assert_template 'calendar'
40 assert_not_nil assigns(:calendar)
47 assert_not_nil assigns(:calendar)
41 end
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 def test_week_number_calculation
50 def test_week_number_calculation
54 Setting.start_of_week = 7
51 Setting.start_of_week = 7
55
52
56 get :show, :month => '1', :year => '2010'
53 get :show, :month => '1', :year => '2010'
57 assert_response :success
54 assert_response :success
58
55
59 assert_select 'tr' do
56 assert_select 'tr' do
60 assert_select 'td.week-number', :text => '53'
57 assert_select 'td.week-number', :text => '53'
61 assert_select 'td.odd', :text => '27'
58 assert_select 'td.odd', :text => '27'
62 assert_select 'td.even', :text => '2'
59 assert_select 'td.even', :text => '2'
63 end
60 end
64
61
65 assert_select 'tr' do
62 assert_select 'tr' do
66 assert_select 'td.week-number', :text => '1'
63 assert_select 'td.week-number', :text => '1'
67 assert_select 'td.odd', :text => '3'
64 assert_select 'td.odd', :text => '3'
68 assert_select 'td.even', :text => '9'
65 assert_select 'td.even', :text => '9'
69 end
66 end
70
67
71 Setting.start_of_week = 1
68 Setting.start_of_week = 1
72 get :show, :month => '1', :year => '2010'
69 get :show, :month => '1', :year => '2010'
73 assert_response :success
70 assert_response :success
74
71
75 assert_select 'tr' do
72 assert_select 'tr' do
76 assert_select 'td.week-number', :text => '53'
73 assert_select 'td.week-number', :text => '53'
77 assert_select 'td.even', :text => '28'
74 assert_select 'td.even', :text => '28'
78 assert_select 'td.even', :text => '3'
75 assert_select 'td.even', :text => '3'
79 end
76 end
80
77
81 assert_select 'tr' do
78 assert_select 'tr' do
82 assert_select 'td.week-number', :text => '1'
79 assert_select 'td.week-number', :text => '1'
83 assert_select 'td.even', :text => '4'
80 assert_select 'td.even', :text => '4'
84 assert_select 'td.even', :text => '10'
81 assert_select 'td.even', :text => '10'
85 end
82 end
86 end
83 end
87 end
84 end
General Comments 0
You need to be logged in to leave comments. Login now