Project

General

Profile

Patch #18856 ยป 0001-IssuesControllerTest-make-encoding-tests-independent.patch

Antonio Terceiro, 2015-01-15 20:21

View differences:

test/functional/issues_controller_test.rb
496 496
                  :format => 'csv'
497 497
      assert_equal 'text/csv; header=present', @response.content_type
498 498
      lines = @response.body.chomp.split("\n")
499
      header = lines[0]
500
      issue_line = lines.find { |l| l =~ /^#{issue.id},/}
499 501
      s1 = "\xaa\xac\xbaA".force_encoding('Big5')
500
      assert_include s1, lines[0]
501
      assert_include str_big5, lines[1]
502
      assert_include s1, header
503
      assert_include str_big5, issue_line
502 504
    end
503 505
  end
504 506

  
......
515 517
                  :set_filter => 1
516 518
      assert_equal 'text/csv; header=present', @response.content_type
517 519
      lines = @response.body.chomp.split("\n")
520
      header = lines[0]
521
      issue_line = lines.find { |l| l =~ /^#{issue.id},/ }
518 522
      s1 = "\xaa\xac\xbaA".force_encoding('Big5') # status
519
      assert lines[0].include?(s1)
520
      s2 = lines[1].split(",")[2]
523
      assert header.include?(s1)
524
      s2 = issue_line.split(",")[2]
521 525
      s3 = "\xa5H?".force_encoding('Big5') # subject
522 526
      assert_equal s3, s2
523 527
    end
......
536 540
                  :set_filter => 1
537 541
      assert_equal 'text/csv; header=present', @response.content_type
538 542
      lines = @response.body.chomp.split("\n")
539
      assert_equal "#{issue.id},1234.50,#{str1}", lines[1]
543
      assert_include "#{issue.id},1234.50,#{str1}", lines
540 544
    end
541 545
  end
542 546

  
......
553 557
                  :set_filter => 1
554 558
      assert_equal 'text/csv; header=present', @response.content_type
555 559
      lines = @response.body.chomp.split("\n")
556
      assert_equal "#{issue.id};1234,50;#{str1}", lines[1]
560
      assert_include "#{issue.id};1234,50;#{str1}", lines
557 561
    end
558 562
  end
559 563

  
    (1-1/1)