diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2015-01-16 04:57:10 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2015-01-16 04:57:10 +0000 |
commit | 7f29c2fd88f271ac59f1c10b90942fec57b35ae2 (patch) | |
tree | 2495a55f6bcdef40d5a928d7792e5478d40ee57b | |
parent | e7346625f09fb092275538f2c9d5373cb931b36b (diff) | |
download | redmine-7f29c2fd88f271ac59f1c10b90942fec57b35ae2.tar.gz redmine-7f29c2fd88f271ac59f1c10b90942fec57b35ae2.zip |
IssuesControllerTest: make encoding tests independent of ordering (#18856)
Contributed by Antonio Terceiro.
git-svn-id: http://svn.redmine.org/redmine/trunk@13885 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | test/functional/issues_controller_test.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 49fff0adb..04ebec0df 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -496,9 +496,11 @@ class IssuesControllerTest < ActionController::TestCase :format => 'csv' assert_equal 'text/csv; header=present', @response.content_type lines = @response.body.chomp.split("\n") + header = lines[0] + issue_line = lines.find {|l| l =~ /^#{issue.id},/} s1 = "\xaa\xac\xbaA".force_encoding('Big5') - assert_include s1, lines[0] - assert_include str_big5, lines[1] + assert_include s1, header + assert_include str_big5, issue_line end end @@ -515,9 +517,11 @@ class IssuesControllerTest < ActionController::TestCase :set_filter => 1 assert_equal 'text/csv; header=present', @response.content_type lines = @response.body.chomp.split("\n") + header = lines[0] + issue_line = lines.find {|l| l =~ /^#{issue.id},/} s1 = "\xaa\xac\xbaA".force_encoding('Big5') # status - assert lines[0].include?(s1) - s2 = lines[1].split(",")[2] + assert header.include?(s1) + s2 = issue_line.split(",")[2] s3 = "\xa5H?".force_encoding('Big5') # subject assert_equal s3, s2 end @@ -536,7 +540,7 @@ class IssuesControllerTest < ActionController::TestCase :set_filter => 1 assert_equal 'text/csv; header=present', @response.content_type lines = @response.body.chomp.split("\n") - assert_equal "#{issue.id},1234.50,#{str1}", lines[1] + assert_include "#{issue.id},1234.50,#{str1}", lines end end @@ -553,7 +557,7 @@ class IssuesControllerTest < ActionController::TestCase :set_filter => 1 assert_equal 'text/csv; header=present', @response.content_type lines = @response.body.chomp.split("\n") - assert_equal "#{issue.id};1234,50;#{str1}", lines[1] + assert_include "#{issue.id};1234,50;#{str1}", lines end end |