comparison test/functional/timelog_controller_test.rb @ 1115:433d4f72a19b redmine-2.2

Update to Redmine SVN revision 11137 on 2.2-stable branch
author Chris Cannam
date Mon, 07 Jan 2013 12:01:42 +0000
parents cbb26bc654de
children 622f24f53b42 261b3d9a4903
comparison
equal deleted inserted replaced
929:5f33065ddc4b 1115:433d4f72a19b
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # Redmine - project management software 2 # Redmine - project management software
3 # Copyright (C) 2006-2011 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.
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_get_new 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 'edit' 43 assert_template 'new'
44 # Default activity selected 44 assert_select 'select[name=?]', 'time_entry[project_id]', 0
45 assert_tag :tag => 'option', :attributes => { :selected => 'selected' }, 45 assert_select 'input[name=?][value=1][type=hidden]', 'time_entry[project_id]'
46 :content => 'Development' 46 end
47 end 47
48 48 def test_new_with_issue_id
49 def test_get_new_should_only_show_active_time_entry_activities 49 @request.session[:user_id] = 3
50 get :new, :issue_id => 2
51 assert_response :success
52 assert_template 'new'
53 assert_select 'select[name=?]', 'time_entry[project_id]', 0
54 assert_select 'input[name=?][value=1][type=hidden]', 'time_entry[project_id]'
55 end
56
57 def test_new_without_project
58 @request.session[:user_id] = 3
59 get :new
60 assert_response :success
61 assert_template 'new'
62 assert_select 'select[name=?]', 'time_entry[project_id]'
63 assert_select 'input[name=?]', 'time_entry[project_id]', 0
64 end
65
66 def test_new_without_project_should_prefill_the_form
67 @request.session[:user_id] = 3
68 get :new, :time_entry => {:project_id => '1'}
69 assert_response :success
70 assert_template 'new'
71 assert_select 'select[name=?]', 'time_entry[project_id]' do
72 assert_select 'option[value=1][selected=selected]'
73 end
74 assert_select 'input[name=?]', 'time_entry[project_id]', 0
75 end
76
77 def test_new_without_project_should_deny_without_permission
78 Role.all.each {|role| role.remove_permission! :log_time}
79 @request.session[:user_id] = 3
80
81 get :new
82 assert_response 403
83 end
84
85 def test_new_should_select_default_activity
50 @request.session[:user_id] = 3 86 @request.session[:user_id] = 3
51 get :new, :project_id => 1 87 get :new, :project_id => 1
52 assert_response :success 88 assert_response :success
53 assert_template 'edit' 89 assert_select 'select[name=?]', 'time_entry[activity_id]' do
54 assert_no_tag :tag => 'option', :content => 'Inactive Activity' 90 assert_select 'option[selected=selected]', :text => 'Development'
91 end
92 end
93
94 def test_new_should_only_show_active_time_entry_activities
95 @request.session[:user_id] = 3
96 get :new, :project_id => 1
97 assert_response :success
98 assert_no_tag 'option', :content => 'Inactive Activity'
55 end 99 end
56 100
57 def test_get_edit_existing_time 101 def test_get_edit_existing_time
58 @request.session[:user_id] = 2 102 @request.session[:user_id] = 2
59 get :edit, :id => 2, :project_id => nil 103 get :edit, :id => 2, :project_id => nil
117 assert_equal 11, t.activity_id 161 assert_equal 11, t.activity_id
118 assert_equal 7.3, t.hours 162 assert_equal 7.3, t.hours
119 assert_equal 3, t.user_id 163 assert_equal 3, t.user_id
120 end 164 end
121 165
166 def test_create_and_continue
167 @request.session[:user_id] = 2
168 post :create, :project_id => 1,
169 :time_entry => {:activity_id => '11',
170 :issue_id => '',
171 :spent_on => '2008-03-14',
172 :hours => '7.3'},
173 :continue => '1'
174 assert_redirected_to '/projects/ecookbook/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D='
175 end
176
177 def test_create_and_continue_with_issue_id
178 @request.session[:user_id] = 2
179 post :create, :project_id => 1,
180 :time_entry => {:activity_id => '11',
181 :issue_id => '1',
182 :spent_on => '2008-03-14',
183 :hours => '7.3'},
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'
186 end
187
188 def test_create_and_continue_without_project
189 @request.session[:user_id] = 2
190 post :create, :time_entry => {:project_id => '1',
191 :activity_id => '11',
192 :issue_id => '',
193 :spent_on => '2008-03-14',
194 :hours => '7.3'},
195 :continue => '1'
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'
198 end
199
122 def test_create_without_log_time_permission_should_be_denied 200 def test_create_without_log_time_permission_should_be_denied
123 @request.session[:user_id] = 2 201 @request.session[:user_id] = 2
124 Role.find_by_name('Manager').remove_permission! :log_time 202 Role.find_by_name('Manager').remove_permission! :log_time
125 post :create, :project_id => 1, 203 post :create, :project_id => 1,
126 :time_entry => {:activity_id => '11', 204 :time_entry => {:activity_id => '11',
129 :hours => '7.3'} 207 :hours => '7.3'}
130 208
131 assert_response 403 209 assert_response 403
132 end 210 end
133 211
212 def test_create_with_failure
213 @request.session[:user_id] = 2
214 post :create, :project_id => 1,
215 :time_entry => {:activity_id => '',
216 :issue_id => '',
217 :spent_on => '2008-03-14',
218 :hours => '7.3'}
219
220 assert_response :success
221 assert_template 'new'
222 end
223
224 def test_create_without_project
225 @request.session[:user_id] = 2
226 assert_difference 'TimeEntry.count' do
227 post :create, :time_entry => {:project_id => '1',
228 :activity_id => '11',
229 :issue_id => '',
230 :spent_on => '2008-03-14',
231 :hours => '7.3'}
232 end
233
234 assert_redirected_to '/projects/ecookbook/time_entries'
235 time_entry = TimeEntry.first(:order => 'id DESC')
236 assert_equal 1, time_entry.project_id
237 end
238
239 def test_create_without_project_should_fail_with_issue_not_inside_project
240 @request.session[:user_id] = 2
241 assert_no_difference 'TimeEntry.count' do
242 post :create, :time_entry => {:project_id => '1',
243 :activity_id => '11',
244 :issue_id => '5',
245 :spent_on => '2008-03-14',
246 :hours => '7.3'}
247 end
248
249 assert_response :success
250 assert assigns(:time_entry).errors[:issue_id].present?
251 end
252
253 def test_create_without_project_should_deny_without_permission
254 @request.session[:user_id] = 2
255 Project.find(3).disable_module!(:time_tracking)
256
257 assert_no_difference 'TimeEntry.count' do
258 post :create, :time_entry => {:project_id => '3',
259 :activity_id => '11',
260 :issue_id => '',
261 :spent_on => '2008-03-14',
262 :hours => '7.3'}
263 end
264
265 assert_response 403
266 end
267
268 def test_create_without_project_with_failure
269 @request.session[:user_id] = 2
270 assert_no_difference 'TimeEntry.count' do
271 post :create, :time_entry => {:project_id => '1',
272 :activity_id => '11',
273 :issue_id => '',
274 :spent_on => '2008-03-14',
275 :hours => ''}
276 end
277
278 assert_response :success
279 assert_tag 'select', :attributes => {:name => 'time_entry[project_id]'},
280 :child => {:tag => 'option', :attributes => {:value => '1', :selected => 'selected'}}
281 end
282
134 def test_update 283 def test_update
135 entry = TimeEntry.find(1) 284 entry = TimeEntry.find(1)
136 assert_equal 1, entry.issue_id 285 assert_equal 1, entry.issue_id
137 assert_equal 2, entry.user_id 286 assert_equal 2, entry.user_id
138 287
154 assert_response :success 303 assert_response :success
155 assert_template 'bulk_edit' 304 assert_template 'bulk_edit'
156 305
157 # System wide custom field 306 # System wide custom field
158 assert_tag :select, :attributes => {:name => 'time_entry[custom_field_values][10]'} 307 assert_tag :select, :attributes => {:name => 'time_entry[custom_field_values][10]'}
308
309 # Activities
310 assert_select 'select[name=?]', 'time_entry[activity_id]' do
311 assert_select 'option[value=]', :text => '(No change)'
312 assert_select 'option[value=9]', :text => 'Design'
313 end
159 end 314 end
160 315
161 def test_get_bulk_edit_on_different_projects 316 def test_get_bulk_edit_on_different_projects
162 @request.session[:user_id] = 2 317 @request.session[:user_id] = 2
163 get :bulk_edit, :ids => [1, 2, 6] 318 get :bulk_edit, :ids => [1, 2, 6]
171 post :bulk_update, :ids => [1, 2], :time_entry => { :activity_id => 9} 326 post :bulk_update, :ids => [1, 2], :time_entry => { :activity_id => 9}
172 327
173 assert_response 302 328 assert_response 302
174 # check that the issues were updated 329 # check that the issues were updated
175 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
332
333 def test_bulk_update_with_failure
334 @request.session[:user_id] = 2
335 post :bulk_update, :ids => [1, 2], :time_entry => { :hours => 'A'}
336
337 assert_response 302
338 assert_match /Failed to save 2 time entrie/, flash[:error]
176 end 339 end
177 340
178 def test_bulk_update_on_different_projects 341 def test_bulk_update_on_different_projects
179 @request.session[:user_id] = 2 342 @request.session[:user_id] = 2
180 # makes user a manager on the other project 343 # makes user a manager on the other project
255 assert_template 'index' 418 assert_template 'index'
256 assert_not_nil assigns(:total_hours) 419 assert_not_nil assigns(:total_hours)
257 assert_equal "162.90", "%.2f" % assigns(:total_hours) 420 assert_equal "162.90", "%.2f" % assigns(:total_hours)
258 assert_tag :form, 421 assert_tag :form,
259 :attributes => {:action => "/time_entries", :id => 'query_form'} 422 :attributes => {:action => "/time_entries", :id => 'query_form'}
423 end
424
425 def test_index_all_projects_should_show_log_time_link
426 @request.session[:user_id] = 2
427 get :index
428 assert_response :success
429 assert_template 'index'
430 assert_tag 'a', :attributes => {:href => '/time_entries/new'}, :content => /Log time/
260 end 431 end
261 432
262 def test_index_at_project_level 433 def test_index_at_project_level
263 get :index, :project_id => 'ecookbook' 434 get :index, :project_id => 'ecookbook'
264 assert_response :success 435 assert_response :success
268 # project and subproject 439 # project and subproject
269 assert_equal [1, 3], assigns(:entries).collect(&:project_id).uniq.sort 440 assert_equal [1, 3], assigns(:entries).collect(&:project_id).uniq.sort
270 assert_not_nil assigns(:total_hours) 441 assert_not_nil assigns(:total_hours)
271 assert_equal "162.90", "%.2f" % assigns(:total_hours) 442 assert_equal "162.90", "%.2f" % assigns(:total_hours)
272 # display all time by default 443 # display all time by default
273 assert_equal '2007-03-12'.to_date, assigns(:from) 444 assert_nil assigns(:from)
274 assert_equal '2007-04-22'.to_date, assigns(:to) 445 assert_nil assigns(:to)
275 assert_tag :form, 446 assert_tag :form,
276 :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} 447 :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'}
277 end 448 end
278 449
279 def test_index_at_project_level_with_date_range 450 def test_index_at_project_level_with_date_range
310 assert_equal "4.25", "%.2f" % assigns(:total_hours) 481 assert_equal "4.25", "%.2f" % assigns(:total_hours)
311 assert_tag :form, 482 assert_tag :form,
312 :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} 483 :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'}
313 end 484 end
314 485
486 def test_index_from_a_date
487 get :index, :project_id => 'ecookbook', :from => "2007-03-23", :to => ""
488 assert_equal '2007-03-23'.to_date, assigns(:from)
489 assert_nil assigns(:to)
490 end
491
492 def test_index_to_a_date
493 get :index, :project_id => 'ecookbook', :from => "", :to => "2007-03-23"
494 assert_nil assigns(:from)
495 assert_equal '2007-03-23'.to_date, assigns(:to)
496 end
497
498 def test_index_today
499 Date.stubs(:today).returns('2011-12-15'.to_date)
500 get :index, :period => 'today'
501 assert_equal '2011-12-15'.to_date, assigns(:from)
502 assert_equal '2011-12-15'.to_date, assigns(:to)
503 end
504
505 def test_index_yesterday
506 Date.stubs(:today).returns('2011-12-15'.to_date)
507 get :index, :period => 'yesterday'
508 assert_equal '2011-12-14'.to_date, assigns(:from)
509 assert_equal '2011-12-14'.to_date, assigns(:to)
510 end
511
512 def test_index_current_week
513 Date.stubs(:today).returns('2011-12-15'.to_date)
514 get :index, :period => 'current_week'
515 assert_equal '2011-12-12'.to_date, assigns(:from)
516 assert_equal '2011-12-18'.to_date, assigns(:to)
517 end
518
519 def test_index_last_week
520 Date.stubs(:today).returns('2011-12-15'.to_date)
521 get :index, :period => 'last_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_2_week
527 Date.stubs(:today).returns('2011-12-15'.to_date)
528 get :index, :period => 'last_2_weeks'
529 assert_equal '2011-11-28'.to_date, assigns(:from)
530 assert_equal '2011-12-11'.to_date, assigns(:to)
531 end
532
533 def test_index_7_days
534 Date.stubs(:today).returns('2011-12-15'.to_date)
535 get :index, :period => '7_days'
536 assert_equal '2011-12-08'.to_date, assigns(:from)
537 assert_equal '2011-12-15'.to_date, assigns(:to)
538 end
539
540 def test_index_current_month
541 Date.stubs(:today).returns('2011-12-15'.to_date)
542 get :index, :period => 'current_month'
543 assert_equal '2011-12-01'.to_date, assigns(:from)
544 assert_equal '2011-12-31'.to_date, assigns(:to)
545 end
546
547 def test_index_last_month
548 Date.stubs(:today).returns('2011-12-15'.to_date)
549 get :index, :period => 'last_month'
550 assert_equal '2011-11-01'.to_date, assigns(:from)
551 assert_equal '2011-11-30'.to_date, assigns(:to)
552 end
553
554 def test_index_30_days
555 Date.stubs(:today).returns('2011-12-15'.to_date)
556 get :index, :period => '30_days'
557 assert_equal '2011-11-15'.to_date, assigns(:from)
558 assert_equal '2011-12-15'.to_date, assigns(:to)
559 end
560
561 def test_index_current_year
562 Date.stubs(:today).returns('2011-12-15'.to_date)
563 get :index, :period => 'current_year'
564 assert_equal '2011-01-01'.to_date, assigns(:from)
565 assert_equal '2011-12-31'.to_date, assigns(:to)
566 end
567
315 def test_index_at_issue_level 568 def test_index_at_issue_level
316 get :index, :issue_id => 1 569 get :index, :issue_id => 1
317 assert_response :success 570 assert_response :success
318 assert_template 'index' 571 assert_template 'index'
319 assert_not_nil assigns(:entries) 572 assert_not_nil assigns(:entries)
320 assert_equal 2, assigns(:entries).size 573 assert_equal 2, assigns(:entries).size
321 assert_not_nil assigns(:total_hours) 574 assert_not_nil assigns(:total_hours)
322 assert_equal 154.25, assigns(:total_hours) 575 assert_equal 154.25, assigns(:total_hours)
323 # display all time based on what's been logged 576 # display all time
324 assert_equal '2007-03-12'.to_date, assigns(:from) 577 assert_nil assigns(:from)
325 assert_equal '2007-04-22'.to_date, assigns(:to) 578 assert_nil assigns(:to)
326 # TODO: remove /projects/:project_id/issues/:issue_id/time_entries routes 579 # TODO: remove /projects/:project_id/issues/:issue_id/time_entries routes
327 # to use /issues/:issue_id/time_entries 580 # to use /issues/:issue_id/time_entries
328 assert_tag :form, 581 assert_tag :form,
329 :attributes => {:action => "/projects/ecookbook/issues/1/time_entries", :id => 'query_form'} 582 :attributes => {:action => "/projects/ecookbook/issues/1/time_entries", :id => 'query_form'}
330 end 583 end
331 584
585 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)
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)
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)
589
590 get :index, :project_id => 1, :from => '2012-06-15', :to => '2012-06-16'
591 assert_response :success
592 assert_equal [t2, t1, t3], assigns(:entries)
593
594 get :index, :project_id => 1, :from => '2012-06-15', :to => '2012-06-16', :sort => 'spent_on'
595 assert_response :success
596 assert_equal [t3, t1, t2], assigns(:entries)
597 end
598
332 def test_index_atom_feed 599 def test_index_atom_feed
333 get :index, :project_id => 1, :format => 'atom' 600 get :index, :project_id => 1, :format => 'atom'
334 assert_response :success 601 assert_response :success
335 assert_equal 'application/atom+xml', @response.content_type 602 assert_equal 'application/atom+xml', @response.content_type
336 assert_not_nil assigns(:items) 603 assert_not_nil assigns(:items)
339 606
340 def test_index_all_projects_csv_export 607 def test_index_all_projects_csv_export
341 Setting.date_format = '%m/%d/%Y' 608 Setting.date_format = '%m/%d/%Y'
342 get :index, :format => 'csv' 609 get :index, :format => 'csv'
343 assert_response :success 610 assert_response :success
344 assert_equal 'text/csv', @response.content_type 611 assert_equal 'text/csv; header=present', @response.content_type
345 assert @response.body.include?("Date,User,Activity,Project,Issue,Tracker,Subject,Hours,Comment,Overtime\n") 612 assert @response.body.include?("Date,User,Activity,Project,Issue,Tracker,Subject,Hours,Comment,Overtime\n")
346 assert @response.body.include?("\n04/21/2007,redMine Admin,Design,eCookbook,3,Bug,Error 281 when updating a recipe,1.0,\"\",\"\"\n") 613 assert @response.body.include?("\n04/21/2007,redMine Admin,Design,eCookbook,3,Bug,Error 281 when updating a recipe,1.0,\"\",\"\"\n")
347 end 614 end
348 615
349 def test_index_csv_export 616 def test_index_csv_export
350 Setting.date_format = '%m/%d/%Y' 617 Setting.date_format = '%m/%d/%Y'
351 get :index, :project_id => 1, :format => 'csv' 618 get :index, :project_id => 1, :format => 'csv'
352 assert_response :success 619 assert_response :success
353 assert_equal 'text/csv', @response.content_type 620 assert_equal 'text/csv; header=present', @response.content_type
354 assert @response.body.include?("Date,User,Activity,Project,Issue,Tracker,Subject,Hours,Comment,Overtime\n") 621 assert @response.body.include?("Date,User,Activity,Project,Issue,Tracker,Subject,Hours,Comment,Overtime\n")
355 assert @response.body.include?("\n04/21/2007,redMine Admin,Design,eCookbook,3,Bug,Error 281 when updating a recipe,1.0,\"\",\"\"\n") 622 assert @response.body.include?("\n04/21/2007,redMine Admin,Design,eCookbook,3,Bug,Error 281 when updating a recipe,1.0,\"\",\"\"\n")
623 end
624
625 def test_index_csv_export_with_multi_custom_field
626 field = TimeEntryCustomField.create!(:name => 'Test', :field_format => 'list',
627 :multiple => true, :possible_values => ['value1', 'value2'])
628 entry = TimeEntry.find(1)
629 entry.custom_field_values = {field.id => ['value1', 'value2']}
630 entry.save!
631
632 get :index, :project_id => 1, :format => 'csv'
633 assert_response :success
634 assert_include '"value1, value2"', @response.body
356 end 635 end
357 636
358 def test_csv_big_5 637 def test_csv_big_5
359 user = User.find_by_id(3) 638 user = User.find_by_id(3)
360 user.language = "zh-TW" 639 user.language = "zh-TW"
382 assert_equal 3, t.user_id 661 assert_equal 3, t.user_id
383 662
384 get :index, :project_id => 1, :format => 'csv', 663 get :index, :project_id => 1, :format => 'csv',
385 :from => '2011-11-10', :to => '2011-11-10' 664 :from => '2011-11-10', :to => '2011-11-10'
386 assert_response :success 665 assert_response :success
387 assert_equal 'text/csv', @response.content_type 666 assert_equal 'text/csv; header=present', @response.content_type
388 ar = @response.body.chomp.split("\n") 667 ar = @response.body.chomp.split("\n")
389 s1 = "\xa4\xe9\xb4\xc1" 668 s1 = "\xa4\xe9\xb4\xc1"
390 if str_utf8.respond_to?(:force_encoding) 669 if str_utf8.respond_to?(:force_encoding)
391 s1.force_encoding('Big5') 670 s1.force_encoding('Big5')
392 end 671 end
419 assert_equal 3, t.user_id 698 assert_equal 3, t.user_id
420 699
421 get :index, :project_id => 1, :format => 'csv', 700 get :index, :project_id => 1, :format => 'csv',
422 :from => '2011-11-10', :to => '2011-11-10' 701 :from => '2011-11-10', :to => '2011-11-10'
423 assert_response :success 702 assert_response :success
424 assert_equal 'text/csv', @response.content_type 703 assert_equal 'text/csv; header=present', @response.content_type
425 ar = @response.body.chomp.split("\n") 704 ar = @response.body.chomp.split("\n")
426 s1 = "\xa4\xe9\xb4\xc1" 705 s1 = "\xa4\xe9\xb4\xc1"
427 if str_utf8.respond_to?(:force_encoding) 706 if str_utf8.respond_to?(:force_encoding)
428 s1.force_encoding('Big5') 707 s1.force_encoding('Big5')
429 end 708 end
456 assert_equal 3, te2.user_id 735 assert_equal 3, te2.user_id
457 736
458 get :index, :project_id => 1, :format => 'csv', 737 get :index, :project_id => 1, :format => 'csv',
459 :from => '2011-11-10', :to => '2011-11-10' 738 :from => '2011-11-10', :to => '2011-11-10'
460 assert_response :success 739 assert_response :success
461 assert_equal 'text/csv', @response.content_type 740 assert_equal 'text/csv; header=present', @response.content_type
462 741
463 ar = @response.body.chomp.split("\n") 742 ar = @response.body.chomp.split("\n")
464 s2 = ar[1].split(",")[7] 743 s2 = ar[1].split(",")[7]
465 assert_equal '999.9', s2 744 assert_equal '999.9', s2
466 745
490 assert_equal 3, te2.user_id 769 assert_equal 3, te2.user_id
491 770
492 get :index, :project_id => 1, :format => 'csv', 771 get :index, :project_id => 1, :format => 'csv',
493 :from => '2011-11-10', :to => '2011-11-10' 772 :from => '2011-11-10', :to => '2011-11-10'
494 assert_response :success 773 assert_response :success
495 assert_equal 'text/csv', @response.content_type 774 assert_equal 'text/csv; header=present', @response.content_type
496 775
497 ar = @response.body.chomp.split("\n") 776 ar = @response.body.chomp.split("\n")
498 s2 = ar[1].split(";")[7] 777 s2 = ar[1].split(";")[7]
499 assert_equal '999,9', s2 778 assert_equal '999,9', s2
500 779