##// END OF EJS Templates
add copyright statement to test/functional/gantts_controller_test.rb...
Toshi MARUYAMA -
r9879:bd85428b01d7
parent child
Show More
@@ -1,90 +1,107
1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
1 require File.expand_path('../../test_helper', __FILE__)
18 require File.expand_path('../../test_helper', __FILE__)
2
19
3 class GanttsControllerTest < ActionController::TestCase
20 class GanttsControllerTest < ActionController::TestCase
4 fixtures :projects, :trackers, :issue_statuses, :issues,
21 fixtures :projects, :trackers, :issue_statuses, :issues,
5 :enumerations, :users, :issue_categories,
22 :enumerations, :users, :issue_categories,
6 :projects_trackers,
23 :projects_trackers,
7 :roles,
24 :roles,
8 :member_roles,
25 :member_roles,
9 :members,
26 :members,
10 :enabled_modules,
27 :enabled_modules,
11 :workflows,
28 :workflows,
12 :versions
29 :versions
13
30
14 def test_gantt_should_work
31 def test_gantt_should_work
15 i2 = Issue.find(2)
32 i2 = Issue.find(2)
16 i2.update_attribute(:due_date, 1.month.from_now)
33 i2.update_attribute(:due_date, 1.month.from_now)
17 get :show, :project_id => 1
34 get :show, :project_id => 1
18 assert_response :success
35 assert_response :success
19 assert_template 'gantts/show'
36 assert_template 'gantts/show'
20 assert_not_nil assigns(:gantt)
37 assert_not_nil assigns(:gantt)
21 # Issue with start and due dates
38 # Issue with start and due dates
22 i = Issue.find(1)
39 i = Issue.find(1)
23 assert_not_nil i.due_date
40 assert_not_nil i.due_date
24 assert_select "div a.issue", /##{i.id}/
41 assert_select "div a.issue", /##{i.id}/
25 # Issue with on a targeted version should not be in the events but loaded in the html
42 # Issue with on a targeted version should not be in the events but loaded in the html
26 i = Issue.find(2)
43 i = Issue.find(2)
27 assert_select "div a.issue", /##{i.id}/
44 assert_select "div a.issue", /##{i.id}/
28 end
45 end
29
46
30 def test_gantt_should_work_without_issue_due_dates
47 def test_gantt_should_work_without_issue_due_dates
31 Issue.update_all("due_date = NULL")
48 Issue.update_all("due_date = NULL")
32 get :show, :project_id => 1
49 get :show, :project_id => 1
33 assert_response :success
50 assert_response :success
34 assert_template 'gantts/show'
51 assert_template 'gantts/show'
35 assert_not_nil assigns(:gantt)
52 assert_not_nil assigns(:gantt)
36 end
53 end
37
54
38 def test_gantt_should_work_without_issue_and_version_due_dates
55 def test_gantt_should_work_without_issue_and_version_due_dates
39 Issue.update_all("due_date = NULL")
56 Issue.update_all("due_date = NULL")
40 Version.update_all("effective_date = NULL")
57 Version.update_all("effective_date = NULL")
41 get :show, :project_id => 1
58 get :show, :project_id => 1
42 assert_response :success
59 assert_response :success
43 assert_template 'gantts/show'
60 assert_template 'gantts/show'
44 assert_not_nil assigns(:gantt)
61 assert_not_nil assigns(:gantt)
45 end
62 end
46
63
47 def test_gantt_should_work_cross_project
64 def test_gantt_should_work_cross_project
48 get :show
65 get :show
49 assert_response :success
66 assert_response :success
50 assert_template 'gantts/show'
67 assert_template 'gantts/show'
51 assert_not_nil assigns(:gantt)
68 assert_not_nil assigns(:gantt)
52 assert_not_nil assigns(:gantt).query
69 assert_not_nil assigns(:gantt).query
53 assert_nil assigns(:gantt).project
70 assert_nil assigns(:gantt).project
54 end
71 end
55
72
56 def test_gantt_should_not_disclose_private_projects
73 def test_gantt_should_not_disclose_private_projects
57 get :show
74 get :show
58 assert_response :success
75 assert_response :success
59 assert_template 'gantts/show'
76 assert_template 'gantts/show'
60 assert_tag 'a', :content => /eCookbook/
77 assert_tag 'a', :content => /eCookbook/
61 # Root private project
78 # Root private project
62 assert_no_tag 'a', {:content => /OnlineStore/}
79 assert_no_tag 'a', {:content => /OnlineStore/}
63 # Private children of a public project
80 # Private children of a public project
64 assert_no_tag 'a', :content => /Private child of eCookbook/
81 assert_no_tag 'a', :content => /Private child of eCookbook/
65 end
82 end
66
83
67 def test_gantt_should_export_to_pdf
84 def test_gantt_should_export_to_pdf
68 get :show, :project_id => 1, :format => 'pdf'
85 get :show, :project_id => 1, :format => 'pdf'
69 assert_response :success
86 assert_response :success
70 assert_equal 'application/pdf', @response.content_type
87 assert_equal 'application/pdf', @response.content_type
71 assert @response.body.starts_with?('%PDF')
88 assert @response.body.starts_with?('%PDF')
72 assert_not_nil assigns(:gantt)
89 assert_not_nil assigns(:gantt)
73 end
90 end
74
91
75 def test_gantt_should_export_to_pdf_cross_project
92 def test_gantt_should_export_to_pdf_cross_project
76 get :show, :format => 'pdf'
93 get :show, :format => 'pdf'
77 assert_response :success
94 assert_response :success
78 assert_equal 'application/pdf', @response.content_type
95 assert_equal 'application/pdf', @response.content_type
79 assert @response.body.starts_with?('%PDF')
96 assert @response.body.starts_with?('%PDF')
80 assert_not_nil assigns(:gantt)
97 assert_not_nil assigns(:gantt)
81 end
98 end
82
99
83 if Object.const_defined?(:Magick)
100 if Object.const_defined?(:Magick)
84 def test_gantt_should_export_to_png
101 def test_gantt_should_export_to_png
85 get :show, :project_id => 1, :format => 'png'
102 get :show, :project_id => 1, :format => 'png'
86 assert_response :success
103 assert_response :success
87 assert_equal 'image/png', @response.content_type
104 assert_equal 'image/png', @response.content_type
88 end
105 end
89 end
106 end
90 end
107 end
General Comments 0
You need to be logged in to leave comments. Login now