@@ -0,0 +1,41 | |||||
|
1 | # redMine - project management software | |||
|
2 | # Copyright (C) 2006-2007 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 | ||||
|
18 | require File.dirname(__FILE__) + '/../../test_helper' | |||
|
19 | ||||
|
20 | class ProjectsHelperTest < HelperTestCase | |||
|
21 | include ProjectsHelper | |||
|
22 | include ActionView::Helpers::TextHelper | |||
|
23 | fixtures :projects, :trackers, :issue_statuses, :issues, :enumerations, :users, :issue_categories | |||
|
24 | ||||
|
25 | def setup | |||
|
26 | super | |||
|
27 | end | |||
|
28 | ||||
|
29 | if Object.const_defined?(:Magick) | |||
|
30 | def test_gantt_image | |||
|
31 | assert gantt_image(Issue.find(:all, :conditions => "start_date IS NOT NULL AND due_date IS NOT NULL"), Date.today, 6, 2) | |||
|
32 | end | |||
|
33 | ||||
|
34 | def test_gantt_image_with_days | |||
|
35 | assert gantt_image(Issue.find(:all, :conditions => "start_date IS NOT NULL AND due_date IS NOT NULL"), Date.today, 3, 4) | |||
|
36 | end | |||
|
37 | else | |||
|
38 | puts "RMagick not installed. Skipping tests !!!" | |||
|
39 | def test_fake; assert true end | |||
|
40 | end | |||
|
41 | end |
@@ -179,9 +179,9 module ProjectsHelper | |||||
179 | end |
|
179 | end | |
180 |
|
180 | |||
181 | # today red line |
|
181 | # today red line | |
182 |
if Date.today >= |
|
182 | if Date.today >= date_from and Date.today <= date_to | |
183 | gc.stroke('red') |
|
183 | gc.stroke('red') | |
184 |
x = (Date.today- |
|
184 | x = (Date.today-date_from+1)*zoom + subject_width | |
185 | gc.line(x, headers_heigth, x, headers_heigth + g_height-1) |
|
185 | gc.line(x, headers_heigth, x, headers_heigth + g_height-1) | |
186 | end |
|
186 | end | |
187 |
|
187 |
@@ -41,6 +41,8 issues_003: | |||||
41 | assigned_to_id: |
|
41 | assigned_to_id: | |
42 | author_id: 2 |
|
42 | author_id: 2 | |
43 | status_id: 1 |
|
43 | status_id: 1 | |
|
44 | start_date: <%= 1.day.from_now.to_date.to_s(:db) %> | |||
|
45 | due_date: <%= 40.day.ago.to_date.to_s(:db) %> | |||
44 | issues_004: |
|
46 | issues_004: | |
45 | created_on: 2006-07-19 21:07:27 +02:00 |
|
47 | created_on: 2006-07-19 21:07:27 +02:00 | |
46 | project_id: 2 |
|
48 | project_id: 2 |
@@ -52,7 +52,37 class ProjectsControllerTest < Test::Unit::TestCase | |||||
52 | assert_response :success |
|
52 | assert_response :success | |
53 | assert_template 'show' |
|
53 | assert_template 'show' | |
54 | assert_not_nil assigns(:project) |
|
54 | assert_not_nil assigns(:project) | |
|
55 | end | |||
|
56 | ||||
|
57 | def test_settings | |||
|
58 | @request.session[:user_id] = 2 # manager | |||
|
59 | get :settings, :id => 1 | |||
|
60 | assert_response :success | |||
|
61 | assert_template 'settings' | |||
|
62 | end | |||
|
63 | ||||
|
64 | def test_edit | |||
|
65 | @request.session[:user_id] = 2 # manager | |||
|
66 | post :edit, :id => 1, :project => {:name => 'Test changed name'} | |||
|
67 | assert_redirected_to 'projects/settings/1' | |||
|
68 | project = Project.find(1) | |||
|
69 | assert_equal 'Test changed name', project.name | |||
|
70 | end | |||
|
71 | ||||
|
72 | def test_get_destroy | |||
|
73 | @request.session[:user_id] = 1 # admin | |||
|
74 | get :destroy, :id => 1 | |||
|
75 | assert_response :success | |||
|
76 | assert_template 'destroy' | |||
|
77 | assert_not_nil Project.find_by_id(1) | |||
55 | end |
|
78 | end | |
|
79 | ||||
|
80 | def test_post_destroy | |||
|
81 | @request.session[:user_id] = 1 # admin | |||
|
82 | post :destroy, :id => 1, :confirm => 1 | |||
|
83 | assert_redirected_to 'admin/projects' | |||
|
84 | assert_nil Project.find_by_id(1) | |||
|
85 | end | |||
56 |
|
86 | |||
57 | def test_list_documents |
|
87 | def test_list_documents | |
58 | get :list_documents, :id => 1 |
|
88 | get :list_documents, :id => 1 | |
@@ -70,7 +100,23 class ProjectsControllerTest < Test::Unit::TestCase | |||||
70 | assert_equal [7, 7], Issue.find_all_by_id([1, 2]).collect {|i| i.priority.id} |
|
100 | assert_equal [7, 7], Issue.find_all_by_id([1, 2]).collect {|i| i.priority.id} | |
71 | assert_equal 'Bulk editing', Issue.find(1).journals.find(:first, :order => 'created_on DESC').notes |
|
101 | assert_equal 'Bulk editing', Issue.find(1).journals.find(:first, :order => 'created_on DESC').notes | |
72 | end |
|
102 | end | |
73 |
|
103 | |||
|
104 | def test_move_issues_to_another_project | |||
|
105 | @request.session[:user_id] = 1 | |||
|
106 | post :move_issues, :id => 1, :issue_ids => [1, 2], :new_project_id => 2 | |||
|
107 | assert_redirected_to 'projects/1/issues' | |||
|
108 | assert_equal 2, Issue.find(1).project_id | |||
|
109 | assert_equal 2, Issue.find(2).project_id | |||
|
110 | end | |||
|
111 | ||||
|
112 | def test_move_issues_to_another_tracker | |||
|
113 | @request.session[:user_id] = 1 | |||
|
114 | post :move_issues, :id => 1, :issue_ids => [1, 2], :new_tracker_id => 3 | |||
|
115 | assert_redirected_to 'projects/1/issues' | |||
|
116 | assert_equal 3, Issue.find(1).tracker_id | |||
|
117 | assert_equal 3, Issue.find(2).tracker_id | |||
|
118 | end | |||
|
119 | ||||
74 | def test_list_files |
|
120 | def test_list_files | |
75 | get :list_files, :id => 1 |
|
121 | get :list_files, :id => 1 | |
76 | assert_response :success |
|
122 | assert_response :success |
General Comments 0
You need to be logged in to leave comments.
Login now