diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-11-27 12:14:45 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-11-27 12:14:45 +0000 |
commit | d136672fa37fbd1a6f2b4c06f60e831438ff1392 (patch) | |
tree | 1f3cd505dbace312a7708dcb6e1e07db7b45ad35 /test | |
parent | a79e0fa5f63c9078641d52a3cb5de50977f8a7e8 (diff) | |
download | redmine-d136672fa37fbd1a6f2b4c06f60e831438ff1392.tar.gz redmine-d136672fa37fbd1a6f2b4c06f60e831438ff1392.zip |
add tests to export time entry csv in French for csv separator (#8368)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7951 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/time_entry_reports_controller_test.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/functional/time_entry_reports_controller_test.rb b/test/functional/time_entry_reports_controller_test.rb index 992ee7163..30ebe89d0 100644 --- a/test/functional/time_entry_reports_controller_test.rb +++ b/test/functional/time_entry_reports_controller_test.rb @@ -250,4 +250,49 @@ class TimeEntryReportsControllerTest < ActionController::TestCase end assert_equal "#{s2} #{user.lastname},7.30,7.30", lines[1] end + + def test_csv_fr + with_settings :default_language => "fr" do + str1 = "test_csv_fr" + user = User.find_by_id(3) + te1 = TimeEntry.create(:spent_on => '2011-11-11', + :hours => 7.3, + :project => Project.find(1), + :user => user, + :activity => TimeEntryActivity.find_by_name('Design'), + :comments => str1) + + te2 = TimeEntry.find_by_comments(str1) + assert_not_nil te2 + assert_equal 7.3, te2.hours + assert_equal 3, te2.user_id + + get :report, :project_id => 1, :columns => 'day', + :from => "2011-11-11", :to => "2011-11-11", + :criterias => ["member"], :format => "csv" + assert_response :success + assert_equal 'text/csv', @response.content_type + lines = @response.body.chomp.split("\n") + # Headers + s1 = "Membre;2011-11-11;Total" + s2 = "Total" + if s1.respond_to?(:force_encoding) + s1.force_encoding('ISO-8859-1') + s2.force_encoding('ISO-8859-1') + end + assert_equal s1, lines.first + # Total row + assert_equal "#{user.firstname} #{user.lastname};7,30;7,30", lines[1] + assert_equal "#{s2};7,30;7,30", lines[2] + + str_fr = "Fran\xc3\xa7ais" + if str_fr.respond_to?(:force_encoding) + str_fr.force_encoding('UTF-8') + end + assert_equal str_fr, l(:general_lang_name) + assert_equal 'ISO-8859-1', l(:general_csv_encoding) + assert_equal ';', l(:general_csv_separator) + assert_equal ',', l(:general_csv_decimal_separator) + end + end end |