@@ -1,789 +1,782 | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | # Redmine - project management software |
|
2 | # Redmine - project management software | |
3 | # Copyright (C) 2006-2012 Jean-Philippe Lang |
|
3 | # Copyright (C) 2006-2012 Jean-Philippe Lang | |
4 | # |
|
4 | # | |
5 | # This program is free software; you can redistribute it and/or |
|
5 | # This program is free software; you can redistribute it and/or | |
6 | # modify it under the terms of the GNU General Public License |
|
6 | # modify it under the terms of the GNU General Public License | |
7 | # as published by the Free Software Foundation; either version 2 |
|
7 | # as published by the Free Software Foundation; either version 2 | |
8 | # of the License, or (at your option) any later version. |
|
8 | # of the License, or (at your option) any later version. | |
9 | # |
|
9 | # | |
10 | # This program is distributed in the hope that it will be useful, |
|
10 | # This program is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | # GNU General Public License for more details. |
|
13 | # GNU General Public License for more details. | |
14 | # |
|
14 | # | |
15 | # You should have received a copy of the GNU General Public License |
|
15 | # You should have received a copy of the GNU General Public License | |
16 | # along with this program; if not, write to the Free Software |
|
16 | # along with this program; if not, write to the Free Software | |
17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
18 |
|
18 | |||
19 | require File.expand_path('../../test_helper', __FILE__) |
|
19 | require File.expand_path('../../test_helper', __FILE__) | |
20 | require 'timelog_controller' |
|
20 | require 'timelog_controller' | |
21 |
|
21 | |||
22 | # Re-raise errors caught by the controller. |
|
22 | # Re-raise errors caught by the controller. | |
23 | class TimelogController; def rescue_action(e) raise e end; end |
|
23 | class TimelogController; def rescue_action(e) raise e end; end | |
24 |
|
24 | |||
25 | class TimelogControllerTest < ActionController::TestCase |
|
25 | class TimelogControllerTest < ActionController::TestCase | |
26 | fixtures :projects, :enabled_modules, :roles, :members, |
|
26 | fixtures :projects, :enabled_modules, :roles, :members, | |
27 | :member_roles, :issues, :time_entries, :users, |
|
27 | :member_roles, :issues, :time_entries, :users, | |
28 | :trackers, :enumerations, :issue_statuses, |
|
28 | :trackers, :enumerations, :issue_statuses, | |
29 | :custom_fields, :custom_values |
|
29 | :custom_fields, :custom_values | |
30 |
|
30 | |||
31 | include Redmine::I18n |
|
31 | include Redmine::I18n | |
32 |
|
32 | |||
33 | def setup |
|
33 | def setup | |
34 | @controller = TimelogController.new |
|
34 | @controller = TimelogController.new | |
35 | @request = ActionController::TestRequest.new |
|
35 | @request = ActionController::TestRequest.new | |
36 | @response = ActionController::TestResponse.new |
|
36 | @response = ActionController::TestResponse.new | |
37 | end |
|
37 | end | |
38 |
|
38 | |||
39 | def test_new_with_project_id |
|
39 | def test_new_with_project_id | |
40 | @request.session[:user_id] = 3 |
|
40 | @request.session[:user_id] = 3 | |
41 | get :new, :project_id => 1 |
|
41 | get :new, :project_id => 1 | |
42 | assert_response :success |
|
42 | assert_response :success | |
43 | assert_template 'new' |
|
43 | assert_template 'new' | |
44 | assert_select 'select[name=?]', 'time_entry[project_id]', 0 |
|
44 | assert_select 'select[name=?]', 'time_entry[project_id]', 0 | |
45 | assert_select 'input[name=?][value=1][type=hidden]', 'time_entry[project_id]' |
|
45 | assert_select 'input[name=?][value=1][type=hidden]', 'time_entry[project_id]' | |
46 | end |
|
46 | end | |
47 |
|
47 | |||
48 | def test_new_with_issue_id |
|
48 | def test_new_with_issue_id | |
49 | @request.session[:user_id] = 3 |
|
49 | @request.session[:user_id] = 3 | |
50 | get :new, :issue_id => 2 |
|
50 | get :new, :issue_id => 2 | |
51 | assert_response :success |
|
51 | assert_response :success | |
52 | assert_template 'new' |
|
52 | assert_template 'new' | |
53 | assert_select 'select[name=?]', 'time_entry[project_id]', 0 |
|
53 | assert_select 'select[name=?]', 'time_entry[project_id]', 0 | |
54 | assert_select 'input[name=?][value=1][type=hidden]', 'time_entry[project_id]' |
|
54 | assert_select 'input[name=?][value=1][type=hidden]', 'time_entry[project_id]' | |
55 | end |
|
55 | end | |
56 |
|
56 | |||
57 | def test_new_without_project |
|
57 | def test_new_without_project | |
58 | @request.session[:user_id] = 3 |
|
58 | @request.session[:user_id] = 3 | |
59 | get :new |
|
59 | get :new | |
60 | assert_response :success |
|
60 | assert_response :success | |
61 | assert_template 'new' |
|
61 | assert_template 'new' | |
62 | assert_select 'select[name=?]', 'time_entry[project_id]' |
|
62 | assert_select 'select[name=?]', 'time_entry[project_id]' | |
63 | assert_select 'input[name=?]', 'time_entry[project_id]', 0 |
|
63 | assert_select 'input[name=?]', 'time_entry[project_id]', 0 | |
64 | end |
|
64 | end | |
65 |
|
65 | |||
66 | def test_new_without_project_should_prefill_the_form |
|
66 | def test_new_without_project_should_prefill_the_form | |
67 | @request.session[:user_id] = 3 |
|
67 | @request.session[:user_id] = 3 | |
68 | get :new, :time_entry => {:project_id => '1'} |
|
68 | get :new, :time_entry => {:project_id => '1'} | |
69 | assert_response :success |
|
69 | assert_response :success | |
70 | assert_template 'new' |
|
70 | assert_template 'new' | |
71 | assert_select 'select[name=?]', 'time_entry[project_id]' do |
|
71 | assert_select 'select[name=?]', 'time_entry[project_id]' do | |
72 | assert_select 'option[value=1][selected=selected]' |
|
72 | assert_select 'option[value=1][selected=selected]' | |
73 | end |
|
73 | end | |
74 | assert_select 'input[name=?]', 'time_entry[project_id]', 0 |
|
74 | assert_select 'input[name=?]', 'time_entry[project_id]', 0 | |
75 | end |
|
75 | end | |
76 |
|
76 | |||
77 | def test_new_without_project_should_deny_without_permission |
|
77 | def test_new_without_project_should_deny_without_permission | |
78 | Role.all.each {|role| role.remove_permission! :log_time} |
|
78 | Role.all.each {|role| role.remove_permission! :log_time} | |
79 | @request.session[:user_id] = 3 |
|
79 | @request.session[:user_id] = 3 | |
80 |
|
80 | |||
81 | get :new |
|
81 | get :new | |
82 | assert_response 403 |
|
82 | assert_response 403 | |
83 | end |
|
83 | end | |
84 |
|
84 | |||
85 | def test_new_should_select_default_activity |
|
85 | def test_new_should_select_default_activity | |
86 | @request.session[:user_id] = 3 |
|
86 | @request.session[:user_id] = 3 | |
87 | get :new, :project_id => 1 |
|
87 | get :new, :project_id => 1 | |
88 | assert_response :success |
|
88 | assert_response :success | |
89 | assert_select 'select[name=?]', 'time_entry[activity_id]' do |
|
89 | assert_select 'select[name=?]', 'time_entry[activity_id]' do | |
90 | assert_select 'option[selected=selected]', :text => 'Development' |
|
90 | assert_select 'option[selected=selected]', :text => 'Development' | |
91 | end |
|
91 | end | |
92 | end |
|
92 | end | |
93 |
|
93 | |||
94 | def test_new_should_only_show_active_time_entry_activities |
|
94 | def test_new_should_only_show_active_time_entry_activities | |
95 | @request.session[:user_id] = 3 |
|
95 | @request.session[:user_id] = 3 | |
96 | get :new, :project_id => 1 |
|
96 | get :new, :project_id => 1 | |
97 | assert_response :success |
|
97 | assert_response :success | |
98 | assert_no_tag 'option', :content => 'Inactive Activity' |
|
98 | assert_no_tag 'option', :content => 'Inactive Activity' | |
99 | end |
|
99 | end | |
100 |
|
100 | |||
101 | def test_get_edit_existing_time |
|
101 | def test_get_edit_existing_time | |
102 | @request.session[:user_id] = 2 |
|
102 | @request.session[:user_id] = 2 | |
103 | get :edit, :id => 2, :project_id => nil |
|
103 | get :edit, :id => 2, :project_id => nil | |
104 | assert_response :success |
|
104 | assert_response :success | |
105 | assert_template 'edit' |
|
105 | assert_template 'edit' | |
106 | # Default activity selected |
|
106 | # Default activity selected | |
107 | assert_tag :tag => 'form', :attributes => { :action => '/projects/ecookbook/time_entries/2' } |
|
107 | assert_tag :tag => 'form', :attributes => { :action => '/projects/ecookbook/time_entries/2' } | |
108 | end |
|
108 | end | |
109 |
|
109 | |||
110 | def test_get_edit_with_an_existing_time_entry_with_inactive_activity |
|
110 | def test_get_edit_with_an_existing_time_entry_with_inactive_activity | |
111 | te = TimeEntry.find(1) |
|
111 | te = TimeEntry.find(1) | |
112 | te.activity = TimeEntryActivity.find_by_name("Inactive Activity") |
|
112 | te.activity = TimeEntryActivity.find_by_name("Inactive Activity") | |
113 | te.save! |
|
113 | te.save! | |
114 |
|
114 | |||
115 | @request.session[:user_id] = 1 |
|
115 | @request.session[:user_id] = 1 | |
116 | get :edit, :project_id => 1, :id => 1 |
|
116 | get :edit, :project_id => 1, :id => 1 | |
117 | assert_response :success |
|
117 | assert_response :success | |
118 | assert_template 'edit' |
|
118 | assert_template 'edit' | |
119 | # Blank option since nothing is pre-selected |
|
119 | # Blank option since nothing is pre-selected | |
120 | assert_tag :tag => 'option', :content => '--- Please select ---' |
|
120 | assert_tag :tag => 'option', :content => '--- Please select ---' | |
121 | end |
|
121 | end | |
122 |
|
122 | |||
123 | def test_post_create |
|
123 | def test_post_create | |
124 | # TODO: should POST to issuesβ time log instead of project. change form |
|
124 | # TODO: should POST to issuesβ time log instead of project. change form | |
125 | # and routing |
|
125 | # and routing | |
126 | @request.session[:user_id] = 3 |
|
126 | @request.session[:user_id] = 3 | |
127 | post :create, :project_id => 1, |
|
127 | post :create, :project_id => 1, | |
128 | :time_entry => {:comments => 'Some work on TimelogControllerTest', |
|
128 | :time_entry => {:comments => 'Some work on TimelogControllerTest', | |
129 | # Not the default activity |
|
129 | # Not the default activity | |
130 | :activity_id => '11', |
|
130 | :activity_id => '11', | |
131 | :spent_on => '2008-03-14', |
|
131 | :spent_on => '2008-03-14', | |
132 | :issue_id => '1', |
|
132 | :issue_id => '1', | |
133 | :hours => '7.3'} |
|
133 | :hours => '7.3'} | |
134 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
134 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
135 |
|
135 | |||
136 | i = Issue.find(1) |
|
136 | i = Issue.find(1) | |
137 | t = TimeEntry.find_by_comments('Some work on TimelogControllerTest') |
|
137 | t = TimeEntry.find_by_comments('Some work on TimelogControllerTest') | |
138 | assert_not_nil t |
|
138 | assert_not_nil t | |
139 | assert_equal 11, t.activity_id |
|
139 | assert_equal 11, t.activity_id | |
140 | assert_equal 7.3, t.hours |
|
140 | assert_equal 7.3, t.hours | |
141 | assert_equal 3, t.user_id |
|
141 | assert_equal 3, t.user_id | |
142 | assert_equal i, t.issue |
|
142 | assert_equal i, t.issue | |
143 | assert_equal i.project, t.project |
|
143 | assert_equal i.project, t.project | |
144 | end |
|
144 | end | |
145 |
|
145 | |||
146 | def test_post_create_with_blank_issue |
|
146 | def test_post_create_with_blank_issue | |
147 | # TODO: should POST to issuesβ time log instead of project. change form |
|
147 | # TODO: should POST to issuesβ time log instead of project. change form | |
148 | # and routing |
|
148 | # and routing | |
149 | @request.session[:user_id] = 3 |
|
149 | @request.session[:user_id] = 3 | |
150 | post :create, :project_id => 1, |
|
150 | post :create, :project_id => 1, | |
151 | :time_entry => {:comments => 'Some work on TimelogControllerTest', |
|
151 | :time_entry => {:comments => 'Some work on TimelogControllerTest', | |
152 | # Not the default activity |
|
152 | # Not the default activity | |
153 | :activity_id => '11', |
|
153 | :activity_id => '11', | |
154 | :issue_id => '', |
|
154 | :issue_id => '', | |
155 | :spent_on => '2008-03-14', |
|
155 | :spent_on => '2008-03-14', | |
156 | :hours => '7.3'} |
|
156 | :hours => '7.3'} | |
157 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
157 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
158 |
|
158 | |||
159 | t = TimeEntry.find_by_comments('Some work on TimelogControllerTest') |
|
159 | t = TimeEntry.find_by_comments('Some work on TimelogControllerTest') | |
160 | assert_not_nil t |
|
160 | assert_not_nil t | |
161 | assert_equal 11, t.activity_id |
|
161 | assert_equal 11, t.activity_id | |
162 | assert_equal 7.3, t.hours |
|
162 | assert_equal 7.3, t.hours | |
163 | assert_equal 3, t.user_id |
|
163 | assert_equal 3, t.user_id | |
164 | end |
|
164 | end | |
165 |
|
165 | |||
166 | def test_create_and_continue |
|
166 | def test_create_and_continue | |
167 | @request.session[:user_id] = 2 |
|
167 | @request.session[:user_id] = 2 | |
168 | post :create, :project_id => 1, |
|
168 | post :create, :project_id => 1, | |
169 | :time_entry => {:activity_id => '11', |
|
169 | :time_entry => {:activity_id => '11', | |
170 | :issue_id => '', |
|
170 | :issue_id => '', | |
171 | :spent_on => '2008-03-14', |
|
171 | :spent_on => '2008-03-14', | |
172 | :hours => '7.3'}, |
|
172 | :hours => '7.3'}, | |
173 | :continue => '1' |
|
173 | :continue => '1' | |
174 | assert_redirected_to '/projects/ecookbook/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=' |
|
174 | assert_redirected_to '/projects/ecookbook/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=' | |
175 | end |
|
175 | end | |
176 |
|
176 | |||
177 | def test_create_and_continue_with_issue_id |
|
177 | def test_create_and_continue_with_issue_id | |
178 | @request.session[:user_id] = 2 |
|
178 | @request.session[:user_id] = 2 | |
179 | post :create, :project_id => 1, |
|
179 | post :create, :project_id => 1, | |
180 | :time_entry => {:activity_id => '11', |
|
180 | :time_entry => {:activity_id => '11', | |
181 | :issue_id => '1', |
|
181 | :issue_id => '1', | |
182 | :spent_on => '2008-03-14', |
|
182 | :spent_on => '2008-03-14', | |
183 | :hours => '7.3'}, |
|
183 | :hours => '7.3'}, | |
184 | :continue => '1' |
|
184 | :continue => '1' | |
185 | assert_redirected_to '/projects/ecookbook/issues/1/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=1' |
|
185 | assert_redirected_to '/projects/ecookbook/issues/1/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=1' | |
186 | end |
|
186 | end | |
187 |
|
187 | |||
188 | def test_create_and_continue_without_project |
|
188 | def test_create_and_continue_without_project | |
189 | @request.session[:user_id] = 2 |
|
189 | @request.session[:user_id] = 2 | |
190 | post :create, :time_entry => {:project_id => '1', |
|
190 | post :create, :time_entry => {:project_id => '1', | |
191 | :activity_id => '11', |
|
191 | :activity_id => '11', | |
192 | :issue_id => '', |
|
192 | :issue_id => '', | |
193 | :spent_on => '2008-03-14', |
|
193 | :spent_on => '2008-03-14', | |
194 | :hours => '7.3'}, |
|
194 | :hours => '7.3'}, | |
195 | :continue => '1' |
|
195 | :continue => '1' | |
196 |
|
196 | |||
197 | assert_redirected_to '/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=&time_entry%5Bproject_id%5D=1' |
|
197 | assert_redirected_to '/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=&time_entry%5Bproject_id%5D=1' | |
198 | end |
|
198 | end | |
199 |
|
199 | |||
200 | def test_create_without_log_time_permission_should_be_denied |
|
200 | def test_create_without_log_time_permission_should_be_denied | |
201 | @request.session[:user_id] = 2 |
|
201 | @request.session[:user_id] = 2 | |
202 | Role.find_by_name('Manager').remove_permission! :log_time |
|
202 | Role.find_by_name('Manager').remove_permission! :log_time | |
203 | post :create, :project_id => 1, |
|
203 | post :create, :project_id => 1, | |
204 | :time_entry => {:activity_id => '11', |
|
204 | :time_entry => {:activity_id => '11', | |
205 | :issue_id => '', |
|
205 | :issue_id => '', | |
206 | :spent_on => '2008-03-14', |
|
206 | :spent_on => '2008-03-14', | |
207 | :hours => '7.3'} |
|
207 | :hours => '7.3'} | |
208 |
|
208 | |||
209 | assert_response 403 |
|
209 | assert_response 403 | |
210 | end |
|
210 | end | |
211 |
|
211 | |||
212 | def test_create_with_failure |
|
212 | def test_create_with_failure | |
213 | @request.session[:user_id] = 2 |
|
213 | @request.session[:user_id] = 2 | |
214 | post :create, :project_id => 1, |
|
214 | post :create, :project_id => 1, | |
215 | :time_entry => {:activity_id => '', |
|
215 | :time_entry => {:activity_id => '', | |
216 | :issue_id => '', |
|
216 | :issue_id => '', | |
217 | :spent_on => '2008-03-14', |
|
217 | :spent_on => '2008-03-14', | |
218 | :hours => '7.3'} |
|
218 | :hours => '7.3'} | |
219 |
|
219 | |||
220 | assert_response :success |
|
220 | assert_response :success | |
221 | assert_template 'new' |
|
221 | assert_template 'new' | |
222 | end |
|
222 | end | |
223 |
|
223 | |||
224 | def test_create_without_project |
|
224 | def test_create_without_project | |
225 | @request.session[:user_id] = 2 |
|
225 | @request.session[:user_id] = 2 | |
226 | assert_difference 'TimeEntry.count' do |
|
226 | assert_difference 'TimeEntry.count' do | |
227 | post :create, :time_entry => {:project_id => '1', |
|
227 | post :create, :time_entry => {:project_id => '1', | |
228 | :activity_id => '11', |
|
228 | :activity_id => '11', | |
229 | :issue_id => '', |
|
229 | :issue_id => '', | |
230 | :spent_on => '2008-03-14', |
|
230 | :spent_on => '2008-03-14', | |
231 | :hours => '7.3'} |
|
231 | :hours => '7.3'} | |
232 | end |
|
232 | end | |
233 |
|
233 | |||
234 | assert_redirected_to '/projects/ecookbook/time_entries' |
|
234 | assert_redirected_to '/projects/ecookbook/time_entries' | |
235 | time_entry = TimeEntry.first(:order => 'id DESC') |
|
235 | time_entry = TimeEntry.first(:order => 'id DESC') | |
236 | assert_equal 1, time_entry.project_id |
|
236 | assert_equal 1, time_entry.project_id | |
237 | end |
|
237 | end | |
238 |
|
238 | |||
239 | def test_create_without_project_should_fail_with_issue_not_inside_project |
|
239 | def test_create_without_project_should_fail_with_issue_not_inside_project | |
240 | @request.session[:user_id] = 2 |
|
240 | @request.session[:user_id] = 2 | |
241 | assert_no_difference 'TimeEntry.count' do |
|
241 | assert_no_difference 'TimeEntry.count' do | |
242 | post :create, :time_entry => {:project_id => '1', |
|
242 | post :create, :time_entry => {:project_id => '1', | |
243 | :activity_id => '11', |
|
243 | :activity_id => '11', | |
244 | :issue_id => '5', |
|
244 | :issue_id => '5', | |
245 | :spent_on => '2008-03-14', |
|
245 | :spent_on => '2008-03-14', | |
246 | :hours => '7.3'} |
|
246 | :hours => '7.3'} | |
247 | end |
|
247 | end | |
248 |
|
248 | |||
249 | assert_response :success |
|
249 | assert_response :success | |
250 | assert assigns(:time_entry).errors[:issue_id].present? |
|
250 | assert assigns(:time_entry).errors[:issue_id].present? | |
251 | end |
|
251 | end | |
252 |
|
252 | |||
253 | def test_create_without_project_should_deny_without_permission |
|
253 | def test_create_without_project_should_deny_without_permission | |
254 | @request.session[:user_id] = 2 |
|
254 | @request.session[:user_id] = 2 | |
255 | Project.find(3).disable_module!(:time_tracking) |
|
255 | Project.find(3).disable_module!(:time_tracking) | |
256 |
|
256 | |||
257 | assert_no_difference 'TimeEntry.count' do |
|
257 | assert_no_difference 'TimeEntry.count' do | |
258 | post :create, :time_entry => {:project_id => '3', |
|
258 | post :create, :time_entry => {:project_id => '3', | |
259 | :activity_id => '11', |
|
259 | :activity_id => '11', | |
260 | :issue_id => '', |
|
260 | :issue_id => '', | |
261 | :spent_on => '2008-03-14', |
|
261 | :spent_on => '2008-03-14', | |
262 | :hours => '7.3'} |
|
262 | :hours => '7.3'} | |
263 | end |
|
263 | end | |
264 |
|
264 | |||
265 | assert_response 403 |
|
265 | assert_response 403 | |
266 | end |
|
266 | end | |
267 |
|
267 | |||
268 | def test_create_without_project_with_failure |
|
268 | def test_create_without_project_with_failure | |
269 | @request.session[:user_id] = 2 |
|
269 | @request.session[:user_id] = 2 | |
270 | assert_no_difference 'TimeEntry.count' do |
|
270 | assert_no_difference 'TimeEntry.count' do | |
271 | post :create, :time_entry => {:project_id => '1', |
|
271 | post :create, :time_entry => {:project_id => '1', | |
272 | :activity_id => '11', |
|
272 | :activity_id => '11', | |
273 | :issue_id => '', |
|
273 | :issue_id => '', | |
274 | :spent_on => '2008-03-14', |
|
274 | :spent_on => '2008-03-14', | |
275 | :hours => ''} |
|
275 | :hours => ''} | |
276 | end |
|
276 | end | |
277 |
|
277 | |||
278 | assert_response :success |
|
278 | assert_response :success | |
279 | assert_tag 'select', :attributes => {:name => 'time_entry[project_id]'}, |
|
279 | assert_tag 'select', :attributes => {:name => 'time_entry[project_id]'}, | |
280 | :child => {:tag => 'option', :attributes => {:value => '1', :selected => 'selected'}} |
|
280 | :child => {:tag => 'option', :attributes => {:value => '1', :selected => 'selected'}} | |
281 | end |
|
281 | end | |
282 |
|
282 | |||
283 | def test_update |
|
283 | def test_update | |
284 | entry = TimeEntry.find(1) |
|
284 | entry = TimeEntry.find(1) | |
285 | assert_equal 1, entry.issue_id |
|
285 | assert_equal 1, entry.issue_id | |
286 | assert_equal 2, entry.user_id |
|
286 | assert_equal 2, entry.user_id | |
287 |
|
287 | |||
288 | @request.session[:user_id] = 1 |
|
288 | @request.session[:user_id] = 1 | |
289 | put :update, :id => 1, |
|
289 | put :update, :id => 1, | |
290 | :time_entry => {:issue_id => '2', |
|
290 | :time_entry => {:issue_id => '2', | |
291 | :hours => '8'} |
|
291 | :hours => '8'} | |
292 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
292 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
293 | entry.reload |
|
293 | entry.reload | |
294 |
|
294 | |||
295 | assert_equal 8, entry.hours |
|
295 | assert_equal 8, entry.hours | |
296 | assert_equal 2, entry.issue_id |
|
296 | assert_equal 2, entry.issue_id | |
297 | assert_equal 2, entry.user_id |
|
297 | assert_equal 2, entry.user_id | |
298 | end |
|
298 | end | |
299 |
|
299 | |||
300 | def test_get_bulk_edit |
|
300 | def test_get_bulk_edit | |
301 | @request.session[:user_id] = 2 |
|
301 | @request.session[:user_id] = 2 | |
302 | get :bulk_edit, :ids => [1, 2] |
|
302 | get :bulk_edit, :ids => [1, 2] | |
303 | assert_response :success |
|
303 | assert_response :success | |
304 | assert_template 'bulk_edit' |
|
304 | assert_template 'bulk_edit' | |
305 |
|
305 | |||
306 | # System wide custom field |
|
306 | # System wide custom field | |
307 | assert_tag :select, :attributes => {:name => 'time_entry[custom_field_values][10]'} |
|
307 | assert_tag :select, :attributes => {:name => 'time_entry[custom_field_values][10]'} | |
308 |
|
308 | |||
309 | # Activities |
|
309 | # Activities | |
310 | assert_select 'select[name=?]', 'time_entry[activity_id]' do |
|
310 | assert_select 'select[name=?]', 'time_entry[activity_id]' do | |
311 | assert_select 'option[value=]', :text => '(No change)' |
|
311 | assert_select 'option[value=]', :text => '(No change)' | |
312 | assert_select 'option[value=9]', :text => 'Design' |
|
312 | assert_select 'option[value=9]', :text => 'Design' | |
313 | end |
|
313 | end | |
314 | end |
|
314 | end | |
315 |
|
315 | |||
316 | def test_get_bulk_edit_on_different_projects |
|
316 | def test_get_bulk_edit_on_different_projects | |
317 | @request.session[:user_id] = 2 |
|
317 | @request.session[:user_id] = 2 | |
318 | get :bulk_edit, :ids => [1, 2, 6] |
|
318 | get :bulk_edit, :ids => [1, 2, 6] | |
319 | assert_response :success |
|
319 | assert_response :success | |
320 | assert_template 'bulk_edit' |
|
320 | assert_template 'bulk_edit' | |
321 | end |
|
321 | end | |
322 |
|
322 | |||
323 | def test_bulk_update |
|
323 | def test_bulk_update | |
324 | @request.session[:user_id] = 2 |
|
324 | @request.session[:user_id] = 2 | |
325 | # update time entry activity |
|
325 | # update time entry activity | |
326 | post :bulk_update, :ids => [1, 2], :time_entry => { :activity_id => 9} |
|
326 | post :bulk_update, :ids => [1, 2], :time_entry => { :activity_id => 9} | |
327 |
|
327 | |||
328 | assert_response 302 |
|
328 | assert_response 302 | |
329 | # check that the issues were updated |
|
329 | # check that the issues were updated | |
330 | assert_equal [9, 9], TimeEntry.find_all_by_id([1, 2]).collect {|i| i.activity_id} |
|
330 | assert_equal [9, 9], TimeEntry.find_all_by_id([1, 2]).collect {|i| i.activity_id} | |
331 | end |
|
331 | end | |
332 |
|
332 | |||
333 | def test_bulk_update_with_failure |
|
333 | def test_bulk_update_with_failure | |
334 | @request.session[:user_id] = 2 |
|
334 | @request.session[:user_id] = 2 | |
335 | post :bulk_update, :ids => [1, 2], :time_entry => { :hours => 'A'} |
|
335 | post :bulk_update, :ids => [1, 2], :time_entry => { :hours => 'A'} | |
336 |
|
336 | |||
337 | assert_response 302 |
|
337 | assert_response 302 | |
338 | assert_match /Failed to save 2 time entrie/, flash[:error] |
|
338 | assert_match /Failed to save 2 time entrie/, flash[:error] | |
339 | end |
|
339 | end | |
340 |
|
340 | |||
341 | def test_bulk_update_on_different_projects |
|
341 | def test_bulk_update_on_different_projects | |
342 | @request.session[:user_id] = 2 |
|
342 | @request.session[:user_id] = 2 | |
343 | # makes user a manager on the other project |
|
343 | # makes user a manager on the other project | |
344 | Member.create!(:user_id => 2, :project_id => 3, :role_ids => [1]) |
|
344 | Member.create!(:user_id => 2, :project_id => 3, :role_ids => [1]) | |
345 |
|
345 | |||
346 | # update time entry activity |
|
346 | # update time entry activity | |
347 | post :bulk_update, :ids => [1, 2, 4], :time_entry => { :activity_id => 9 } |
|
347 | post :bulk_update, :ids => [1, 2, 4], :time_entry => { :activity_id => 9 } | |
348 |
|
348 | |||
349 | assert_response 302 |
|
349 | assert_response 302 | |
350 | # check that the issues were updated |
|
350 | # check that the issues were updated | |
351 | assert_equal [9, 9, 9], TimeEntry.find_all_by_id([1, 2, 4]).collect {|i| i.activity_id} |
|
351 | assert_equal [9, 9, 9], TimeEntry.find_all_by_id([1, 2, 4]).collect {|i| i.activity_id} | |
352 | end |
|
352 | end | |
353 |
|
353 | |||
354 | def test_bulk_update_on_different_projects_without_rights |
|
354 | def test_bulk_update_on_different_projects_without_rights | |
355 | @request.session[:user_id] = 3 |
|
355 | @request.session[:user_id] = 3 | |
356 | user = User.find(3) |
|
356 | user = User.find(3) | |
357 | action = { :controller => "timelog", :action => "bulk_update" } |
|
357 | action = { :controller => "timelog", :action => "bulk_update" } | |
358 | assert user.allowed_to?(action, TimeEntry.find(1).project) |
|
358 | assert user.allowed_to?(action, TimeEntry.find(1).project) | |
359 | assert ! user.allowed_to?(action, TimeEntry.find(5).project) |
|
359 | assert ! user.allowed_to?(action, TimeEntry.find(5).project) | |
360 | post :bulk_update, :ids => [1, 5], :time_entry => { :activity_id => 9 } |
|
360 | post :bulk_update, :ids => [1, 5], :time_entry => { :activity_id => 9 } | |
361 | assert_response 403 |
|
361 | assert_response 403 | |
362 | end |
|
362 | end | |
363 |
|
363 | |||
364 | def test_bulk_update_custom_field |
|
364 | def test_bulk_update_custom_field | |
365 | @request.session[:user_id] = 2 |
|
365 | @request.session[:user_id] = 2 | |
366 | post :bulk_update, :ids => [1, 2], :time_entry => { :custom_field_values => {'10' => '0'} } |
|
366 | post :bulk_update, :ids => [1, 2], :time_entry => { :custom_field_values => {'10' => '0'} } | |
367 |
|
367 | |||
368 | assert_response 302 |
|
368 | assert_response 302 | |
369 | assert_equal ["0", "0"], TimeEntry.find_all_by_id([1, 2]).collect {|i| i.custom_value_for(10).value} |
|
369 | assert_equal ["0", "0"], TimeEntry.find_all_by_id([1, 2]).collect {|i| i.custom_value_for(10).value} | |
370 | end |
|
370 | end | |
371 |
|
371 | |||
372 | def test_post_bulk_update_should_redirect_back_using_the_back_url_parameter |
|
372 | def test_post_bulk_update_should_redirect_back_using_the_back_url_parameter | |
373 | @request.session[:user_id] = 2 |
|
373 | @request.session[:user_id] = 2 | |
374 | post :bulk_update, :ids => [1,2], :back_url => '/time_entries' |
|
374 | post :bulk_update, :ids => [1,2], :back_url => '/time_entries' | |
375 |
|
375 | |||
376 | assert_response :redirect |
|
376 | assert_response :redirect | |
377 | assert_redirected_to '/time_entries' |
|
377 | assert_redirected_to '/time_entries' | |
378 | end |
|
378 | end | |
379 |
|
379 | |||
380 | def test_post_bulk_update_should_not_redirect_back_using_the_back_url_parameter_off_the_host |
|
380 | def test_post_bulk_update_should_not_redirect_back_using_the_back_url_parameter_off_the_host | |
381 | @request.session[:user_id] = 2 |
|
381 | @request.session[:user_id] = 2 | |
382 | post :bulk_update, :ids => [1,2], :back_url => 'http://google.com' |
|
382 | post :bulk_update, :ids => [1,2], :back_url => 'http://google.com' | |
383 |
|
383 | |||
384 | assert_response :redirect |
|
384 | assert_response :redirect | |
385 | assert_redirected_to :controller => 'timelog', :action => 'index', :project_id => Project.find(1).identifier |
|
385 | assert_redirected_to :controller => 'timelog', :action => 'index', :project_id => Project.find(1).identifier | |
386 | end |
|
386 | end | |
387 |
|
387 | |||
388 | def test_post_bulk_update_without_edit_permission_should_be_denied |
|
388 | def test_post_bulk_update_without_edit_permission_should_be_denied | |
389 | @request.session[:user_id] = 2 |
|
389 | @request.session[:user_id] = 2 | |
390 | Role.find_by_name('Manager').remove_permission! :edit_time_entries |
|
390 | Role.find_by_name('Manager').remove_permission! :edit_time_entries | |
391 | post :bulk_update, :ids => [1,2] |
|
391 | post :bulk_update, :ids => [1,2] | |
392 |
|
392 | |||
393 | assert_response 403 |
|
393 | assert_response 403 | |
394 | end |
|
394 | end | |
395 |
|
395 | |||
396 | def test_destroy |
|
396 | def test_destroy | |
397 | @request.session[:user_id] = 2 |
|
397 | @request.session[:user_id] = 2 | |
398 | delete :destroy, :id => 1 |
|
398 | delete :destroy, :id => 1 | |
399 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
399 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
400 | assert_equal I18n.t(:notice_successful_delete), flash[:notice] |
|
400 | assert_equal I18n.t(:notice_successful_delete), flash[:notice] | |
401 | assert_nil TimeEntry.find_by_id(1) |
|
401 | assert_nil TimeEntry.find_by_id(1) | |
402 | end |
|
402 | end | |
403 |
|
403 | |||
404 | def test_destroy_should_fail |
|
404 | def test_destroy_should_fail | |
405 | # simulate that this fails (e.g. due to a plugin), see #5700 |
|
405 | # simulate that this fails (e.g. due to a plugin), see #5700 | |
406 | TimeEntry.any_instance.expects(:destroy).returns(false) |
|
406 | TimeEntry.any_instance.expects(:destroy).returns(false) | |
407 |
|
407 | |||
408 | @request.session[:user_id] = 2 |
|
408 | @request.session[:user_id] = 2 | |
409 | delete :destroy, :id => 1 |
|
409 | delete :destroy, :id => 1 | |
410 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
410 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
411 | assert_equal I18n.t(:notice_unable_delete_time_entry), flash[:error] |
|
411 | assert_equal I18n.t(:notice_unable_delete_time_entry), flash[:error] | |
412 | assert_not_nil TimeEntry.find_by_id(1) |
|
412 | assert_not_nil TimeEntry.find_by_id(1) | |
413 | end |
|
413 | end | |
414 |
|
414 | |||
415 | def test_index_all_projects |
|
415 | def test_index_all_projects | |
416 | get :index |
|
416 | get :index | |
417 | assert_response :success |
|
417 | assert_response :success | |
418 | assert_template 'index' |
|
418 | assert_template 'index' | |
419 | assert_not_nil assigns(:total_hours) |
|
419 | assert_not_nil assigns(:total_hours) | |
420 | assert_equal "162.90", "%.2f" % assigns(:total_hours) |
|
420 | assert_equal "162.90", "%.2f" % assigns(:total_hours) | |
421 | assert_tag :form, |
|
421 | assert_tag :form, | |
422 | :attributes => {:action => "/time_entries", :id => 'query_form'} |
|
422 | :attributes => {:action => "/time_entries", :id => 'query_form'} | |
423 | end |
|
423 | end | |
424 |
|
424 | |||
425 | def test_index_all_projects_should_show_log_time_link |
|
425 | def test_index_all_projects_should_show_log_time_link | |
426 | @request.session[:user_id] = 2 |
|
426 | @request.session[:user_id] = 2 | |
427 | get :index |
|
427 | get :index | |
428 | assert_response :success |
|
428 | assert_response :success | |
429 | assert_template 'index' |
|
429 | assert_template 'index' | |
430 | assert_tag 'a', :attributes => {:href => '/time_entries/new'}, :content => /Log time/ |
|
430 | assert_tag 'a', :attributes => {:href => '/time_entries/new'}, :content => /Log time/ | |
431 | end |
|
431 | end | |
432 |
|
432 | |||
433 | def test_index_at_project_level |
|
433 | def test_index_at_project_level | |
434 | get :index, :project_id => 'ecookbook' |
|
434 | get :index, :project_id => 'ecookbook' | |
435 | assert_response :success |
|
435 | assert_response :success | |
436 | assert_template 'index' |
|
436 | assert_template 'index' | |
437 | assert_not_nil assigns(:entries) |
|
437 | assert_not_nil assigns(:entries) | |
438 | assert_equal 4, assigns(:entries).size |
|
438 | assert_equal 4, assigns(:entries).size | |
439 | # project and subproject |
|
439 | # project and subproject | |
440 | assert_equal [1, 3], assigns(:entries).collect(&:project_id).uniq.sort |
|
440 | assert_equal [1, 3], assigns(:entries).collect(&:project_id).uniq.sort | |
441 | assert_not_nil assigns(:total_hours) |
|
441 | assert_not_nil assigns(:total_hours) | |
442 | assert_equal "162.90", "%.2f" % assigns(:total_hours) |
|
442 | assert_equal "162.90", "%.2f" % assigns(:total_hours) | |
443 | # display all time by default |
|
443 | # display all time by default | |
444 | assert_nil assigns(:from) |
|
444 | assert_nil assigns(:from) | |
445 | assert_nil assigns(:to) |
|
445 | assert_nil assigns(:to) | |
446 | assert_tag :form, |
|
446 | assert_tag :form, | |
447 | :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} |
|
447 | :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} | |
448 | end |
|
448 | end | |
449 |
|
449 | |||
450 | def test_index_at_project_level_with_date_range |
|
450 | def test_index_at_project_level_with_date_range | |
451 | get :index, :project_id => 'ecookbook', :from => '2007-03-20', :to => '2007-04-30' |
|
451 | get :index, :project_id => 'ecookbook', :from => '2007-03-20', :to => '2007-04-30' | |
452 | assert_response :success |
|
452 | assert_response :success | |
453 | assert_template 'index' |
|
453 | assert_template 'index' | |
454 | assert_not_nil assigns(:entries) |
|
454 | assert_not_nil assigns(:entries) | |
455 | assert_equal 3, assigns(:entries).size |
|
455 | assert_equal 3, assigns(:entries).size | |
456 | assert_not_nil assigns(:total_hours) |
|
456 | assert_not_nil assigns(:total_hours) | |
457 | assert_equal "12.90", "%.2f" % assigns(:total_hours) |
|
457 | assert_equal "12.90", "%.2f" % assigns(:total_hours) | |
458 | assert_equal '2007-03-20'.to_date, assigns(:from) |
|
458 | assert_equal '2007-03-20'.to_date, assigns(:from) | |
459 | assert_equal '2007-04-30'.to_date, assigns(:to) |
|
459 | assert_equal '2007-04-30'.to_date, assigns(:to) | |
460 | assert_tag :form, |
|
460 | assert_tag :form, | |
461 | :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} |
|
461 | :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} | |
462 | end |
|
462 | end | |
463 |
|
463 | |||
464 | def test_index_at_project_level_with_period |
|
464 | def test_index_at_project_level_with_period | |
465 | get :index, :project_id => 'ecookbook', :period => '7_days' |
|
465 | get :index, :project_id => 'ecookbook', :period => '7_days' | |
466 | assert_response :success |
|
466 | assert_response :success | |
467 | assert_template 'index' |
|
467 | assert_template 'index' | |
468 | assert_not_nil assigns(:entries) |
|
468 | assert_not_nil assigns(:entries) | |
469 | assert_not_nil assigns(:total_hours) |
|
469 | assert_not_nil assigns(:total_hours) | |
470 | assert_equal Date.today - 7, assigns(:from) |
|
470 | assert_equal Date.today - 7, assigns(:from) | |
471 | assert_equal Date.today, assigns(:to) |
|
471 | assert_equal Date.today, assigns(:to) | |
472 | assert_tag :form, |
|
472 | assert_tag :form, | |
473 | :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} |
|
473 | :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} | |
474 | end |
|
474 | end | |
475 |
|
475 | |||
476 | def test_index_one_day |
|
476 | def test_index_one_day | |
477 | get :index, :project_id => 'ecookbook', :from => "2007-03-23", :to => "2007-03-23" |
|
477 | get :index, :project_id => 'ecookbook', :from => "2007-03-23", :to => "2007-03-23" | |
478 | assert_response :success |
|
478 | assert_response :success | |
479 | assert_template 'index' |
|
479 | assert_template 'index' | |
480 | assert_not_nil assigns(:total_hours) |
|
480 | assert_not_nil assigns(:total_hours) | |
481 | assert_equal "4.25", "%.2f" % assigns(:total_hours) |
|
481 | assert_equal "4.25", "%.2f" % assigns(:total_hours) | |
482 | assert_tag :form, |
|
482 | assert_tag :form, | |
483 | :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} |
|
483 | :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} | |
484 | end |
|
484 | end | |
485 |
|
485 | |||
486 | def test_index_from_a_date |
|
486 | def test_index_from_a_date | |
487 | get :index, :project_id => 'ecookbook', :from => "2007-03-23", :to => "" |
|
487 | get :index, :project_id => 'ecookbook', :from => "2007-03-23", :to => "" | |
488 | assert_equal '2007-03-23'.to_date, assigns(:from) |
|
488 | assert_equal '2007-03-23'.to_date, assigns(:from) | |
489 | assert_nil assigns(:to) |
|
489 | assert_nil assigns(:to) | |
490 | end |
|
490 | end | |
491 |
|
491 | |||
492 | def test_index_to_a_date |
|
492 | def test_index_to_a_date | |
493 | get :index, :project_id => 'ecookbook', :from => "", :to => "2007-03-23" |
|
493 | get :index, :project_id => 'ecookbook', :from => "", :to => "2007-03-23" | |
494 | assert_nil assigns(:from) |
|
494 | assert_nil assigns(:from) | |
495 | assert_equal '2007-03-23'.to_date, assigns(:to) |
|
495 | assert_equal '2007-03-23'.to_date, assigns(:to) | |
496 | end |
|
496 | end | |
497 |
|
497 | |||
498 | def test_index_today |
|
498 | def test_index_today | |
499 | Date.stubs(:today).returns('2011-12-15'.to_date) |
|
499 | Date.stubs(:today).returns('2011-12-15'.to_date) | |
500 | get :index, :period => 'today' |
|
500 | get :index, :period => 'today' | |
501 | assert_equal '2011-12-15'.to_date, assigns(:from) |
|
501 | assert_equal '2011-12-15'.to_date, assigns(:from) | |
502 | assert_equal '2011-12-15'.to_date, assigns(:to) |
|
502 | assert_equal '2011-12-15'.to_date, assigns(:to) | |
503 | end |
|
503 | end | |
504 |
|
504 | |||
505 | def test_index_yesterday |
|
505 | def test_index_yesterday | |
506 | Date.stubs(:today).returns('2011-12-15'.to_date) |
|
506 | Date.stubs(:today).returns('2011-12-15'.to_date) | |
507 | get :index, :period => 'yesterday' |
|
507 | get :index, :period => 'yesterday' | |
508 | assert_equal '2011-12-14'.to_date, assigns(:from) |
|
508 | assert_equal '2011-12-14'.to_date, assigns(:from) | |
509 | assert_equal '2011-12-14'.to_date, assigns(:to) |
|
509 | assert_equal '2011-12-14'.to_date, assigns(:to) | |
510 | end |
|
510 | end | |
511 |
|
511 | |||
512 | def test_index_current_week |
|
512 | def test_index_current_week | |
513 | Date.stubs(:today).returns('2011-12-15'.to_date) |
|
513 | Date.stubs(:today).returns('2011-12-15'.to_date) | |
514 | get :index, :period => 'current_week' |
|
514 | get :index, :period => 'current_week' | |
515 | assert_equal '2011-12-12'.to_date, assigns(:from) |
|
515 | assert_equal '2011-12-12'.to_date, assigns(:from) | |
516 | assert_equal '2011-12-18'.to_date, assigns(:to) |
|
516 | assert_equal '2011-12-18'.to_date, assigns(:to) | |
517 | end |
|
517 | end | |
518 |
|
518 | |||
519 | def test_index_last_week |
|
519 | def test_index_last_week | |
520 | Date.stubs(:today).returns('2011-12-15'.to_date) |
|
520 | Date.stubs(:today).returns('2011-12-15'.to_date) | |
521 | get :index, :period => 'current_week' |
|
|||
522 | assert_equal '2011-12-05'.to_date, assigns(:from) |
|
|||
523 | assert_equal '2011-12-11'.to_date, assigns(:to) |
|
|||
524 | end |
|
|||
525 |
|
||||
526 | def test_index_last_week |
|
|||
527 | Date.stubs(:today).returns('2011-12-15'.to_date) |
|
|||
528 | get :index, :period => 'last_week' |
|
521 | get :index, :period => 'last_week' | |
529 | assert_equal '2011-12-05'.to_date, assigns(:from) |
|
522 | assert_equal '2011-12-05'.to_date, assigns(:from) | |
530 | assert_equal '2011-12-11'.to_date, assigns(:to) |
|
523 | assert_equal '2011-12-11'.to_date, assigns(:to) | |
531 | end |
|
524 | end | |
532 |
|
525 | |||
533 | def test_index_7_days |
|
526 | def test_index_7_days | |
534 | Date.stubs(:today).returns('2011-12-15'.to_date) |
|
527 | Date.stubs(:today).returns('2011-12-15'.to_date) | |
535 | get :index, :period => '7_days' |
|
528 | get :index, :period => '7_days' | |
536 | assert_equal '2011-12-08'.to_date, assigns(:from) |
|
529 | assert_equal '2011-12-08'.to_date, assigns(:from) | |
537 | assert_equal '2011-12-15'.to_date, assigns(:to) |
|
530 | assert_equal '2011-12-15'.to_date, assigns(:to) | |
538 | end |
|
531 | end | |
539 |
|
532 | |||
540 | def test_index_current_month |
|
533 | def test_index_current_month | |
541 | Date.stubs(:today).returns('2011-12-15'.to_date) |
|
534 | Date.stubs(:today).returns('2011-12-15'.to_date) | |
542 | get :index, :period => 'current_month' |
|
535 | get :index, :period => 'current_month' | |
543 | assert_equal '2011-12-01'.to_date, assigns(:from) |
|
536 | assert_equal '2011-12-01'.to_date, assigns(:from) | |
544 | assert_equal '2011-12-31'.to_date, assigns(:to) |
|
537 | assert_equal '2011-12-31'.to_date, assigns(:to) | |
545 | end |
|
538 | end | |
546 |
|
539 | |||
547 | def test_index_last_month |
|
540 | def test_index_last_month | |
548 | Date.stubs(:today).returns('2011-12-15'.to_date) |
|
541 | Date.stubs(:today).returns('2011-12-15'.to_date) | |
549 | get :index, :period => 'last_month' |
|
542 | get :index, :period => 'last_month' | |
550 | assert_equal '2011-11-01'.to_date, assigns(:from) |
|
543 | assert_equal '2011-11-01'.to_date, assigns(:from) | |
551 | assert_equal '2011-11-30'.to_date, assigns(:to) |
|
544 | assert_equal '2011-11-30'.to_date, assigns(:to) | |
552 | end |
|
545 | end | |
553 |
|
546 | |||
554 | def test_index_30_days |
|
547 | def test_index_30_days | |
555 | Date.stubs(:today).returns('2011-12-15'.to_date) |
|
548 | Date.stubs(:today).returns('2011-12-15'.to_date) | |
556 | get :index, :period => '30_days' |
|
549 | get :index, :period => '30_days' | |
557 | assert_equal '2011-11-15'.to_date, assigns(:from) |
|
550 | assert_equal '2011-11-15'.to_date, assigns(:from) | |
558 | assert_equal '2011-12-15'.to_date, assigns(:to) |
|
551 | assert_equal '2011-12-15'.to_date, assigns(:to) | |
559 | end |
|
552 | end | |
560 |
|
553 | |||
561 | def test_index_current_year |
|
554 | def test_index_current_year | |
562 | Date.stubs(:today).returns('2011-12-15'.to_date) |
|
555 | Date.stubs(:today).returns('2011-12-15'.to_date) | |
563 | get :index, :period => 'current_year' |
|
556 | get :index, :period => 'current_year' | |
564 | assert_equal '2011-01-01'.to_date, assigns(:from) |
|
557 | assert_equal '2011-01-01'.to_date, assigns(:from) | |
565 | assert_equal '2011-12-31'.to_date, assigns(:to) |
|
558 | assert_equal '2011-12-31'.to_date, assigns(:to) | |
566 | end |
|
559 | end | |
567 |
|
560 | |||
568 | def test_index_at_issue_level |
|
561 | def test_index_at_issue_level | |
569 | get :index, :issue_id => 1 |
|
562 | get :index, :issue_id => 1 | |
570 | assert_response :success |
|
563 | assert_response :success | |
571 | assert_template 'index' |
|
564 | assert_template 'index' | |
572 | assert_not_nil assigns(:entries) |
|
565 | assert_not_nil assigns(:entries) | |
573 | assert_equal 2, assigns(:entries).size |
|
566 | assert_equal 2, assigns(:entries).size | |
574 | assert_not_nil assigns(:total_hours) |
|
567 | assert_not_nil assigns(:total_hours) | |
575 | assert_equal 154.25, assigns(:total_hours) |
|
568 | assert_equal 154.25, assigns(:total_hours) | |
576 | # display all time |
|
569 | # display all time | |
577 | assert_nil assigns(:from) |
|
570 | assert_nil assigns(:from) | |
578 | assert_nil assigns(:to) |
|
571 | assert_nil assigns(:to) | |
579 | # TODO: remove /projects/:project_id/issues/:issue_id/time_entries routes |
|
572 | # TODO: remove /projects/:project_id/issues/:issue_id/time_entries routes | |
580 | # to use /issues/:issue_id/time_entries |
|
573 | # to use /issues/:issue_id/time_entries | |
581 | assert_tag :form, |
|
574 | assert_tag :form, | |
582 | :attributes => {:action => "/projects/ecookbook/issues/1/time_entries", :id => 'query_form'} |
|
575 | :attributes => {:action => "/projects/ecookbook/issues/1/time_entries", :id => 'query_form'} | |
583 | end |
|
576 | end | |
584 |
|
577 | |||
585 | def test_index_should_sort_by_spent_on_and_created_on |
|
578 | def test_index_should_sort_by_spent_on_and_created_on | |
586 | t1 = TimeEntry.create!(:user => User.find(1), :project => Project.find(1), :hours => 1, :spent_on => '2012-06-16', :created_on => '2012-06-16 20:00:00', :activity_id => 10) |
|
579 | t1 = TimeEntry.create!(:user => User.find(1), :project => Project.find(1), :hours => 1, :spent_on => '2012-06-16', :created_on => '2012-06-16 20:00:00', :activity_id => 10) | |
587 | t2 = TimeEntry.create!(:user => User.find(1), :project => Project.find(1), :hours => 1, :spent_on => '2012-06-16', :created_on => '2012-06-16 20:05:00', :activity_id => 10) |
|
580 | t2 = TimeEntry.create!(:user => User.find(1), :project => Project.find(1), :hours => 1, :spent_on => '2012-06-16', :created_on => '2012-06-16 20:05:00', :activity_id => 10) | |
588 | t3 = TimeEntry.create!(:user => User.find(1), :project => Project.find(1), :hours => 1, :spent_on => '2012-06-15', :created_on => '2012-06-16 20:10:00', :activity_id => 10) |
|
581 | t3 = TimeEntry.create!(:user => User.find(1), :project => Project.find(1), :hours => 1, :spent_on => '2012-06-15', :created_on => '2012-06-16 20:10:00', :activity_id => 10) | |
589 |
|
582 | |||
590 | get :index, :project_id => 1, :from => '2012-06-15', :to => '2012-06-16' |
|
583 | get :index, :project_id => 1, :from => '2012-06-15', :to => '2012-06-16' | |
591 | assert_response :success |
|
584 | assert_response :success | |
592 | assert_equal [t2, t1, t3], assigns(:entries) |
|
585 | assert_equal [t2, t1, t3], assigns(:entries) | |
593 |
|
586 | |||
594 | get :index, :project_id => 1, :from => '2012-06-15', :to => '2012-06-16', :sort => 'spent_on' |
|
587 | get :index, :project_id => 1, :from => '2012-06-15', :to => '2012-06-16', :sort => 'spent_on' | |
595 | assert_response :success |
|
588 | assert_response :success | |
596 | assert_equal [t3, t1, t2], assigns(:entries) |
|
589 | assert_equal [t3, t1, t2], assigns(:entries) | |
597 | end |
|
590 | end | |
598 |
|
591 | |||
599 | def test_index_atom_feed |
|
592 | def test_index_atom_feed | |
600 | get :index, :project_id => 1, :format => 'atom' |
|
593 | get :index, :project_id => 1, :format => 'atom' | |
601 | assert_response :success |
|
594 | assert_response :success | |
602 | assert_equal 'application/atom+xml', @response.content_type |
|
595 | assert_equal 'application/atom+xml', @response.content_type | |
603 | assert_not_nil assigns(:items) |
|
596 | assert_not_nil assigns(:items) | |
604 | assert assigns(:items).first.is_a?(TimeEntry) |
|
597 | assert assigns(:items).first.is_a?(TimeEntry) | |
605 | end |
|
598 | end | |
606 |
|
599 | |||
607 | def test_index_all_projects_csv_export |
|
600 | def test_index_all_projects_csv_export | |
608 | Setting.date_format = '%m/%d/%Y' |
|
601 | Setting.date_format = '%m/%d/%Y' | |
609 | get :index, :format => 'csv' |
|
602 | get :index, :format => 'csv' | |
610 | assert_response :success |
|
603 | assert_response :success | |
611 | assert_equal 'text/csv; header=present', @response.content_type |
|
604 | assert_equal 'text/csv; header=present', @response.content_type | |
612 | assert @response.body.include?("Date,User,Activity,Project,Issue,Tracker,Subject,Hours,Comment,Overtime\n") |
|
605 | assert @response.body.include?("Date,User,Activity,Project,Issue,Tracker,Subject,Hours,Comment,Overtime\n") | |
613 | assert @response.body.include?("\n04/21/2007,redMine Admin,Design,eCookbook,3,Bug,Error 281 when updating a recipe,1.0,\"\",\"\"\n") |
|
606 | assert @response.body.include?("\n04/21/2007,redMine Admin,Design,eCookbook,3,Bug,Error 281 when updating a recipe,1.0,\"\",\"\"\n") | |
614 | end |
|
607 | end | |
615 |
|
608 | |||
616 | def test_index_csv_export |
|
609 | def test_index_csv_export | |
617 | Setting.date_format = '%m/%d/%Y' |
|
610 | Setting.date_format = '%m/%d/%Y' | |
618 | get :index, :project_id => 1, :format => 'csv' |
|
611 | get :index, :project_id => 1, :format => 'csv' | |
619 | assert_response :success |
|
612 | assert_response :success | |
620 | assert_equal 'text/csv; header=present', @response.content_type |
|
613 | assert_equal 'text/csv; header=present', @response.content_type | |
621 | assert @response.body.include?("Date,User,Activity,Project,Issue,Tracker,Subject,Hours,Comment,Overtime\n") |
|
614 | assert @response.body.include?("Date,User,Activity,Project,Issue,Tracker,Subject,Hours,Comment,Overtime\n") | |
622 | assert @response.body.include?("\n04/21/2007,redMine Admin,Design,eCookbook,3,Bug,Error 281 when updating a recipe,1.0,\"\",\"\"\n") |
|
615 | assert @response.body.include?("\n04/21/2007,redMine Admin,Design,eCookbook,3,Bug,Error 281 when updating a recipe,1.0,\"\",\"\"\n") | |
623 | end |
|
616 | end | |
624 |
|
617 | |||
625 | def test_index_csv_export_with_multi_custom_field |
|
618 | def test_index_csv_export_with_multi_custom_field | |
626 | field = TimeEntryCustomField.create!(:name => 'Test', :field_format => 'list', |
|
619 | field = TimeEntryCustomField.create!(:name => 'Test', :field_format => 'list', | |
627 | :multiple => true, :possible_values => ['value1', 'value2']) |
|
620 | :multiple => true, :possible_values => ['value1', 'value2']) | |
628 | entry = TimeEntry.find(1) |
|
621 | entry = TimeEntry.find(1) | |
629 | entry.custom_field_values = {field.id => ['value1', 'value2']} |
|
622 | entry.custom_field_values = {field.id => ['value1', 'value2']} | |
630 | entry.save! |
|
623 | entry.save! | |
631 |
|
624 | |||
632 | get :index, :project_id => 1, :format => 'csv' |
|
625 | get :index, :project_id => 1, :format => 'csv' | |
633 | assert_response :success |
|
626 | assert_response :success | |
634 | assert_include '"value1, value2"', @response.body |
|
627 | assert_include '"value1, value2"', @response.body | |
635 | end |
|
628 | end | |
636 |
|
629 | |||
637 | def test_csv_big_5 |
|
630 | def test_csv_big_5 | |
638 | user = User.find_by_id(3) |
|
631 | user = User.find_by_id(3) | |
639 | user.language = "zh-TW" |
|
632 | user.language = "zh-TW" | |
640 | assert user.save |
|
633 | assert user.save | |
641 | str_utf8 = "\xe4\xb8\x80\xe6\x9c\x88" |
|
634 | str_utf8 = "\xe4\xb8\x80\xe6\x9c\x88" | |
642 | str_big5 = "\xa4@\xa4\xeb" |
|
635 | str_big5 = "\xa4@\xa4\xeb" | |
643 | if str_utf8.respond_to?(:force_encoding) |
|
636 | if str_utf8.respond_to?(:force_encoding) | |
644 | str_utf8.force_encoding('UTF-8') |
|
637 | str_utf8.force_encoding('UTF-8') | |
645 | str_big5.force_encoding('Big5') |
|
638 | str_big5.force_encoding('Big5') | |
646 | end |
|
639 | end | |
647 | @request.session[:user_id] = 3 |
|
640 | @request.session[:user_id] = 3 | |
648 | post :create, :project_id => 1, |
|
641 | post :create, :project_id => 1, | |
649 | :time_entry => {:comments => str_utf8, |
|
642 | :time_entry => {:comments => str_utf8, | |
650 | # Not the default activity |
|
643 | # Not the default activity | |
651 | :activity_id => '11', |
|
644 | :activity_id => '11', | |
652 | :issue_id => '', |
|
645 | :issue_id => '', | |
653 | :spent_on => '2011-11-10', |
|
646 | :spent_on => '2011-11-10', | |
654 | :hours => '7.3'} |
|
647 | :hours => '7.3'} | |
655 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
648 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
656 |
|
649 | |||
657 | t = TimeEntry.find_by_comments(str_utf8) |
|
650 | t = TimeEntry.find_by_comments(str_utf8) | |
658 | assert_not_nil t |
|
651 | assert_not_nil t | |
659 | assert_equal 11, t.activity_id |
|
652 | assert_equal 11, t.activity_id | |
660 | assert_equal 7.3, t.hours |
|
653 | assert_equal 7.3, t.hours | |
661 | assert_equal 3, t.user_id |
|
654 | assert_equal 3, t.user_id | |
662 |
|
655 | |||
663 | get :index, :project_id => 1, :format => 'csv', |
|
656 | get :index, :project_id => 1, :format => 'csv', | |
664 | :from => '2011-11-10', :to => '2011-11-10' |
|
657 | :from => '2011-11-10', :to => '2011-11-10' | |
665 | assert_response :success |
|
658 | assert_response :success | |
666 | assert_equal 'text/csv; header=present', @response.content_type |
|
659 | assert_equal 'text/csv; header=present', @response.content_type | |
667 | ar = @response.body.chomp.split("\n") |
|
660 | ar = @response.body.chomp.split("\n") | |
668 | s1 = "\xa4\xe9\xb4\xc1" |
|
661 | s1 = "\xa4\xe9\xb4\xc1" | |
669 | if str_utf8.respond_to?(:force_encoding) |
|
662 | if str_utf8.respond_to?(:force_encoding) | |
670 | s1.force_encoding('Big5') |
|
663 | s1.force_encoding('Big5') | |
671 | end |
|
664 | end | |
672 | assert ar[0].include?(s1) |
|
665 | assert ar[0].include?(s1) | |
673 | assert ar[1].include?(str_big5) |
|
666 | assert ar[1].include?(str_big5) | |
674 | end |
|
667 | end | |
675 |
|
668 | |||
676 | def test_csv_cannot_convert_should_be_replaced_big_5 |
|
669 | def test_csv_cannot_convert_should_be_replaced_big_5 | |
677 | user = User.find_by_id(3) |
|
670 | user = User.find_by_id(3) | |
678 | user.language = "zh-TW" |
|
671 | user.language = "zh-TW" | |
679 | assert user.save |
|
672 | assert user.save | |
680 | str_utf8 = "\xe4\xbb\xa5\xe5\x86\x85" |
|
673 | str_utf8 = "\xe4\xbb\xa5\xe5\x86\x85" | |
681 | if str_utf8.respond_to?(:force_encoding) |
|
674 | if str_utf8.respond_to?(:force_encoding) | |
682 | str_utf8.force_encoding('UTF-8') |
|
675 | str_utf8.force_encoding('UTF-8') | |
683 | end |
|
676 | end | |
684 | @request.session[:user_id] = 3 |
|
677 | @request.session[:user_id] = 3 | |
685 | post :create, :project_id => 1, |
|
678 | post :create, :project_id => 1, | |
686 | :time_entry => {:comments => str_utf8, |
|
679 | :time_entry => {:comments => str_utf8, | |
687 | # Not the default activity |
|
680 | # Not the default activity | |
688 | :activity_id => '11', |
|
681 | :activity_id => '11', | |
689 | :issue_id => '', |
|
682 | :issue_id => '', | |
690 | :spent_on => '2011-11-10', |
|
683 | :spent_on => '2011-11-10', | |
691 | :hours => '7.3'} |
|
684 | :hours => '7.3'} | |
692 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
685 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
693 |
|
686 | |||
694 | t = TimeEntry.find_by_comments(str_utf8) |
|
687 | t = TimeEntry.find_by_comments(str_utf8) | |
695 | assert_not_nil t |
|
688 | assert_not_nil t | |
696 | assert_equal 11, t.activity_id |
|
689 | assert_equal 11, t.activity_id | |
697 | assert_equal 7.3, t.hours |
|
690 | assert_equal 7.3, t.hours | |
698 | assert_equal 3, t.user_id |
|
691 | assert_equal 3, t.user_id | |
699 |
|
692 | |||
700 | get :index, :project_id => 1, :format => 'csv', |
|
693 | get :index, :project_id => 1, :format => 'csv', | |
701 | :from => '2011-11-10', :to => '2011-11-10' |
|
694 | :from => '2011-11-10', :to => '2011-11-10' | |
702 | assert_response :success |
|
695 | assert_response :success | |
703 | assert_equal 'text/csv; header=present', @response.content_type |
|
696 | assert_equal 'text/csv; header=present', @response.content_type | |
704 | ar = @response.body.chomp.split("\n") |
|
697 | ar = @response.body.chomp.split("\n") | |
705 | s1 = "\xa4\xe9\xb4\xc1" |
|
698 | s1 = "\xa4\xe9\xb4\xc1" | |
706 | if str_utf8.respond_to?(:force_encoding) |
|
699 | if str_utf8.respond_to?(:force_encoding) | |
707 | s1.force_encoding('Big5') |
|
700 | s1.force_encoding('Big5') | |
708 | end |
|
701 | end | |
709 | assert ar[0].include?(s1) |
|
702 | assert ar[0].include?(s1) | |
710 | s2 = ar[1].split(",")[8] |
|
703 | s2 = ar[1].split(",")[8] | |
711 | if s2.respond_to?(:force_encoding) |
|
704 | if s2.respond_to?(:force_encoding) | |
712 | s3 = "\xa5H?" |
|
705 | s3 = "\xa5H?" | |
713 | s3.force_encoding('Big5') |
|
706 | s3.force_encoding('Big5') | |
714 | assert_equal s3, s2 |
|
707 | assert_equal s3, s2 | |
715 | elsif RUBY_PLATFORM == 'java' |
|
708 | elsif RUBY_PLATFORM == 'java' | |
716 | assert_equal "??", s2 |
|
709 | assert_equal "??", s2 | |
717 | else |
|
710 | else | |
718 | assert_equal "\xa5H???", s2 |
|
711 | assert_equal "\xa5H???", s2 | |
719 | end |
|
712 | end | |
720 | end |
|
713 | end | |
721 |
|
714 | |||
722 | def test_csv_tw |
|
715 | def test_csv_tw | |
723 | with_settings :default_language => "zh-TW" do |
|
716 | with_settings :default_language => "zh-TW" do | |
724 | str1 = "test_csv_tw" |
|
717 | str1 = "test_csv_tw" | |
725 | user = User.find_by_id(3) |
|
718 | user = User.find_by_id(3) | |
726 | te1 = TimeEntry.create(:spent_on => '2011-11-10', |
|
719 | te1 = TimeEntry.create(:spent_on => '2011-11-10', | |
727 | :hours => 999.9, |
|
720 | :hours => 999.9, | |
728 | :project => Project.find(1), |
|
721 | :project => Project.find(1), | |
729 | :user => user, |
|
722 | :user => user, | |
730 | :activity => TimeEntryActivity.find_by_name('Design'), |
|
723 | :activity => TimeEntryActivity.find_by_name('Design'), | |
731 | :comments => str1) |
|
724 | :comments => str1) | |
732 | te2 = TimeEntry.find_by_comments(str1) |
|
725 | te2 = TimeEntry.find_by_comments(str1) | |
733 | assert_not_nil te2 |
|
726 | assert_not_nil te2 | |
734 | assert_equal 999.9, te2.hours |
|
727 | assert_equal 999.9, te2.hours | |
735 | assert_equal 3, te2.user_id |
|
728 | assert_equal 3, te2.user_id | |
736 |
|
729 | |||
737 | get :index, :project_id => 1, :format => 'csv', |
|
730 | get :index, :project_id => 1, :format => 'csv', | |
738 | :from => '2011-11-10', :to => '2011-11-10' |
|
731 | :from => '2011-11-10', :to => '2011-11-10' | |
739 | assert_response :success |
|
732 | assert_response :success | |
740 | assert_equal 'text/csv; header=present', @response.content_type |
|
733 | assert_equal 'text/csv; header=present', @response.content_type | |
741 |
|
734 | |||
742 | ar = @response.body.chomp.split("\n") |
|
735 | ar = @response.body.chomp.split("\n") | |
743 | s2 = ar[1].split(",")[7] |
|
736 | s2 = ar[1].split(",")[7] | |
744 | assert_equal '999.9', s2 |
|
737 | assert_equal '999.9', s2 | |
745 |
|
738 | |||
746 | str_tw = "Traditional Chinese (\xe7\xb9\x81\xe9\xab\x94\xe4\xb8\xad\xe6\x96\x87)" |
|
739 | str_tw = "Traditional Chinese (\xe7\xb9\x81\xe9\xab\x94\xe4\xb8\xad\xe6\x96\x87)" | |
747 | if str_tw.respond_to?(:force_encoding) |
|
740 | if str_tw.respond_to?(:force_encoding) | |
748 | str_tw.force_encoding('UTF-8') |
|
741 | str_tw.force_encoding('UTF-8') | |
749 | end |
|
742 | end | |
750 | assert_equal str_tw, l(:general_lang_name) |
|
743 | assert_equal str_tw, l(:general_lang_name) | |
751 | assert_equal ',', l(:general_csv_separator) |
|
744 | assert_equal ',', l(:general_csv_separator) | |
752 | assert_equal '.', l(:general_csv_decimal_separator) |
|
745 | assert_equal '.', l(:general_csv_decimal_separator) | |
753 | end |
|
746 | end | |
754 | end |
|
747 | end | |
755 |
|
748 | |||
756 | def test_csv_fr |
|
749 | def test_csv_fr | |
757 | with_settings :default_language => "fr" do |
|
750 | with_settings :default_language => "fr" do | |
758 | str1 = "test_csv_fr" |
|
751 | str1 = "test_csv_fr" | |
759 | user = User.find_by_id(3) |
|
752 | user = User.find_by_id(3) | |
760 | te1 = TimeEntry.create(:spent_on => '2011-11-10', |
|
753 | te1 = TimeEntry.create(:spent_on => '2011-11-10', | |
761 | :hours => 999.9, |
|
754 | :hours => 999.9, | |
762 | :project => Project.find(1), |
|
755 | :project => Project.find(1), | |
763 | :user => user, |
|
756 | :user => user, | |
764 | :activity => TimeEntryActivity.find_by_name('Design'), |
|
757 | :activity => TimeEntryActivity.find_by_name('Design'), | |
765 | :comments => str1) |
|
758 | :comments => str1) | |
766 | te2 = TimeEntry.find_by_comments(str1) |
|
759 | te2 = TimeEntry.find_by_comments(str1) | |
767 | assert_not_nil te2 |
|
760 | assert_not_nil te2 | |
768 | assert_equal 999.9, te2.hours |
|
761 | assert_equal 999.9, te2.hours | |
769 | assert_equal 3, te2.user_id |
|
762 | assert_equal 3, te2.user_id | |
770 |
|
763 | |||
771 | get :index, :project_id => 1, :format => 'csv', |
|
764 | get :index, :project_id => 1, :format => 'csv', | |
772 | :from => '2011-11-10', :to => '2011-11-10' |
|
765 | :from => '2011-11-10', :to => '2011-11-10' | |
773 | assert_response :success |
|
766 | assert_response :success | |
774 | assert_equal 'text/csv; header=present', @response.content_type |
|
767 | assert_equal 'text/csv; header=present', @response.content_type | |
775 |
|
768 | |||
776 | ar = @response.body.chomp.split("\n") |
|
769 | ar = @response.body.chomp.split("\n") | |
777 | s2 = ar[1].split(";")[7] |
|
770 | s2 = ar[1].split(";")[7] | |
778 | assert_equal '999,9', s2 |
|
771 | assert_equal '999,9', s2 | |
779 |
|
772 | |||
780 | str_fr = "Fran\xc3\xa7ais" |
|
773 | str_fr = "Fran\xc3\xa7ais" | |
781 | if str_fr.respond_to?(:force_encoding) |
|
774 | if str_fr.respond_to?(:force_encoding) | |
782 | str_fr.force_encoding('UTF-8') |
|
775 | str_fr.force_encoding('UTF-8') | |
783 | end |
|
776 | end | |
784 | assert_equal str_fr, l(:general_lang_name) |
|
777 | assert_equal str_fr, l(:general_lang_name) | |
785 | assert_equal ';', l(:general_csv_separator) |
|
778 | assert_equal ';', l(:general_csv_separator) | |
786 | assert_equal ',', l(:general_csv_decimal_separator) |
|
779 | assert_equal ',', l(:general_csv_decimal_separator) | |
787 | end |
|
780 | end | |
788 | end |
|
781 | end | |
789 | end |
|
782 | end |
General Comments 0
You need to be logged in to leave comments.
Login now