##// END OF EJS Templates
IssuesControllerTest: make encoding tests independent of ordering (#18856)...
Toshi MARUYAMA -
r13503:7f29c2fd88f2
parent child
Show More
@@ -496,9 +496,11 class IssuesControllerTest < ActionController::TestCase
496 :format => 'csv'
496 :format => 'csv'
497 assert_equal 'text/csv; header=present', @response.content_type
497 assert_equal 'text/csv; header=present', @response.content_type
498 lines = @response.body.chomp.split("\n")
498 lines = @response.body.chomp.split("\n")
499 header = lines[0]
500 issue_line = lines.find {|l| l =~ /^#{issue.id},/}
499 s1 = "\xaa\xac\xbaA".force_encoding('Big5')
501 s1 = "\xaa\xac\xbaA".force_encoding('Big5')
500 assert_include s1, lines[0]
502 assert_include s1, header
501 assert_include str_big5, lines[1]
503 assert_include str_big5, issue_line
502 end
504 end
503 end
505 end
504
506
@@ -515,9 +517,11 class IssuesControllerTest < ActionController::TestCase
515 :set_filter => 1
517 :set_filter => 1
516 assert_equal 'text/csv; header=present', @response.content_type
518 assert_equal 'text/csv; header=present', @response.content_type
517 lines = @response.body.chomp.split("\n")
519 lines = @response.body.chomp.split("\n")
520 header = lines[0]
521 issue_line = lines.find {|l| l =~ /^#{issue.id},/}
518 s1 = "\xaa\xac\xbaA".force_encoding('Big5') # status
522 s1 = "\xaa\xac\xbaA".force_encoding('Big5') # status
519 assert lines[0].include?(s1)
523 assert header.include?(s1)
520 s2 = lines[1].split(",")[2]
524 s2 = issue_line.split(",")[2]
521 s3 = "\xa5H?".force_encoding('Big5') # subject
525 s3 = "\xa5H?".force_encoding('Big5') # subject
522 assert_equal s3, s2
526 assert_equal s3, s2
523 end
527 end
@@ -536,7 +540,7 class IssuesControllerTest < ActionController::TestCase
536 :set_filter => 1
540 :set_filter => 1
537 assert_equal 'text/csv; header=present', @response.content_type
541 assert_equal 'text/csv; header=present', @response.content_type
538 lines = @response.body.chomp.split("\n")
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 end
544 end
541 end
545 end
542
546
@@ -553,7 +557,7 class IssuesControllerTest < ActionController::TestCase
553 :set_filter => 1
557 :set_filter => 1
554 assert_equal 'text/csv; header=present', @response.content_type
558 assert_equal 'text/csv; header=present', @response.content_type
555 lines = @response.body.chomp.split("\n")
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 end
561 end
558 end
562 end
559
563
General Comments 0
You need to be logged in to leave comments. Login now