@@ -329,7 +329,7 module IssuesHelper | |||||
329 | elsif value.is_a?(Time) |
|
329 | elsif value.is_a?(Time) | |
330 | format_time(value) |
|
330 | format_time(value) | |
331 | elsif value.is_a?(Float) |
|
331 | elsif value.is_a?(Float) | |
332 |
value |
|
332 | ("%.2f" % value).gsub('.', decimal_separator) | |
333 | else |
|
333 | else | |
334 | value |
|
334 | value | |
335 | end |
|
335 | end |
@@ -329,6 +329,17 class IssuesControllerTest < ActionController::TestCase | |||||
329 | assert_equal assigns(:query).columns.size + 2, lines[0].split(',').size |
|
329 | assert_equal assigns(:query).columns.size + 2, lines[0].split(',').size | |
330 | end |
|
330 | end | |
331 |
|
331 | |||
|
332 | def test_index_csv_with_spent_time_column | |||
|
333 | issue = Issue.generate!(:project_id => 1, :tracker_id => 1, :subject => 'test_index_csv_with_spent_time_column') | |||
|
334 | TimeEntry.generate!(:project_id => issue.project_id, :issue_id => issue.id, :hours => 7.33) | |||
|
335 | ||||
|
336 | get :index, :format => 'csv', :set_filter => '1', :c => %w(subject spent_hours) | |||
|
337 | assert_response :success | |||
|
338 | assert_equal 'text/csv', @response.content_type | |||
|
339 | lines = @response.body.chomp.split("\n") | |||
|
340 | assert_include "#{issue.id},#{issue.subject},7.33", lines | |||
|
341 | end | |||
|
342 | ||||
332 | def test_index_csv_with_all_columns |
|
343 | def test_index_csv_with_all_columns | |
333 | get :index, :format => 'csv', :columns => 'all' |
|
344 | get :index, :format => 'csv', :columns => 'all' | |
334 | assert_response :success |
|
345 | assert_response :success | |
@@ -433,7 +444,7 class IssuesControllerTest < ActionController::TestCase | |||||
433 | :set_filter => 1 |
|
444 | :set_filter => 1 | |
434 | assert_equal 'text/csv', @response.content_type |
|
445 | assert_equal 'text/csv', @response.content_type | |
435 | lines = @response.body.chomp.split("\n") |
|
446 | lines = @response.body.chomp.split("\n") | |
436 | assert_equal "#{issue.id},1234.5,#{str1}", lines[1] |
|
447 | assert_equal "#{issue.id},1234.50,#{str1}", lines[1] | |
437 |
|
448 | |||
438 | str_tw = "Traditional Chinese (\xe7\xb9\x81\xe9\xab\x94\xe4\xb8\xad\xe6\x96\x87)" |
|
449 | str_tw = "Traditional Chinese (\xe7\xb9\x81\xe9\xab\x94\xe4\xb8\xad\xe6\x96\x87)" | |
439 | if str_tw.respond_to?(:force_encoding) |
|
450 | if str_tw.respond_to?(:force_encoding) | |
@@ -462,7 +473,7 class IssuesControllerTest < ActionController::TestCase | |||||
462 | :set_filter => 1 |
|
473 | :set_filter => 1 | |
463 | assert_equal 'text/csv', @response.content_type |
|
474 | assert_equal 'text/csv', @response.content_type | |
464 | lines = @response.body.chomp.split("\n") |
|
475 | lines = @response.body.chomp.split("\n") | |
465 | assert_equal "#{issue.id};1234,5;#{str1}", lines[1] |
|
476 | assert_equal "#{issue.id};1234,50;#{str1}", lines[1] | |
466 |
|
477 | |||
467 | str_fr = "Fran\xc3\xa7ais" |
|
478 | str_fr = "Fran\xc3\xa7ais" | |
468 | if str_fr.respond_to?(:force_encoding) |
|
479 | if str_fr.respond_to?(:force_encoding) |
General Comments 0
You need to be logged in to leave comments.
Login now