##// END OF EJS Templates
Fixed: Export CSV - Custom field true/false not using translation (#16081)....
Jean-Philippe Lang -
r12621:1114bf5e99e4
parent child
Show More
@@ -129,6 +129,10 module QueriesHelper
129 when 'IssueRelation'
129 when 'IssueRelation'
130 other = value.other_issue(issue)
130 other = value.other_issue(issue)
131 l(value.label_for(issue)) + " ##{other.id}"
131 l(value.label_for(issue)) + " ##{other.id}"
132 when 'TrueClass'
133 l(:general_text_Yes)
134 when 'FalseClass'
135 l(:general_text_No)
132 else
136 else
133 value.to_s
137 value.to_s
134 end
138 end
@@ -119,6 +119,14 class ActiveSupport::TestCase
119 User.current = saved_user
119 User.current = saved_user
120 end
120 end
121
121
122 def with_locale(locale, &block)
123 saved_localed = ::I18n.locale
124 ::I18n.locale = locale
125 yield
126 ensure
127 ::I18n.locale = saved_localed
128 end
129
122 def change_user_password(login, new_password)
130 def change_user_password(login, new_password)
123 user = User.where(:login => login).first
131 user = User.where(:login => login).first
124 user.password, user.password_confirmation = new_password, new_password
132 user.password, user.password_confirmation = new_password, new_password
@@ -36,4 +36,18 class QueriesHelperTest < ActionView::TestCase
36 assert_equal filter_count + 1, fo.size
36 assert_equal filter_count + 1, fo.size
37 assert_equal [], fo[0]
37 assert_equal [], fo[0]
38 end
38 end
39
40 def test_query_to_csv_should_translate_boolean_custom_field_values
41 f = IssueCustomField.generate!(:field_format => 'bool', :name => 'Boolean', :is_for_all => true, :trackers => Tracker.all)
42 issues = [
43 Issue.generate!(:project_id => 1, :tracker_id => 1, :custom_field_values => {f.id.to_s => '0'}),
44 Issue.generate!(:project_id => 1, :tracker_id => 1, :custom_field_values => {f.id.to_s => '1'})
45 ]
46
47 with_locale 'fr' do
48 csv = query_to_csv(issues, IssueQuery.new, :columns => 'all')
49 assert_include "Oui", csv
50 assert_include "Non", csv
51 end
52 end
39 end
53 end
General Comments 0
You need to be logged in to leave comments. Login now