aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-08-01 20:07:28 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2009-08-01 20:26:05 -0700
commitf2a35723c8876697d5a7ebfdf329cee54d8a39ac (patch)
tree5cdc710831535f76addb2591b6e31e0f5db67d02 /actionpack
parentec94c2550dae463e646a18316bfcdaded9d140c9 (diff)
downloadrails-f2a35723c8876697d5a7ebfdf329cee54d8a39ac.tar.gz
rails-f2a35723c8876697d5a7ebfdf329cee54d8a39ac.tar.bz2
rails-f2a35723c8876697d5a7ebfdf329cee54d8a39ac.zip
Ruby 1.9: fix encoding for test_file_stream
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/test/controller/send_file_test.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/test/controller/send_file_test.rb b/actionpack/test/controller/send_file_test.rb
index 154daad1b9..f0c723eaa2 100644
--- a/actionpack/test/controller/send_file_test.rb
+++ b/actionpack/test/controller/send_file_test.rb
@@ -4,7 +4,7 @@ require 'abstract_unit'
module TestFileUtils
def file_name() File.basename(__FILE__) end
def file_path() File.expand_path(__FILE__) end
- def file_data() File.open(file_path, 'rb') { |f| f.read } end
+ def file_data() @data ||= File.open(file_path, 'rb') { |f| f.read } end
end
class SendFileController < ActionController::Base
@@ -60,6 +60,7 @@ class SendFileTest < ActionController::TestCase
require 'stringio'
output = StringIO.new
output.binmode
+ output.string.force_encoding(file_data.encoding) if output.string.respond_to?(:force_encoding)
assert_nothing_raised { response.body_parts.each { |part| output << part.to_s } }
assert_equal file_data, output.string
end