@@ -296,6 +296,34 class IssuesControllerTest < ActionController::TestCase | |||
|
296 | 296 | assert_equal 'text/csv', @response.content_type |
|
297 | 297 | end |
|
298 | 298 | |
|
299 | def test_index_csv_big_5 | |
|
300 | with_settings :default_language => "zh-TW" do | |
|
301 | str_utf8 = "\xe4\xb8\x80\xe6\x9c\x88" | |
|
302 | str_big5 = "\xa4@\xa4\xeb" | |
|
303 | if str_utf8.respond_to?(:force_encoding) | |
|
304 | str_utf8.force_encoding('UTF-8') | |
|
305 | str_big5.force_encoding('Big5') | |
|
306 | end | |
|
307 | issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, | |
|
308 | :status_id => 1, :priority => IssuePriority.all.first, | |
|
309 | :subject => str_utf8) | |
|
310 | assert issue.save | |
|
311 | ||
|
312 | get :index, :project_id => 1, | |
|
313 | :f => ['subject'], | |
|
314 | :op => '=', :values => [str_utf8], | |
|
315 | :format => 'csv' | |
|
316 | assert_equal 'text/csv', @response.content_type | |
|
317 | lines = @response.body.chomp.split("\n") | |
|
318 | s1 = "\xaa\xac\xbaA" | |
|
319 | if str_utf8.respond_to?(:force_encoding) | |
|
320 | s1.force_encoding('Big5') | |
|
321 | end | |
|
322 | assert lines[0].include?(s1) | |
|
323 | assert lines[1].include?(str_big5) | |
|
324 | end | |
|
325 | end | |
|
326 | ||
|
299 | 327 | def test_index_pdf |
|
300 | 328 | get :index, :format => 'pdf' |
|
301 | 329 | assert_response :success |
General Comments 0
You need to be logged in to leave comments.
Login now