]> source.dussan.org Git - redmine.git/commitdiff
Merged r12896 (#16081).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 2 Mar 2014 09:29:22 +0000 (09:29 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 2 Mar 2014 09:29:22 +0000 (09:29 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/2.5-stable@12945 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/queries_helper.rb
test/test_helper.rb
test/unit/helpers/queries_helper_test.rb

index d7bb58eead550cc21eba523d1e5929779c3dfd64..9324a9d92f1b3802c1f34bed8f0c870cc63a1c8e 100644 (file)
@@ -129,6 +129,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
index 79f30e7cd7b52546b385a85a89ca912a6778c237..bc1a350a2d9393eef16abe1e727edb186172be11 100644 (file)
@@ -119,6 +119,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
index 3dc596f908a9f1c5443aa600c9305dffcf9cf379..db492be6e5a7964aa5572af47398ab8a62f7fd9f 100644 (file)
@@ -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