Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ruby 1.9: fix encoding for test_file_stream

  • Loading branch information...
commit f09ceb55c0eaa8f81d5cb426501a32f86f96b23c 1 parent dc559f2
@jeremy jeremy authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  actionpack/test/controller/send_file_test.rb
View
3  actionpack/test/controller/send_file_test.rb
@@ -4,7 +4,7 @@
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
@@ -51,6 +51,7 @@ def test_file_stream
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.call(response, output) }
assert_equal file_data, output.string
end
Please sign in to comment.
Something went wrong with that request. Please try again.