From d05cbf4df84644344890073a9e6d98cb8b962e05 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 2 Mar 2014 09:30:35 +0000 Subject: [PATCH] Merged r12896 (#16081). git-svn-id: http://svn.redmine.org/redmine/branches/2.4-stable@12946 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/queries_helper.rb | 4 ++++ test/test_helper.rb | 8 ++++++++ test/unit/helpers/queries_helper_test.rb | 14 ++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index c3d2576d2..d9ffb74d4 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -155,6 +155,10 @@ module QueriesHelper when 'IssueRelation' other = value.other_issue(issue) l(value.label_for(issue)) + " ##{other.id}" + when 'TrueClass' + l(:general_text_Yes) + when 'FalseClass' + l(:general_text_No) else value.to_s end diff --git a/test/test_helper.rb b/test/test_helper.rb index 08356a61b..156991e58 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -111,6 +111,14 @@ class ActiveSupport::TestCase User.current = saved_user end + def with_locale(locale, &block) + saved_localed = ::I18n.locale + ::I18n.locale = locale + yield + ensure + ::I18n.locale = saved_localed + end + def change_user_password(login, new_password) user = User.where(:login => login).first user.password, user.password_confirmation = new_password, new_password diff --git a/test/unit/helpers/queries_helper_test.rb b/test/unit/helpers/queries_helper_test.rb index 3dc596f90..db492be6e 100644 --- a/test/unit/helpers/queries_helper_test.rb +++ b/test/unit/helpers/queries_helper_test.rb @@ -36,4 +36,18 @@ class QueriesHelperTest < ActionView::TestCase assert_equal filter_count + 1, fo.size assert_equal [], fo[0] end + + def test_query_to_csv_should_translate_boolean_custom_field_values + f = IssueCustomField.generate!(:field_format => 'bool', :name => 'Boolean', :is_for_all => true, :trackers => Tracker.all) + issues = [ + Issue.generate!(:project_id => 1, :tracker_id => 1, :custom_field_values => {f.id.to_s => '0'}), + Issue.generate!(:project_id => 1, :tracker_id => 1, :custom_field_values => {f.id.to_s => '1'}) + ] + + with_locale 'fr' do + csv = query_to_csv(issues, IssueQuery.new, :columns => 'all') + assert_include "Oui", csv + assert_include "Non", csv + end + end end -- 2.39.5