chris@37
|
1 # -*- coding: utf-8 -*-
|
Chris@1464
|
2 # Redmine - project management software
|
Chris@1494
|
3 # Copyright (C) 2006-2014 Jean-Philippe Lang
|
Chris@1464
|
4 #
|
Chris@1464
|
5 # This program is free software; you can redistribute it and/or
|
Chris@1464
|
6 # modify it under the terms of the GNU General Public License
|
Chris@1464
|
7 # as published by the Free Software Foundation; either version 2
|
Chris@1464
|
8 # of the License, or (at your option) any later version.
|
Chris@1464
|
9 #
|
Chris@1464
|
10 # This program is distributed in the hope that it will be useful,
|
Chris@1464
|
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
Chris@1464
|
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
Chris@1464
|
13 # GNU General Public License for more details.
|
Chris@1464
|
14 #
|
Chris@1464
|
15 # You should have received a copy of the GNU General Public License
|
Chris@1464
|
16 # along with this program; if not, write to the Free Software
|
Chris@1464
|
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
Chris@1464
|
18
|
Chris@119
|
19 require File.expand_path('../../test_helper', __FILE__)
|
chris@37
|
20
|
chris@37
|
21 class TimeEntryReportsControllerTest < ActionController::TestCase
|
Chris@1115
|
22 tests TimelogController
|
Chris@1115
|
23
|
Chris@909
|
24 fixtures :projects, :enabled_modules, :roles, :members, :member_roles,
|
Chris@909
|
25 :issues, :time_entries, :users, :trackers, :enumerations,
|
Chris@1517
|
26 :issue_statuses, :custom_fields, :custom_values,
|
Chris@1517
|
27 :projects_trackers, :custom_fields_trackers,
|
Chris@1517
|
28 :custom_fields_projects
|
Chris@909
|
29
|
Chris@909
|
30 include Redmine::I18n
|
Chris@909
|
31
|
Chris@909
|
32 def setup
|
Chris@909
|
33 Setting.default_language = "en"
|
Chris@909
|
34 end
|
chris@37
|
35
|
Chris@441
|
36 def test_report_at_project_level
|
Chris@441
|
37 get :report, :project_id => 'ecookbook'
|
chris@37
|
38 assert_response :success
|
chris@37
|
39 assert_template 'report'
|
Chris@441
|
40 assert_tag :form,
|
Chris@441
|
41 :attributes => {:action => "/projects/ecookbook/time_entries/report", :id => 'query_form'}
|
chris@37
|
42 end
|
Chris@909
|
43
|
chris@37
|
44 def test_report_all_projects
|
chris@37
|
45 get :report
|
chris@37
|
46 assert_response :success
|
chris@37
|
47 assert_template 'report'
|
Chris@441
|
48 assert_tag :form,
|
Chris@441
|
49 :attributes => {:action => "/time_entries/report", :id => 'query_form'}
|
chris@37
|
50 end
|
Chris@909
|
51
|
chris@37
|
52 def test_report_all_projects_denied
|
chris@37
|
53 r = Role.anonymous
|
chris@37
|
54 r.permissions.delete(:view_time_entries)
|
chris@37
|
55 r.permissions_will_change!
|
chris@37
|
56 r.save
|
chris@37
|
57 get :report
|
chris@37
|
58 assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Ftime_entries%2Freport'
|
chris@37
|
59 end
|
Chris@909
|
60
|
chris@37
|
61 def test_report_all_projects_one_criteria
|
Chris@1115
|
62 get :report, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criteria => ['project']
|
chris@37
|
63 assert_response :success
|
chris@37
|
64 assert_template 'report'
|
Chris@1115
|
65 assert_not_nil assigns(:report)
|
Chris@1115
|
66 assert_equal "8.65", "%.2f" % assigns(:report).total_hours
|
chris@37
|
67 end
|
chris@37
|
68
|
chris@37
|
69 def test_report_all_time
|
Chris@1115
|
70 get :report, :project_id => 1, :criteria => ['project', 'issue']
|
chris@37
|
71 assert_response :success
|
chris@37
|
72 assert_template 'report'
|
Chris@1115
|
73 assert_not_nil assigns(:report)
|
Chris@1115
|
74 assert_equal "162.90", "%.2f" % assigns(:report).total_hours
|
chris@37
|
75 end
|
chris@37
|
76
|
chris@37
|
77 def test_report_all_time_by_day
|
Chris@1115
|
78 get :report, :project_id => 1, :criteria => ['project', 'issue'], :columns => 'day'
|
chris@37
|
79 assert_response :success
|
chris@37
|
80 assert_template 'report'
|
Chris@1115
|
81 assert_not_nil assigns(:report)
|
Chris@1115
|
82 assert_equal "162.90", "%.2f" % assigns(:report).total_hours
|
chris@37
|
83 assert_tag :tag => 'th', :content => '2007-03-12'
|
chris@37
|
84 end
|
Chris@909
|
85
|
chris@37
|
86 def test_report_one_criteria
|
Chris@1115
|
87 get :report, :project_id => 1, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criteria => ['project']
|
chris@37
|
88 assert_response :success
|
chris@37
|
89 assert_template 'report'
|
Chris@1115
|
90 assert_not_nil assigns(:report)
|
Chris@1115
|
91 assert_equal "8.65", "%.2f" % assigns(:report).total_hours
|
chris@37
|
92 end
|
Chris@909
|
93
|
Chris@1115
|
94 def test_report_two_criteria
|
Chris@1464
|
95 get :report, :project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criteria => ["user", "activity"]
|
chris@37
|
96 assert_response :success
|
chris@37
|
97 assert_template 'report'
|
Chris@1115
|
98 assert_not_nil assigns(:report)
|
Chris@1115
|
99 assert_equal "162.90", "%.2f" % assigns(:report).total_hours
|
Chris@1115
|
100 end
|
Chris@1115
|
101
|
Chris@1517
|
102 def test_report_custom_field_criteria_with_multiple_values_on_single_value_custom_field_should_not_fail
|
Chris@1115
|
103 field = TimeEntryCustomField.create!(:name => 'multi', :field_format => 'list', :possible_values => ['value1', 'value2'])
|
Chris@1115
|
104 entry = TimeEntry.create!(:project => Project.find(1), :hours => 1, :activity_id => 10, :user => User.find(2), :spent_on => Date.today)
|
Chris@1115
|
105 CustomValue.create!(:customized => entry, :custom_field => field, :value => 'value1')
|
Chris@1115
|
106 CustomValue.create!(:customized => entry, :custom_field => field, :value => 'value2')
|
Chris@1115
|
107
|
Chris@1115
|
108 get :report, :project_id => 1, :columns => 'day', :criteria => ["cf_#{field.id}"]
|
Chris@1115
|
109 assert_response :success
|
chris@37
|
110 end
|
Chris@909
|
111
|
Chris@1517
|
112 def test_report_multiple_values_custom_fields_should_not_be_proposed
|
Chris@1517
|
113 TimeEntryCustomField.create!(:name => 'Single', :field_format => 'list', :possible_values => ['value1', 'value2'])
|
Chris@1517
|
114 TimeEntryCustomField.create!(:name => 'Multi', :field_format => 'list', :multiple => true, :possible_values => ['value1', 'value2'])
|
Chris@1517
|
115
|
Chris@1517
|
116 get :report, :project_id => 1
|
Chris@1517
|
117 assert_response :success
|
Chris@1517
|
118 assert_select 'select[name=?]', 'criteria[]' do
|
Chris@1517
|
119 assert_select 'option', :text => 'Single'
|
Chris@1517
|
120 assert_select 'option', :text => 'Multi', :count => 0
|
Chris@1517
|
121 end
|
Chris@1517
|
122 end
|
Chris@1517
|
123
|
chris@37
|
124 def test_report_one_day
|
Chris@1464
|
125 get :report, :project_id => 1, :columns => 'day', :from => "2007-03-23", :to => "2007-03-23", :criteria => ["user", "activity"]
|
chris@37
|
126 assert_response :success
|
chris@37
|
127 assert_template 'report'
|
Chris@1115
|
128 assert_not_nil assigns(:report)
|
Chris@1115
|
129 assert_equal "4.25", "%.2f" % assigns(:report).total_hours
|
chris@37
|
130 end
|
Chris@909
|
131
|
chris@37
|
132 def test_report_at_issue_level
|
Chris@1464
|
133 get :report, :project_id => 1, :issue_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criteria => ["user", "activity"]
|
chris@37
|
134 assert_response :success
|
chris@37
|
135 assert_template 'report'
|
Chris@1115
|
136 assert_not_nil assigns(:report)
|
Chris@1115
|
137 assert_equal "154.25", "%.2f" % assigns(:report).total_hours
|
Chris@441
|
138 assert_tag :form,
|
Chris@441
|
139 :attributes => {:action => "/projects/ecookbook/issues/1/time_entries/report", :id => 'query_form'}
|
chris@37
|
140 end
|
Chris@909
|
141
|
Chris@1464
|
142 def test_report_by_week_should_use_commercial_year
|
Chris@1464
|
143 TimeEntry.delete_all
|
Chris@1464
|
144 TimeEntry.generate!(:hours => '2', :spent_on => '2009-12-25') # 2009-52
|
Chris@1464
|
145 TimeEntry.generate!(:hours => '4', :spent_on => '2009-12-31') # 2009-53
|
Chris@1464
|
146 TimeEntry.generate!(:hours => '8', :spent_on => '2010-01-01') # 2009-53
|
Chris@1464
|
147 TimeEntry.generate!(:hours => '16', :spent_on => '2010-01-05') # 2010-1
|
Chris@1464
|
148
|
Chris@1464
|
149 get :report, :columns => 'week', :from => "2009-12-25", :to => "2010-01-05", :criteria => ["project"]
|
Chris@1464
|
150 assert_response :success
|
Chris@1464
|
151
|
Chris@1464
|
152 assert_select '#time-report thead tr' do
|
Chris@1464
|
153 assert_select 'th:nth-child(1)', :text => 'Project'
|
Chris@1464
|
154 assert_select 'th:nth-child(2)', :text => '2009-52'
|
Chris@1464
|
155 assert_select 'th:nth-child(3)', :text => '2009-53'
|
Chris@1464
|
156 assert_select 'th:nth-child(4)', :text => '2010-1'
|
Chris@1464
|
157 assert_select 'th:nth-child(5)', :text => 'Total time'
|
Chris@1464
|
158 end
|
Chris@1464
|
159 assert_select '#time-report tbody tr' do
|
Chris@1464
|
160 assert_select 'td:nth-child(1)', :text => 'eCookbook'
|
Chris@1464
|
161 assert_select 'td:nth-child(2)', :text => '2.00'
|
Chris@1464
|
162 assert_select 'td:nth-child(3)', :text => '12.00'
|
Chris@1464
|
163 assert_select 'td:nth-child(4)', :text => '16.00'
|
Chris@1464
|
164 assert_select 'td:nth-child(5)', :text => '30.00' # Total
|
Chris@1464
|
165 end
|
Chris@1464
|
166 end
|
Chris@1464
|
167
|
Chris@1464
|
168 def test_report_should_propose_association_custom_fields
|
Chris@1464
|
169 get :report
|
Chris@1464
|
170 assert_response :success
|
Chris@1464
|
171 assert_template 'report'
|
Chris@1464
|
172
|
Chris@1464
|
173 assert_select 'select[name=?]', 'criteria[]' do
|
Chris@1464
|
174 assert_select 'option[value=cf_1]', {:text => 'Database'}, 'Issue custom field not found'
|
Chris@1464
|
175 assert_select 'option[value=cf_3]', {:text => 'Development status'}, 'Project custom field not found'
|
Chris@1464
|
176 assert_select 'option[value=cf_7]', {:text => 'Billable'}, 'TimeEntryActivity custom field not found'
|
Chris@1464
|
177 end
|
Chris@1464
|
178 end
|
Chris@1464
|
179
|
Chris@1464
|
180 def test_report_with_association_custom_fields
|
Chris@1464
|
181 get :report, :criteria => ['cf_1', 'cf_3', 'cf_7']
|
chris@37
|
182 assert_response :success
|
chris@37
|
183 assert_template 'report'
|
Chris@1115
|
184 assert_not_nil assigns(:report)
|
Chris@1115
|
185 assert_equal 3, assigns(:report).criteria.size
|
Chris@1115
|
186 assert_equal "162.90", "%.2f" % assigns(:report).total_hours
|
Chris@1464
|
187
|
Chris@1464
|
188 # Custom fields columns
|
Chris@1464
|
189 assert_select 'th', :text => 'Database'
|
Chris@1464
|
190 assert_select 'th', :text => 'Development status'
|
Chris@1464
|
191 assert_select 'th', :text => 'Billable'
|
Chris@1464
|
192
|
chris@37
|
193 # Custom field row
|
Chris@1464
|
194 assert_select 'tr' do
|
Chris@1464
|
195 assert_select 'td', :text => 'MySQL'
|
Chris@1464
|
196 assert_select 'td.hours', :text => '1.00'
|
Chris@1464
|
197 end
|
chris@37
|
198 end
|
Chris@909
|
199
|
chris@37
|
200 def test_report_one_criteria_no_result
|
Chris@1115
|
201 get :report, :project_id => 1, :columns => 'week', :from => "1998-04-01", :to => "1998-04-30", :criteria => ['project']
|
chris@37
|
202 assert_response :success
|
chris@37
|
203 assert_template 'report'
|
Chris@1115
|
204 assert_not_nil assigns(:report)
|
Chris@1115
|
205 assert_equal "0.00", "%.2f" % assigns(:report).total_hours
|
Chris@1115
|
206 end
|
Chris@1115
|
207
|
Chris@1115
|
208 def test_report_status_criterion
|
Chris@1115
|
209 get :report, :project_id => 1, :criteria => ['status']
|
Chris@1115
|
210 assert_response :success
|
Chris@1115
|
211 assert_template 'report'
|
Chris@1115
|
212 assert_tag :tag => 'th', :content => 'Status'
|
Chris@1115
|
213 assert_tag :tag => 'td', :content => 'New'
|
chris@37
|
214 end
|
Chris@909
|
215
|
chris@37
|
216 def test_report_all_projects_csv_export
|
Chris@909
|
217 get :report, :columns => 'month', :from => "2007-01-01", :to => "2007-06-30",
|
Chris@1464
|
218 :criteria => ["project", "user", "activity"], :format => "csv"
|
chris@37
|
219 assert_response :success
|
Chris@1115
|
220 assert_equal 'text/csv; header=present', @response.content_type
|
chris@37
|
221 lines = @response.body.chomp.split("\n")
|
chris@37
|
222 # Headers
|
Chris@1464
|
223 assert_equal 'Project,User,Activity,2007-3,2007-4,Total time', lines.first
|
chris@37
|
224 # Total row
|
Chris@1464
|
225 assert_equal 'Total time,"","",154.25,8.65,162.90', lines.last
|
chris@37
|
226 end
|
Chris@909
|
227
|
chris@37
|
228 def test_report_csv_export
|
Chris@909
|
229 get :report, :project_id => 1, :columns => 'month',
|
Chris@909
|
230 :from => "2007-01-01", :to => "2007-06-30",
|
Chris@1464
|
231 :criteria => ["project", "user", "activity"], :format => "csv"
|
chris@37
|
232 assert_response :success
|
Chris@1115
|
233 assert_equal 'text/csv; header=present', @response.content_type
|
chris@37
|
234 lines = @response.body.chomp.split("\n")
|
chris@37
|
235 # Headers
|
Chris@1464
|
236 assert_equal 'Project,User,Activity,2007-3,2007-4,Total time', lines.first
|
chris@37
|
237 # Total row
|
Chris@1464
|
238 assert_equal 'Total time,"","",154.25,8.65,162.90', lines.last
|
chris@37
|
239 end
|
Chris@909
|
240
|
Chris@909
|
241 def test_csv_big_5
|
Chris@909
|
242 Setting.default_language = "zh-TW"
|
Chris@909
|
243 str_utf8 = "\xe4\xb8\x80\xe6\x9c\x88"
|
Chris@909
|
244 str_big5 = "\xa4@\xa4\xeb"
|
Chris@909
|
245 if str_utf8.respond_to?(:force_encoding)
|
Chris@909
|
246 str_utf8.force_encoding('UTF-8')
|
Chris@909
|
247 str_big5.force_encoding('Big5')
|
Chris@909
|
248 end
|
Chris@909
|
249 user = User.find_by_id(3)
|
Chris@909
|
250 user.firstname = str_utf8
|
Chris@909
|
251 user.lastname = "test-lastname"
|
Chris@909
|
252 assert user.save
|
Chris@909
|
253 comments = "test_csv_big_5"
|
Chris@909
|
254 te1 = TimeEntry.create(:spent_on => '2011-11-11',
|
Chris@909
|
255 :hours => 7.3,
|
Chris@909
|
256 :project => Project.find(1),
|
Chris@909
|
257 :user => user,
|
Chris@909
|
258 :activity => TimeEntryActivity.find_by_name('Design'),
|
Chris@909
|
259 :comments => comments)
|
Chris@909
|
260
|
Chris@909
|
261 te2 = TimeEntry.find_by_comments(comments)
|
Chris@909
|
262 assert_not_nil te2
|
Chris@909
|
263 assert_equal 7.3, te2.hours
|
Chris@909
|
264 assert_equal 3, te2.user_id
|
Chris@909
|
265
|
Chris@909
|
266 get :report, :project_id => 1, :columns => 'day',
|
Chris@909
|
267 :from => "2011-11-11", :to => "2011-11-11",
|
Chris@1464
|
268 :criteria => ["user"], :format => "csv"
|
Chris@909
|
269 assert_response :success
|
Chris@1115
|
270 assert_equal 'text/csv; header=present', @response.content_type
|
Chris@909
|
271 lines = @response.body.chomp.split("\n")
|
Chris@909
|
272 # Headers
|
Chris@1464
|
273 s1 = "\xa5\xce\xa4\xe1,2011-11-11,\xa4u\xae\xc9\xc1`\xadp"
|
Chris@1464
|
274 s2 = "\xa4u\xae\xc9\xc1`\xadp"
|
Chris@909
|
275 if s1.respond_to?(:force_encoding)
|
Chris@909
|
276 s1.force_encoding('Big5')
|
Chris@909
|
277 s2.force_encoding('Big5')
|
Chris@909
|
278 end
|
Chris@909
|
279 assert_equal s1, lines.first
|
Chris@909
|
280 # Total row
|
Chris@909
|
281 assert_equal "#{str_big5} #{user.lastname},7.30,7.30", lines[1]
|
Chris@909
|
282 assert_equal "#{s2},7.30,7.30", lines[2]
|
Chris@909
|
283
|
Chris@909
|
284 str_tw = "Traditional Chinese (\xe7\xb9\x81\xe9\xab\x94\xe4\xb8\xad\xe6\x96\x87)"
|
Chris@909
|
285 if str_tw.respond_to?(:force_encoding)
|
Chris@909
|
286 str_tw.force_encoding('UTF-8')
|
Chris@909
|
287 end
|
Chris@909
|
288 assert_equal str_tw, l(:general_lang_name)
|
Chris@909
|
289 assert_equal 'Big5', l(:general_csv_encoding)
|
Chris@909
|
290 assert_equal ',', l(:general_csv_separator)
|
Chris@909
|
291 assert_equal '.', l(:general_csv_decimal_separator)
|
Chris@909
|
292 end
|
Chris@909
|
293
|
Chris@909
|
294 def test_csv_cannot_convert_should_be_replaced_big_5
|
Chris@909
|
295 Setting.default_language = "zh-TW"
|
Chris@909
|
296 str_utf8 = "\xe4\xbb\xa5\xe5\x86\x85"
|
Chris@909
|
297 if str_utf8.respond_to?(:force_encoding)
|
Chris@909
|
298 str_utf8.force_encoding('UTF-8')
|
Chris@909
|
299 end
|
Chris@909
|
300 user = User.find_by_id(3)
|
Chris@909
|
301 user.firstname = str_utf8
|
Chris@909
|
302 user.lastname = "test-lastname"
|
Chris@909
|
303 assert user.save
|
Chris@909
|
304 comments = "test_replaced"
|
Chris@909
|
305 te1 = TimeEntry.create(:spent_on => '2011-11-11',
|
Chris@909
|
306 :hours => 7.3,
|
Chris@909
|
307 :project => Project.find(1),
|
Chris@909
|
308 :user => user,
|
Chris@909
|
309 :activity => TimeEntryActivity.find_by_name('Design'),
|
Chris@909
|
310 :comments => comments)
|
Chris@909
|
311
|
Chris@909
|
312 te2 = TimeEntry.find_by_comments(comments)
|
Chris@909
|
313 assert_not_nil te2
|
Chris@909
|
314 assert_equal 7.3, te2.hours
|
Chris@909
|
315 assert_equal 3, te2.user_id
|
Chris@909
|
316
|
Chris@909
|
317 get :report, :project_id => 1, :columns => 'day',
|
Chris@909
|
318 :from => "2011-11-11", :to => "2011-11-11",
|
Chris@1464
|
319 :criteria => ["user"], :format => "csv"
|
Chris@909
|
320 assert_response :success
|
Chris@1115
|
321 assert_equal 'text/csv; header=present', @response.content_type
|
Chris@909
|
322 lines = @response.body.chomp.split("\n")
|
Chris@909
|
323 # Headers
|
Chris@1464
|
324 s1 = "\xa5\xce\xa4\xe1,2011-11-11,\xa4u\xae\xc9\xc1`\xadp"
|
Chris@909
|
325 if s1.respond_to?(:force_encoding)
|
Chris@909
|
326 s1.force_encoding('Big5')
|
Chris@909
|
327 end
|
Chris@909
|
328 assert_equal s1, lines.first
|
Chris@909
|
329 # Total row
|
Chris@909
|
330 s2 = ""
|
Chris@909
|
331 if s2.respond_to?(:force_encoding)
|
Chris@909
|
332 s2 = "\xa5H?"
|
Chris@909
|
333 s2.force_encoding('Big5')
|
Chris@909
|
334 elsif RUBY_PLATFORM == 'java'
|
Chris@909
|
335 s2 = "??"
|
Chris@909
|
336 else
|
Chris@909
|
337 s2 = "\xa5H???"
|
Chris@909
|
338 end
|
Chris@909
|
339 assert_equal "#{s2} #{user.lastname},7.30,7.30", lines[1]
|
Chris@909
|
340 end
|
Chris@909
|
341
|
Chris@909
|
342 def test_csv_fr
|
Chris@909
|
343 with_settings :default_language => "fr" do
|
Chris@909
|
344 str1 = "test_csv_fr"
|
Chris@909
|
345 user = User.find_by_id(3)
|
Chris@909
|
346 te1 = TimeEntry.create(:spent_on => '2011-11-11',
|
Chris@909
|
347 :hours => 7.3,
|
Chris@909
|
348 :project => Project.find(1),
|
Chris@909
|
349 :user => user,
|
Chris@909
|
350 :activity => TimeEntryActivity.find_by_name('Design'),
|
Chris@909
|
351 :comments => str1)
|
Chris@909
|
352
|
Chris@909
|
353 te2 = TimeEntry.find_by_comments(str1)
|
Chris@909
|
354 assert_not_nil te2
|
Chris@909
|
355 assert_equal 7.3, te2.hours
|
Chris@909
|
356 assert_equal 3, te2.user_id
|
Chris@909
|
357
|
Chris@909
|
358 get :report, :project_id => 1, :columns => 'day',
|
Chris@909
|
359 :from => "2011-11-11", :to => "2011-11-11",
|
Chris@1464
|
360 :criteria => ["user"], :format => "csv"
|
Chris@909
|
361 assert_response :success
|
Chris@1115
|
362 assert_equal 'text/csv; header=present', @response.content_type
|
Chris@909
|
363 lines = @response.body.chomp.split("\n")
|
Chris@909
|
364 # Headers
|
Chris@1464
|
365 s1 = "Utilisateur;2011-11-11;Temps total"
|
Chris@1464
|
366 s2 = "Temps total"
|
Chris@909
|
367 if s1.respond_to?(:force_encoding)
|
Chris@909
|
368 s1.force_encoding('ISO-8859-1')
|
Chris@909
|
369 s2.force_encoding('ISO-8859-1')
|
Chris@909
|
370 end
|
Chris@909
|
371 assert_equal s1, lines.first
|
Chris@909
|
372 # Total row
|
Chris@909
|
373 assert_equal "#{user.firstname} #{user.lastname};7,30;7,30", lines[1]
|
Chris@909
|
374 assert_equal "#{s2};7,30;7,30", lines[2]
|
Chris@909
|
375
|
Chris@909
|
376 str_fr = "Fran\xc3\xa7ais"
|
Chris@909
|
377 if str_fr.respond_to?(:force_encoding)
|
Chris@909
|
378 str_fr.force_encoding('UTF-8')
|
Chris@909
|
379 end
|
Chris@909
|
380 assert_equal str_fr, l(:general_lang_name)
|
Chris@909
|
381 assert_equal 'ISO-8859-1', l(:general_csv_encoding)
|
Chris@909
|
382 assert_equal ';', l(:general_csv_separator)
|
Chris@909
|
383 assert_equal ',', l(:general_csv_decimal_separator)
|
Chris@909
|
384 end
|
Chris@909
|
385 end
|
chris@37
|
386 end
|